In the cuncurrent programming the semaphore represents a shyncronization construct among processes.
In this exercise a mailbox is a resource shared among threads: a person and several postmen.
The semaphore is used to shyncronize the access at the resource by the threads: the person can't draws a mail from the mailbox if the postman is delivering it, while a postman can't delivers a mail if the person is drawning it or if another postman is delivering it.
Download the java source code about the exercise on semaphores:
esame_sistemi_operativi_mailbox.jar
81kB
Copyright © 2003, 2008 Tarin Gamberini
Last updated 20/01/2008