Thread: Semaphores

  1. #1
    Registered User
    Join Date
    May 2003

    Lightbulb Semaphores

    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)


    I'm with
    <----------- newb!

  2. #2
    Geo Geo Geo-Fry
    Join Date
    Feb 2003
    wuts a semaphore?
    "You can lead a man to Congress, but you can't make him think."
    "The Grand Old Duke of York
    -He had ten thousand men.
    -His case comes up next week."
    "Roses are red, violets are blue, I'm schizophrenic, and so am I."
    "A computer once beat me at chess, but it was no match for me at kick boxing."
    "More and more of our imports are coming from overseas."
    --George W. Bush
    "If it weren't for electricity, we'd all be wacthing TV by candlelight."
    --George W. Bush

  3. #3
    Registered User thePope's Avatar
    Join Date
    Mar 2003
    Originally posted by Geo-Fry
    wuts a semaphore?
    I didn't know either but this 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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Semaphores, need advice on implementation.
    By Swerve in forum C++ Programming
    Replies: 2
    Last Post: 01-13-2009, 01:54 AM
  2. semaphores
    By Dr Spud in forum C Programming
    Replies: 7
    Last Post: 09-22-2007, 12:45 PM
  3. Semaphores Problems
    By mhelal in forum Linux Programming
    Replies: 2
    Last Post: 05-06-2007, 10:36 PM
  4. Semaphores
    By Jules in forum C Programming
    Replies: 4
    Last Post: 01-18-2004, 01:58 PM
  5. Semaphores
    By edk in forum C++ Programming
    Replies: 1
    Last Post: 11-25-2001, 03:55 PM