Implement a solution to the critical section problem with threads using semaphores
$10-30 USD
Imekamilika
Imechapishwa about 7 years ago
$10-30 USD
Kulipwa wakati wa kufikishwa
Implement a solution to the critical section problem with threads using semaphores. You will modify the same code as in the previous project, 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 sem init, sem wait, and sem post. You can find pages online at:
[login to view URL]
[login to view URL]
[login to view URL]
Please compare this solution with the earlier mutex lock solution in terms of time used. Justcompare the two thread version (though you hand in with 3 threads). Use the same time commands included with the last project. In your comments when you hand in compare the run times. Explainas best you can why they are the same or different in your opinion.