CSE130 Winter 2021 : Assignment 3
Basic / Manpage:
• Synchronize the activity of multiple threads to print a simplified manpage for Dykstra’s Semaphores.
Paragraphs for a simple manpage are made available to multiple threads is pseudo random order, these
threads must synchronize their activity so they invoke a supplied method to display paragraphs in the
Incorrect or no synchronization will see paragraphs displayed out of sequence and/or interleaved with
each other. Both will cause the test to fail.
Advanced / Cartman:
• Protect access to critical sections with POSIX concurrency primitives.
In an automated factory, Continuous Automated Rolling Trolleys ( CARTs ) running on narrow gauge
tracks are used to move finished goods from the assembly areas to shipping. The products are fragile, so
instead of CART tracks passing over and under each other, they cross at a small number of junctions as
Your task is to write the CART Manager ( Cartman ) that allows CARTs to safely cross the small sections
of track between junctions. These sections are small and CARTs move slowly, so in order for a CART to
safely pass between two junctions, exclusive access to both junctions must be secured before allowing a
CART to enter the critical section of track.
Whenever a CART arrives at a junction, Cartman will be informed of the arrival via the arrive() callback
unction and must ensure safe transit across the critical section of track by first securing exclusive access
to the relevant junctions via the reserve() function. Once exclusive access is gained, Cartman should
call the cross() function to set he CART on its way. Once across the critical section of track, the
depart() callback function will be invoked to let Cartman know the CART is safely across, at which point
the junctions should be marked as available again by calling release().
The following aspects will be assessed:
1. (100%) Does it work?
a. Manpage (30%)
b. Simple Cartman (30%)
c. Deadlock Cartman (15%)
d. Random Cartman (15%)
e. Your implementations are free of compiler warnings (10%)
2. (-100%) Did you give credit where credit is due?
a. Your submission is found to contain code segments copied from on-line resources and you failed to give
clear and unambiguous credit to the original author(s) in your source code (-100%). You will also be
subject to the university academic misconduct procedure as stated in the class academic integrity policy.
b. Your submission is determined to be a copy of a past or present student’s submission (-100%)
c. Your submission is found to contain code segments copied from on-line resources that you did give a
clear an unambiguous credit to in your source code, but the copied code constitutes too significant a
percentage of your submission: