Prj5 - Thread Synchronization
Prj5 - Thread Synchronization
”
Note that, the drawing does not show the standard streams associated with the pseudo-terminal “pts/0”.
i) Application Context
Compile& run “prj5ref1.c”, and display:
✓ the multi-threaded hierarchy;
✓ the IPC framework;
✓ the FDT table entries of the process.
Familiarize with the use of commands that
display the LWPids and threads as Linux tasks.
✓ Producer and consumer threads maintain their own record counter; consumer reads the record count
variable maintained by the producer; thus, the integrity of the shared variable is not compromised.
Note that this solution waits for 1 extra second to terminate in case the producer ends but
consumer has not yet displayed the last record. But, this mishap is harmless, and consumer
termination delay is acceptable.
v) Take the screen shut of pts/2” covering the entire output generated by your application and save it as the
“ph1 pst2.jpg” or “ph1 pst2.png” file.
vi) On pts/0 enter the EOF character to end your application; the output displayed on pts/1 should be like the
one posted here after.
vii) Take the screen shut of “/dev/pts/1” covering the entire output generated by your application and save it as
the “ph1 pst1.jpg” or “ph1 pst1.png” file.
At Phase 2 will implement the race version of the application defined in phase 1, in which threads will still share an
unbounded buffer but coordinate their activities using shared variables controlled with POSIX Semaphores.
v) Take the screen shut of pts/2 covering the entire output generated by your application and save it as the
“ph2 pst2.jpg” or “ph2 pst2.png” file.
vi) On pts/0 enter the EOF character to end your application; the output displayed on pts/1 should be like the
one posted here after.
vii) Take the screen shut of pts/1 covering the entire output generated by your application and save it as the
“ph2 pst1.jpg” or “ph2 pst1.png” file.
i) Compress files listed here after using the related document stored under Resources/How to?
✓ “phase1.c” “ph1 pst1.jpg” or “ph1 pst1.png” “ph1 pst2.jpg” or “ph1 pst2.png” files
✓ “phase2.c” “ph2 pst1.jpg” or “ph2 ps1.png” “ph2 pst2.jpg” or “ph2 pst2.png” file
The submitted file should contain only the documents listed above!
ii) Store compressed report in the Prj5:CSE5031-group# folder located under Assignments heading at the
CATS course portal CSE5031 OS.