This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: CSC209 ASSIGNMENT 3 Due at 7.00p.m. on July 22nd Question 1 20 points In this question we will test your knowledge of pipes in a simple warehouse- delivery scenario. The problem is as follows, you are the manager of a warehouse. Everyday trucks come to either pick-up or deliver products to your warehouse. You can choose how many trucks come per day but you may not choose the type and quantity of products each truck will deliver or pick-up. The main program is the warehouse program (it should be called warehouse). It takes two arguments. One, the size of the warehouse. Two, the number of trucks that will show up at the warehouse during the current instantiation of the program. You may assume that the two arguments are given on the command line as integers in the aforementioned order. You may assume that the warehouse will be empty upon starting up and that each single product takes up the same amount of space (i.e., the size of the warehouse is the quantity of all products it can store). Furthermore, upon exiting the warehouse should print out the total number of units of product that it is storing. The syntax of this message should be: warehouse: X unit in The main program should create one child process for each truck. The main program should pass an identifier, truckID, to each child. A truckID is an integer. For simplicity we will assume the first truckID is 1 and subsequent truck ids go up by 1 so the first child will have truckID 1, the second truckID 2 and so on). Finally, the main program should have opened two pipes with the child (on for reading and one for writing).child (on for reading and one for writing)....
View Full Document
- Spring '10