Team-FLY |
The exercises in this section expand on the fan structure of Program 3.2 through the development of a simple batch processing facility, called runsim . (Modifications in Section 14.6 lead to a license manager for an application program.) The runsim program takes exactly one command-line argument specifying the maximum number of simultaneous executions. Follow the outline below for implementing runsim . Write a test program called testsim to test the facility. Suggested library functions appear in parentheses.
Write a test program called testsim that takes two command-line arguments: the sleep time and the repeat factor. The repeat factor is the number of times testsim iterates a loop. In the loop, testim sleeps for the specified sleep time and then outputs a message with its process ID to standard error. Use runsim to run multiple copies of the testsim program. Create a test file called testing.data that contains commands to run. For example, the file might contain the following lines. testsim 5 10 testsim 8 10 testsim 4 10 testsim 13 6 testsim 1 12 Run the program by entering a command such as the following. runsim 2 < testing.data |
Team-FLY |