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

    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.


    Thanks,
    GICP89

  2. #2
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,654
    Blog Entries
    7
    Rep Power
    21

    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,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

Similar Threads

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