Computer Science 330
Operating Systems
Fall 2025, Siena University
In this mini project (more like a mini problem set), you will practice coming up with a semaphore-based solution to a synchronization problem.
You may work alone or with a partner or two on this mini project. However, in order to make sure you learn the material and are well-prepared for the exams, those who work in a group should either collaborate closely while completing the problem or work through the problem individually then discuss them within your group to agree on a solution.
Learning goals:
Synchronization Problem
For the problem below, develop pseudocode for the actions of the cooperating processes. Use semaphores for synchronization. The only permitted operations are initialization, wait, and signal. You may assume the semaphores are fair. You may introduce other shared variables, but be careful about concurrent access.
In a far off land lives a wealthy but quite lazy man who enjoys sleeping and enjoys fancy chocolates. He would like to eat as many chocolates as he can, but does not want his sleep distrubed unless there is enough chocolate to satisfy him. To this end, he has hired n chocolatiers and purchased a candy dish that holds x fancy chocolates. The chocolatiers work continuously to produce single fancy chocolates. As soon as the candy dish fills, the chocolatier who placed the xth fancy chocolate wakes the man, who immediately eats all of the chocolates in one gulp and soon after returns to sleep (always before the chocolatiers can refill the dish). Your solution should synchronize the actions of the man and his chocolatiers.
Submission
Submit a PDF document that includes your solution to Canvas.
Grading
This assignment will be graded out of 20 points.
|
Feature | Value | Score |
| Synchronization Problem | 20 | |
| Total | 20 | |