Assignment
General Grading Guidelines: The following deductions will apply to all programming assignments. 1. Any program that does not compile will result in a zero for the assignment. No exceptions will be made for ‘accidental’ uploads, so...
General Grading Guidelines: The following deductions will apply to all programming assignments. 1. Any program that does not compile will result in a zero for the assignment. No exceptions will be made for ‘accidental’ uploads, so...
General Grading Guidelines:
The following deductions will apply to all programming assignments.
1. Any program that does not compile will result in a zero for the assignment. No exceptions will be made for ‘accidental’ uploads, so check your code before submitting.
2. Poor Formatting and programming style will result in a 5% deduction. Please see the style guidelines to avoid this deduction.
3. This can be individual work or group of max 3 individuals.
4. The code will go through 2 steps of plagiarism detection. Zero tolerance for academic misconduct! If you commit any form of academic misconduct in this course, you WILL be reported to the FIU Student Conduct and Academic Affairs office.
5. Error management is required and is worth 5pts. (e.g. if mutex init or lock fails )
Programming Style Guidelines:
The major purpose of programming style guidelines is to make programs easy to read and understand. Good programming style helps make it possible for a person knowledgeable in the application area to quickly read a program and understand how it works.
1. Your program should begin with a comment that briefly summarizes what it does. For this course, this comment should also include your Name and pantherID.
2. Use additional comments when needed in order for a reader to understand what is happening (see also, point 3).
3. Variable names and function names should be sufficiently descriptive so that a knowledgeable reader can easily understand what the variable means and what the function does. If this is not possible, comments should be added to make the meaning clear.
4. Use consistent indentation to emphasize block structure.
5. Use names of moderate length for variables. Most names should be between 2 and 12 letters long.
6. Use either underscores or capitalization (camelNaming) for compound names for variables. e.g: tot_vol, total_volumn, or totalVolumn.
Assignment description :
Implement a solution to the critical section problem with threads using semaphores. You will modify the same code as in the previous programming assignment (PA2), but you must add a third counting thread which counts by 1 each time it enters its critical section to 2,000,000. Each counts to 2,000,000 for a total of 6,000,000.
You will need to read about semaphore operations from Linux manual pages. The important ones are seminit, semwait, and sempost.
Make comments indicating the following sections in your code:
entry section
critical section
exit section
remainder section
Expected output:
both threads need to report the number of updates done at the end of their remainder sections.
both threads need to report the current value of the shared variable counter at the end of their remainder sections.
thread1 needs to report the number of times it got the bonus at the end of its remainder sections.
Im thread1, I did 2000000 updates and I got the bonus for 18562 times, counter = 2106222
Im thread3, I did 2000000 updates, counter = 5573136
Im thread2, I did 2000000 updates, counter = 6000000
from parent counter = 6000000
IMPORTANT!
No loop should be inside the critical section!
Remember to include the following as a comment in your file:
Your name
Your panther ID
A description of the program
Questions?
if you have any questions or you need help with code please contact your TA Cong Hoang and attend the weekly help sessions.
Deliverables:
Please submit:
1- your code in a PDF format. (e.g. semaphore.pdf )
2- zip file with your C source code included and (optionally) a makefile. (e.g. semaphore.zip)
Your code will be tested on a Linux machine with gcc compiler using the command gcc -ofname thread-solution.c -lpthread .
PEER EVALUATION (ONLY FOR GROUPS):
if you choose to work in a group, every member of the group should submit a peer evaluation to Peer evaluation for PA3 . Only one member should submit the deliverables here.
The peer evaluation is worth 5pts of the total assignment grade. if the group contains 3 members, you will get the average of both ratings of your teammates. However, if you assign a rating <=3 to a team mate you need to provide a justification in the peer evaluation assignment. Any member reported as non-cooperative and non-contributing will get a zero in this assignment.
if a member did not submit the peer evaluation of his team members he will get -5pts of his assignment grade.
For privacy and security, delivered files are not available for public download. The student who placed this order can sign in to access the delivered work from their dashboard.
Post your assignment and receive offers from verified writers in your subject area.
Post a new assignment Back to latest orders