[SOLVED] CMSC312 Assignment 2

30.00 $

Programming resource
Digital learning resource
Category:
✓ Practical programming resource
✓ Suitable for guided study and reference
✓ Tutor guidance available when needed

Description

5/5 - (1 vote)

1) Implement the counting semaphores using binary semaphores. Pseudo-code for the implementation is given in the attached notes on Canvas: 10xcountingSemUsingBinarySem.pdf
Use the bounded-buffer producer-consumer problem as uploaded on Canvas (first code at https://jlmedina123.wordpress.com/2014/04/08/255/). Show the output of this code for BOTH the incorrect and correct implementations. Also, attach your codes (two versions: for incorrect and correct solutions) on Canvas. (10+10)

3) Consider the sample code for the reader-writer problem on Canvas. Change this code using counting semaphores to implement the scenario where the number of active readers is upper-bounded by N. Use the correct implementation of counting semaphores from (1) in this modified code. (20)

Deliverables: (i) 4 different code files (two from (1), one each from (2) and (3)), (ii) A report showing the outputs from each of the above 4 cases.
Late Policy:
5 points will be deducted for each day the assignment is late upto a maximum of 2 days (10 point deduction).

Resource details

Understand the Task Before You Use the Resource

Review the requirements, identify the programming concepts involved, study the implementation and test your understanding with your own examples and modifications.