Assignment
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 q...
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 q...
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 via semaphores and threads to the n reader 1 writer problem. You will accept the number of readers from the command line. The maximum number of readers allowed is 12 readers.
Each reader must access a shared counter value 2000000 times in the critical section. Readers, only read the shared value no updates are allowed. A reader reads just one time and a writer writes just one time. Each reader needs to print its name and the value of the shared counter when done.
The writer will increment the shared value 25000 times and print " writer done".
Explain in the description section if your solution is starvation free/prone and why.
Make comments indicating the following sections in your code:
entry section
critical section
exit section
remainder 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 2 separate files:
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 .
if you submit only one file you will get 0. No excuses are accepted.
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