程序代写代做 C A. Description of the Assignment

A. Description of the Assignment
A1. You are required to read and fully understand the first 4 chapters, that is, pages 1-129, of the book “Programming with POSIX Threads” by David R. Butenhof (This book is currently on reserve at Steacie Science Library, Call Number QA 76.76 T55 B88 1997).
You are also required to read Chapter 7, p.301-302, of the course textbook, “Operating System Concepts,” 10th Edition, by A. Silberschatz et al., on how to use POSIX unnamed semaphores.
A2. You are required to download the program “alarm_cond.c” and the file “errors.h” and “README” from the directory /cs/course/3221M/assign3, and then try to compile and execute this program by following the instructions in the “README” file. (This program is explained in pages 82-88 of the book by David R. Butenhof).
A3. You are required to make the following changes to the program “alarm_cond.c” to produce a program named “New_Alarm_Cond.c”.
A3.1 Two types of “Alarm requests” in “New_Alarm_Cond.c”
Two types of “Alarm requests”, “Start_Alarm”, and “Change_Alarm” requests, are recognized and handled by “New_Alarm_Cond.c”, as follows:
(a) “Start_Alarm” requests with the following format:
Alarm> Start_Alarm(Alarm_ID): Group(Group_ID) Time Message
– “Start_Alarm” is a keyword.
– “Alarm_ID” is a positive integer.
– “Group” is a keyword.
– “Group_ID” is a positive integer.
– “Time” has the same meaning and syntax as in the program “alarm_mutex.c”.
– “Message” has the same meaning and syntax as in the program “alarm_mutex.c”.
For example:
Alarm> Start_Alarm(2345): Group(13) 50 Will meet you at Grandma’s house at 6 pm

(b) “Change_Alarm” requests with the following format:
Alarm> Change_Alarm(Alarm_ID): Group(Group_ID) Time Message
– “Change_Alarm” is a keyword.
– “Alarm_ID” is a positive integer.
– “Group” is a keyword.
– “Group_ID” is a positive integer.
– “Time” has the same meaning and syntax as in the program “alarm_mutex.c”.
– “Message” has the same meaning and syntax as in the program “alarm_mutex.c”.
For example:
Alarm> Change_Alarm(2345): Group(21) 80 Will meet you at Grandma’s house later at 8 pm
If the user types in something other than one of the above two types of valid alarm requests, then an error message will be displayed, and the invalid request will be discarded.
A3.2. The main thread in “New_Alarm_Cond.c”
The main thread in “New_Alarm_Cond.c” will first determine whether the format of each alarm request is consistent with the formats specified above; otherwise the alarm request will be rejected with an error message. If a Message exceeds 128 characters, it will be truncated to 128 characters.
A.3.2.1 For each Start_Alarm request received, the main thread will insert the corresponding alarm with the specified Alarm_ID into the alarm list, in which all the alarms are placed in the order of their Alarm_IDs. Then the main thread will print: “Alarm( ) Inserted by Main Thread Into Alarm List at : Group()

the number of seconds from the Unix Epoch Jan 1 1970 00:00; ,

A.3.5.2. For each alarm, if that alarm has been removed from the alarm list by the alarm removal thread, then the display alarm thread responsible for displaying/printing messages for the group of that alarm will stop printing the message in that alarm. Then the display alarm thread will print:
“Display Thread Has Stopped Printing Message of Alarm( at : Group()

any number of reader processes should be able to read information from the alarm list simultaneously.
A3.5.2. You are required to use POSIX unnamed semaphores, described in Chapter 7, p.301-302, of the course textbook, “Operating System Concepts,”10th Edition, to synchronize thread accesses to the alarm list.
B. Platform on Which The Programs Are to be Implemented
The programs should to be implemented using the ANSI C programming language and using the Prism Linux system at York. You should use POSIX system calls or POSIX functions whenever possible.
C. Additional Requirements
(a) You must make sure that your code has very detailed comments.
(b) You must make sure that your code compiles correctly with your Make file.
(c) You must make sure that your code does not generate segmentation faults.
(d) You must make sure that your code is able to handle incorrect input.
(e) You must describe in detail any problems or difficulties that you had encountered, and how you solved or were able to overcome those problems or difficulties in the report.
Failure to satisfy the additional requirements above will result in a very low mark for the assignment.
D. What to Hand In
Each group is required to hand in both a hard copy and an electronic copy of the following:
1. A written report that identifies and addresses all the important aspects and issues in the design and implementation of the programs for the problem described above.
2. The C source programs.
3. A “Test_output” file containing the output of any testing your group have done.
4. A “makefile” file to make it easier for the marker to compile and run your group’s program.

5. A “README” file explaining how to compile and run your group’s program.
Each group is required to use the utility “submit” to submit the electronic version of the above 5 files plus the “errors.h” file to the course directory /cs/course/3221E/submit/a3
(The file “errors.h” should be included among the files submitted so that the marker can test whether your group’s programs can compile and run correctly or not.)
E. Evaluation of the Assignment
1. The report part of your assignment (50%) will be evaluated according to:
(a) Whether all important design and implementation aspects and issues of your programs related to the problem above have been identified and appropriately addressed.
(b) How well you have justified your design decisions.
(c) The quality of your design.
(d) How well you have designed and explained the testing. (e) The clarity, and readability of the report.
2. The program and testing part of your assignment (50%) will be evaluated according to: (a) The quality of the design and implementation of your programs.
(b) The quality of the testing of your programs.
(c) Whether your programs satisfy the Additional Requirements in section C above.