国产人妻人伦精品_欧美一区二区三区图_亚洲欧洲久久_日韩美女av在线免费观看

合肥生活安徽新聞合肥交通合肥房產生活服務合肥教育合肥招聘合肥旅游文化藝術合肥美食合肥地圖合肥社保合肥醫院企業服務合肥法律

COMP2046代做、代寫C/C++編程設計
COMP2046代做、代寫C/C++編程設計

時間:2024-12-26  來源:合肥網hfw.cc  作者:hfw.cc 我要糾錯



COMP2046 Coursework Autumn 2024
Weight: 20% module marks
Deadline: 27th December 2024, 5pm Beijing time 
Submission: Create a single scyXXX.zip (Student account) file containing your source code files and files 
provided along with this coursework. We will need to rebuild your code to test your implementation. You 
should submit your single zip file through Moodle.
Overview
The goal of this coursework is to make use of operating system APIs (specifically, the POSIX API in Linux) 
and simple concurrency directives to solve a number of synchronisation problems that occur on 
scheduling systems that are similar to the ones that you may find in fairly simple operating systems. 
Completing all tasks will give you a good understanding of: 
• The use of operating system APIs in Linux. 
• Critical sections, semaphores, mutexes, and the principles of synchronisation/mutual exclusion. 
• The implementation of linear bounded buffers of a fixed size using linked lists. 
• The basics of concurrent/parallel programming using an operating system’s facilities (e.g. 
semaphores, mutex).
• Basic process creation, memory image overwriting and shared memory usage.
Getting Help
You MAY ask Dr Qian Zhang and Dr Fiseha B. Tesema for help in understanding coursework requirements 
if they are not clear (i.e. what you need to achieve). Any necessary clarifications will then be added to the 
Moodle page so that everyone can see them.
You may NOT get help from anybody else to actually do the coursework (i.e. how to do it), including 
ourselves. You may get help on any of the code samples provided, since these are designed to help you 
to do the coursework without giving you the answers directly.
Background Information
All code should be implemented in C and tested on the school’s Linux servers. Code that cannot be 
successfully compiled on the school’s Linux servers using the provided source/header files will affect your 
marks.
Additional information on programming in Linux, the use of POSIX APIs, and the specific use of threads 
and concurrency directives in Linux can be found, e.g., here (it is my understanding that this book was 
published freely online by the authors and that there are no copyright violations because of this).
Additional information on the bounded buffer problem can be found in, e.g.:
• Tanenbaum, Andrew S. 2014 Modern Operating Systems. 4th ed. Prentice Hall Press, Upper 
Saddle River, NJ, USA., Chapter 2, section 2.3.4
• Silberschatz, Abraham, Peter Baer Galvin, Greg Gagne. 2008. Operating System Concepts. 8th 
ed. Wiley Publishing, Chapter 4 and 5
• Stallings, William. 2008. Operating Systems: Internals and Design Principles. 6th ed. Prentice Hall 
Press, Upper Saddle River, NJ, USA, Chapter 5
• In addition to these books, much of the information in the lecture notes should be extremely 
helpful 
Please use only the system calls or POSIX libraries discussed in the lab. The use of any other system calls 
or POSIX libraries is not allowed.
Coding and Compiling Your Coursework 
You are free to use a code editor of your choice, but your code MUST compile and run on the school’s 
Linux servers. It will be tested and marked on these machines.
For task 1
We have provided a header file, linkedlist.h, which contains three function prototypes. The source 
file, linkedlist.c, includes the implementation of these functions. This code implements a basic singly 
linked list with the following three functions:
1. addLast: Adds a new element to the end of the list.
2. addFirst: Adds a new element to the beginning of the list.
3. removeFirst: Removes and returns the first element from the list.
It dynamically manages memory for the list nodes and handles edge cases, such as empty lists. The list 
structure is defined using a struct element that holds a data pointer and a next pointer, making the 
implementation flexible for various data types.
To ensure consistency across all students, changes are not to be made on the given source files. Note that, 
in order to use these files with your own code, you will be required to specify the file on the command 
line when using the gcc compiler (e.g. (updated Dec 4)
and include the linkedlist.c file in your code (using #include “linkedlist.h”).
For task 2
You should ensure that your code compiles using the GNU C-compiler, e.g., with the command:
(updated Dec 4)
(updated Nov28)
gcc –std=c99 TASKX.c -o TASKX linkedlist.c -pthread 
gcc TASK2.c -o TASK2output -lrt -pthread
Copying Code and Plagiarism
You are allowed to freely copy and adapt code samples provided in lab exercises or lectures. Additionally, 
you may use examples from Linux/POSIX websites, which offer many code snippets to help with specific 
tasks. This coursework assumes and encourages the use of these resources as part of the learning process. 
Since you are not claiming this code as your own original work, this does not constitute plagiarism.
Please note that some provided examples may omit error checking for clarity. It is your responsibility to 
include appropriate error checking in your implementation.
However, you must not copy code from any other sources, including:
• Another student, whether from this course or any other course.
• Any third-party sources, such as ChatGPT or similar tools.
If you do so, it will be considered an attempt to pass someone else’s work as your own, which is plagiarism. 
The University treats plagiarism very seriously. Consequences may include receiving a zero for the 
coursework, failing the module, or facing more severe penalties.
Task 1: Concurrency problem: Bounded buffers (60 %)
In this task you will implement a bounded buffer (i.e. of fixed size) of characters in two different ways. 
In task 1a, you will: 
• Use a single producer and single consumer. 
• Synchronise using binary semaphores (or mutexes where appropriate). 
In task 1b, you will: 
• Use multiple producers and multiple consumers. 
• Synchronise using counting semaphores (or mutexes where appropriate).
In both cases, you will produce/consume a pre-determined number of elements. Both tasks will give you 
good insights into the different synchronisation approaches for bounded buffers. 
Task 1a: Bounded buffer with binary semaphores (30 marks)
You are asked to implement a FCFS bounded buffer (represented as linked list). The buffer can contain at 
most MAX_BUFFER_SIZE (defined in the task1a.c code templet) elements, and each element contains one 
character (a ‘*’ in this case). You are asked to implement a single producer and a single consumer. The 
producer generates MAX_NUMBER_OF_JOBS (defined in the task1a.c code templet) ‘*’ characters and 
adds them to the end of the buffer (provided that empty spaces are available). The consumer removes ‘*’ 
characters from the start of the buffer (provided that full elements are available). Each time the producer 
(consumer) adds (removes) an element, the number of elements currently in the buffer is shown on the 
screen as a line of stars (see output sample provided task1a.txt). Different implementations and 
synchronisation approaches are possible, however, we are asking you to use only binary semaphores (or 
mutexes where appropriate) in your implementation. 
The final version of your code will include:
• A linked list of characters representing the bounded buffer utilised in the correct manner. The 
maximum size of this list should be configured to not exceed, e.g., 50 elements. 
• A producer function that generates stars (‘*’) and adds them to the end of the buffer (using addLast) 
as soon as space is available. 
• A consumer function that removes elements from the start of the buffer using removeFirst (one at 
a time).
• A visualisation function that displays the exact number of elements currently in the buffer (using a 
line of stars) on the screen every time an element is added to or removed from the buffer. 
• The code to: 
o Declare all necessary semaphores/mutexes and initialise them to the correct values. 
o Create the producer/consumer threads. 
o Join all threads with the main thread to prevent the main thread from finishing before 
the consumers/producers have ended. 
o Generate output similar in format to the example provided for this requirement
(task1a.txt) (for 100 jobs, using a buffer size of 10). 
Task 1b: Bounded buffer with counting semaphores (30 marks)
You are asked to, similar to task1a, implement a bounded buffer of characters, however, this time with 
multiple producers (NUMBER_OF_PRODUCERS defined in task1b.c code templet), multiple consumers
(NUMBER_OF_CONSUMERS defined in task1b.c code templet), and counting semaphores. The producers 
generate a total of MAX_NUMBER_OF_JOBS (defined in the task1b.c code templet) elements, which are 
removed by multiple consumers. Every time one of the producers or consumers adds or removes an 
element, the number of elements currently in the buffer is shown as a line of ‘*’ characters (see output 
sample on Moodle). Note that every producer/consumer has a unique Id assigned to them in the output. 
Similar to task1a, a correct implementation of this requirement includes: 
• A linked list of characters representing the bounded buffer utilised in the correct manner. The 
maximum size of this list should be configured to not exceed, e.g., 50 elements. 
• Multiple producer threads that generate a total number of MAX_NUMBER_OF_JOBS ‘*’ 
characters, and not more. That is, the number of elements produced by the different threads 
sums up to MAX_NUMBER_OF_JOBS. Elements are added to the buffer as soon as free spaces are 
available. Note that every producer may end up producing a different number of elements, 
depending on the way threads are interleaved, but that the total items produced should be equal 
to MAX_NUMBER_OF_JOBS. 
• A consumer function that removes elements from the start of the buffer using removeFirst (one 
at a time). 
• A mechanism to ensure that all consumers terminate gracefully when MAX_NUMBER_OF_JOBS 
have been consumed. 
• A visualisation function that displays the exact number of elements currently in the buffer (using 
a line of stars) on the screen every time an element is added to or removed from the buffer. 
• The code to: 
o Declare all necessary semaphores/mutexes and initialise them to the correct values. 
o Create the producer/consumer threads. 
o Join all threads with the main thread to prevent the main thread from finishing before 
the consumers/producers have ended. 
o Generate output similar in format to the example provided in this coursework (task1b.txt) 
for this requirement (for 100 jobs, using a buffer size of 10). 
Marking criteria:
The criteria used in the marking task1a and task1b of your coursework include: 
• Whether you have submitted the code and you are using the correct naming conventions and 
format. 
• Whether the code compiles correctly, and runs in an acceptable manner. 
• Whether you utilise and manipulate your linked list in the correct manner. 
• Whether semaphores/mutexes are correctly defined, initialised, and utilised. 
• Whether consumers and producers are joined correctly. 
• Whether the correct number of producers and consumers has been utilised, as specified in the 
coursework description. 
• Whether consumers and producers end gracefully/in a correct manner.
• Whether consumers/producers have been assigned a unique id (as can be seen from the output 
provided on Moodle). 
• Whether the exact number of elements is produced and consumed. 
• Whether your code is efficient, easy to understand, and allows for maximum parallelism (i.e. no 
unnecessary synchronisation is applied). 
• Whether unnecessary/inefficient/excessive busy waiting is used in your code. 
• Whether your code runs free of deadlocks.
• Whether the output generated by your code follows the format of the examples provided on 
Moodle.
Submission requirements: 
• Give your solutions extending the given code template task1a.c and task1b.c
• Name your output for the tasks “task1a.txt” and “task1b.txt” respectively. Please stick rigorously 
to the naming conventions, including capitalisation. 
• Add your task1a.c and task1b.c code files, as well as the output files task1a.txt and task1b.txt, to 
your submission folder. Include the provided linkedlist.c and linkedlist.h files in the submission 
folder as well.
• Your code must compile using (updated Nov28)
gcc -std=c99 task1a.c -o task1a linkedlist.c -pthread and 
gcc -std=c99 task1b.c -o task1b linkedlist.c -pthread on the school’s linux
servers. 
Task 2: Shared Memory (40 marks)
Use the knowledge you’ve obtained during the labs, finish the following question. You are asked to 
implement a solution for using shared memory for inter-process communication. Requirements of 
implementation are:
• A parent process (TASK2.c) that creates two new child processes;
• The process image of the two child processes is overwritten to execute ChildP1.c and ChildP2.c 
respectively.
• In TASK2.c, you are required to randomly generate an integer (RandInt) within the range of 1 to 
20 and print out the value of RandInt. The integer RandInt will be stored in shared memory with 
an appropriate structure for future usage.
• The ChildP1 will wait for a random amount of time and then double the value of RandInt. As soon 
as ChildP1 modified the RandInt, the other child process ChildP2 subtracting a value of 10 from 
the existing value.
• ChildP1 and ChildP2 need to take turn performing doubling and subtraction on RandInt 10 times. 
You are not permitted to use sleep() or any similar function to manually control the execution 
order of processes.
• Make sure that the ChildP2.c won’t be able to access to the RndInt before ChildP1.c finishes its 
task.
• Use shared memory to store all the values (intermediate results) of RandInt.
• Once all child processes have finished their tasks, the parent process needs to print out the value 
of RandInt at each instance.
• Your code must be compired using: (updated Dec 4)
gcc -lrt ChildP1.c -o ChildP1 -pthread 
gcc -lrt ChildP2.c -o ChildP2 -pthread 
gcc -lrt TASK2.c -o TASK2output -plhtread 
For this task, you are required to submit three files: TASK2.c, ChildP1.c and ChildP2.c

請加QQ:99515681  郵箱:99515681@qq.com   WX:codinghelp









 

掃一掃在手機打開當前頁
  • 上一篇:URBA6006代寫、Java/c++編程語言代做
  • 下一篇:代寫公式 公式指標代寫代做 指標公式選股公式
  • 無相關信息
    合肥生活資訊

    合肥圖文信息
    流體仿真外包多少錢_專業CFD分析代做_友商科技CAE仿真
    流體仿真外包多少錢_專業CFD分析代做_友商科
    CAE仿真分析代做公司 CFD流體仿真服務 管路流場仿真外包
    CAE仿真分析代做公司 CFD流體仿真服務 管路
    流體CFD仿真分析_代做咨詢服務_Fluent 仿真技術服務
    流體CFD仿真分析_代做咨詢服務_Fluent 仿真
    結構仿真分析服務_CAE代做咨詢外包_剛強度疲勞振動
    結構仿真分析服務_CAE代做咨詢外包_剛強度疲
    流體cfd仿真分析服務 7類仿真分析代做服務40個行業
    流體cfd仿真分析服務 7類仿真分析代做服務4
    超全面的拼多多電商運營技巧,多多開團助手,多多出評軟件徽y1698861
    超全面的拼多多電商運營技巧,多多開團助手
    CAE有限元仿真分析團隊,2026仿真代做咨詢服務平臺
    CAE有限元仿真分析團隊,2026仿真代做咨詢服
    釘釘簽到打卡位置修改神器,2026怎么修改定位在范圍內
    釘釘簽到打卡位置修改神器,2026怎么修改定
  • 短信驗證碼 豆包網頁版入口 破天一劍 目錄網 排行網

    關于我們 | 打賞支持 | 廣告服務 | 聯系我們 | 網站地圖 | 免責聲明 | 幫助中心 | 友情鏈接 |

    Copyright © 2025 hfw.cc Inc. All Rights Reserved. 合肥網 版權所有
    ICP備06013414號-3 公安備 42010502001045

    国产人妻人伦精品_欧美一区二区三区图_亚洲欧洲久久_日韩美女av在线免费观看
    精品麻豆av| 国产噜噜噜噜久久久久久久久| 日本不卡在线观看| 国产尤物99| 久久久噜噜噜久噜久久| 亚洲a∨日韩av高清在线观看| 黄色一级视频片| 日韩在线播放av| 亚洲精品在线视频观看| 国产精品亚洲精品| 欧美大成色www永久网站婷| 欧美与黑人午夜性猛交久久久| 久久在线中文字幕| 亚洲一区二区久久久久久久| 国产精品一区二区电影| 精品中文字幕视频| 国产系列第一页| 另类天堂视频在线观看| 国模精品视频一区二区三区| 久久久免费av| 青青在线视频一区二区三区| 国产福利视频一区二区| 天堂资源在线亚洲视频| 69精品小视频| 天堂av一区二区| 久久国产精品一区二区三区 | 国产精品国产亚洲伊人久久| 黄色一级免费大片| 国产精品男女猛烈高潮激情| 狠狠色综合网站久久久久久久| 久久色免费在线视频| 国内视频一区| 国产精品久久久久久久久久| 精品视频导航| 永久免费看av| 久久久亚洲福利精品午夜| 日本午夜在线亚洲.国产| 日本精品免费| 日韩中文字幕国产精品| 欧美日韩一区二区三| 国产精品毛片一区视频| 精品视频第一区| 一本色道久久综合亚洲二区三区| 91国产一区在线| 日本一区免费在线观看| 国产精品无码一区二区在线| 国精产品一区一区三区视频| 国产精品户外野外| 国产精品一二三在线| 亚洲日本精品国产第一区| 2019日韩中文字幕mv| 日韩一级免费看| 国产精品视频在线观看| 国产欧美日韩最新| 色噜噜色狠狠狠狠狠综合色一| www日韩欧美| 国产免费一区二区三区视频| 亚洲v日韩v综合v精品v| 日韩中文综合网| 国产偷人视频免费| 91国产精品视频在线| 久久亚洲精品无码va白人极品| 亚洲精品免费在线看| 国产freexxxx性播放麻豆| 欧美亚洲日本网站| 久热精品视频在线观看一区| 91精品国产高清自在线| 欧美亚洲在线视频| 国产99久久九九精品无码| 77777亚洲午夜久久多人| 欧美日韩精品免费观看视一区二区 | 色综合久久久久久中文网| 99精品人妻少妇一区二区| 日本不卡久久| 久久国产精品久久国产精品| 91看片淫黄大片91| 内射国产内射夫妻免费频道| 国产欧美精品久久久| 亚洲精品国产一区| 久久九九热免费视频| av免费精品一区二区三区| 日韩久久久久久久| 一区二区三区国产福利| www国产亚洲精品久久网站| 官网99热精品| 欧美精品卡一卡二| 亚洲国产另类久久久精品极度| 国产精品嫩草视频| 久久久7777| 国产精品伊人日日| 日韩免费观看视频| 一区二区三区av| 国产精品视频99| 久久精品网站视频| 成人国产精品日本在线| 免费久久99精品国产自| 日本高清视频一区二区三区| 久久久久久国产精品久久| 国产精品毛片a∨一区二区三区|国 | www.com毛片| 国产又粗又长又爽视频| 日本精品久久久久影院| 中文字幕在线乱| 精品国产免费人成电影在线观...| 久久艹国产精品| 77777亚洲午夜久久多人| 国产精品一区二区三区免费观看 | 国产综合免费视频| 欧美理论一区二区| 日韩av电影免费播放| 久久久久久91| 国产99午夜精品一区二区三区| 国产精品久久在线观看| 国产成人啪精品视频免费网| 久久国产欧美精品| 久久久久这里只有精品| 国产高清在线一区| 国产精品99久久久久久白浆小说 | 国产精品狠色婷| 国产精品久久婷婷六月丁香| 精品国内自产拍在线观看| 久久久久久一区二区三区| 久久久一本精品99久久精品66| 北条麻妃在线视频观看| 国产一区 在线播放| 国产又粗又爽又黄的视频| 国产综合色香蕉精品| 国产香蕉一区二区三区| 国产日韩欧美综合| 国产欧美日韩视频| 国产精品自产拍在线观看中文| 国产欧美韩国高清| 国产精品亚洲片夜色在线| aaa免费在线观看| 97伦理在线四区| 久久久婷婷一区二区三区不卡| 81精品国产乱码久久久久久| 国产成+人+综合+亚洲欧洲| 久久久久久久久久久综合| 久久av免费观看| 日韩在线国产精品| 久久九九国产精品怡红院| 国产精品久久久久影院日本| 九九综合九九综合| 亚洲一区二区三区四区在线播放| 午夜精品视频在线观看一区二区| 色综合视频二区偷拍在线| 日韩一级免费看| 国内精品国产三级国产在线专| 国内精品久久久久久中文字幕| 国产一区二区不卡视频在线观看| 成人免费aaa| 国产www精品| 国产精品入口日韩视频大尺度| 国产精品久久久久久av下载红粉 | 国产99视频精品免费视频36| 亚洲欧美日韩国产成人综合一二三区 | 人妻无码一区二区三区四区| 男女午夜激情视频| 国产综合中文字幕| 99视频在线播放| 国产成+人+综合+亚洲欧美丁香花 国产成+人+综合+亚洲欧洲 | 久久免费观看视频| 久久精品免费播放| 精品国产aⅴ麻豆| 亚洲国产日韩美| 欧美日韩精品免费观看| 国产免费人做人爱午夜视频| 久久久亚洲影院| 久久久精品免费| 在线天堂一区av电影| 日本在线成人一区二区| 精品日产一区2区三区黄免费 | 欧美激情区在线播放| 日本一道本久久| 国产在线精品一区二区中文 | 久久久亚洲精品视频| 国产精品久久网| 亚洲欧洲免费无码| 欧美性大战久久久久| 国产精品一区久久| 精品国内亚洲在观看18黄| 中文字幕一区二区中文字幕| 人人爽久久涩噜噜噜网站| 国产精品一线二线三线| 久久久精品久久久| 日本一区网站| 成人国产精品久久久久久亚洲| 精品国产拍在线观看| 亚洲一区二区三区在线视频| 美女被啪啪一区二区| 久久精品午夜一区二区福利| 久久成人亚洲精品| 奇米成人av国产一区二区三区 | 日韩av在线播放不卡| 国产精品一区久久| 国产精品免费一区二区三区观看| 亚洲精品女av网站| 国产欧美日韩免费看aⅴ视频| 久久久国产精品免费|