Results 1 to 2 of 2
  1. #1
    gicp89 is offline Member
    Join Date
    Feb 2011
    Rep Power

    Default Help with Threads

    I have to do this program. and i am having trouble managing threads and semaphores. if someone could point me in the right direction that would great!

    You must simulate a factory that produces tables, chairs and cabinets. The fabrication each needs three elements in the following proportion:
    Nails Wood Formica
    Tables 7 4 9
    Chairs 3 6 1
    Cabinets 5 8 2

    The company buys raw material for individual orders. The creation of new products must follow the ration 1:4:3, i.e. production priorities are 4 chairs, 3 cabinets for each table you create.
    The factory receives an order for each of its products, does not meet the above ratio it does not matter. The excess is stored as stock products for the next order.
    By way of work, storage prior stock orders will be entered at the keyboard before the simulation. You must show the quantity produced of each product and remaining stock.
    You must use threads to simulate the processes of purchasing and production.


  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Voorschoten, the Netherlands
    Blog Entries
    Rep Power

    Default Re: Help with Threads

    The nails, wood and formica are the shared resouces; the tables, chairs and cabinets are the consumers, i.e. they consume nails, wood and formica. If there isn't enough stock, each consumer just waits until there is. There has to be a stock 'filler' that fills up the amount of nails, wood and formica (the shared resources) and it notifies the waiting consumers. This 'refiller' is the producer.

    kind regards,

    Build a wall around Donald Trump; I'll pay for it.

Similar Threads

  1. How to use two threads
    By rajan701v in forum Threads and Synchronization
    Replies: 2
    Last Post: 07-22-2011, 06:47 PM
  2. Threads
    By nsr2008.mca in forum New To Java
    Replies: 7
    Last Post: 10-18-2010, 12:47 PM
  3. Threads!
    By rameshraj in forum Advanced Java
    Replies: 1
    Last Post: 05-04-2008, 05:11 PM
  4. Using threads
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 12-11-2007, 11:25 AM
  5. Threads
    By one198 in forum Threads and Synchronization
    Replies: 1
    Last Post: 11-20-2007, 07:15 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts