Part 1 Multiple Processes: Implementation [60 Marks]
The aim of this exercise is to produce a simple simulation of a printer queue within a UNIX environment using the MAC computers as currently installed in K111.
The simulation will consist of two main communicating processes, a producer and a consumer.
This process will be required to run to create a series of child processes that will represent each of the printer jobs. The PID number of each child is to be inserted / spooled within a priority queue.
The queue will be made available to the second process to allow de-spooling.
The process should be configurable using command line arguments such that the size of the queue and the maximum number of jobs to be created during each cycle can be specified.
It should perform the following functionality
Create a number of print jobs.
Assign a priority value to each.
Insert their details into a suitable data structure.
This process will be separate from the first and running within a separate console window and will simulate the de-spooling process.
The process should be configurable using command line arguments such that the maximum number of jobs to be deleted during each cycle can be specified.
It should perform the following functions:
Find and delete a number of printer jobs by priority order.
Print a message to notify the user of the deletion.
Kill the corresponding process.
Remove the processs details from the data structure.
It will be necessary to develop a communication mechanism to transfer data between the two main processes.
The two main processes should both run continuously taking turns to generate and delete jobs. Once both of the main processes have been started, user intervention should be avoided other than to terminate the two main processes.
It should be possible to configure the maximum number of jobs allowed within the whole system.
It should also be possible to configure the consumer and / or the producer to specify how many jobs they will de-spool or spool during each cycle.
You should also include a very brief set of user instructions that will allow an assessor to run your code in your absence.
For practical purposes, the print jobs (each being a separate child process of the producer process) should perform little or no real processing e.g. enter a while loop that contains very little code.