View Full Version : Semaphores

05-06-2003, 10:34 AM
Ok some of you might have done this already but this was a recent assignment and I want to see someone beat my score!

The problem: 3 smokers each have 1 of 3 elements (rolling papers, tabacco, matches) Another person has an infinite amout of all three. He wants to allow all the smokers to roll and smoke their own cigs. The suppiler puts out 2 out of 3 elements on the table and the correct smoker now knows he can proceed.

What is the min amount of semaphores need for this to run idefinately.

(I tried this using 4 processes and the best I could get was 4, 3 for each table setup and one to signal when finished)



05-06-2003, 07:37 PM
wuts a semaphore?

05-06-2003, 07:48 PM
Originally posted by Geo-Fry
wuts a semaphore?

I didn't know either but this (http://www.cs.cf.ac.uk/Dave/C/node26.html) seems like a good resource. I've read a little bit but won't have time to really get into it till this weekend. This actually seems to be a very useful concept.