Hi friends
I am developing a
thread program using Semaphores.
But i am new to concept
actually the need is to develop this program
1.A group of M fraternity brothers & sorority sisters is having a party & drinking from a keg that can hold 100 servings of beverage . one unlucky pledge is responsible for replacing the keg each time it empties. When a partier wants to drink, he or she fills a cup from keg, unless it is empty. If the keg is empty , the partier wakes up the pledge and then waits until the pledge has returned with a new keg. The behavior of the partiers and pledge is specified by the following �threads�:
Partier:
loop
tellPledgeIfKegIsEmpty
getServingFromKeg
drink
waitSomeAmountOfTime
end loop
Pledge:
loop
waitForKegToEmpty
getnewKeg
end loop
1. Develop a
Java monitor or Ada protected record which implements the actions of a semaphore.
2. Write a solution to the above program using that semaphore implementation for synchronization.Your Java or Ada solution should have a single command-line argument representing the number of partiers.
3. Write a solution to the above program without using the semaphore implementation.This program can use a separate class or protected record for synchronization but it should be one specially developed for the program(rather than a generic semaphore).It should not be exactly equivalent to the solution of 2). Again, use a single command-line argument representing the number of partiers.
i developed the third solution
please help me in compleating this assignment....