-
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
-
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