Suppose all the jobs that enter a computer system can be classified as CLASS A (0-50K), CLASS B (51-100K), or CLASS C (more than 100K), according to the maximum memory requirement (MAXCORE) you decide for your system. The system provides a multiprogramming environment with three FIXED SIZE PARTITIONS. Partition A is for Class A jobs, Partition B is for CLASS A or CLASS B jobs, and Partition C is for CLASS A, B, or C jobs. When Partition A becomes free, the CLASS A job that has waited longest is run. When Partition B becomes free, the CLASS B job that has waited longest is run. If there are no CLASS B jobs waiting, the next CLASS A job is run.
Following:
Generate a random number I. (Please write the program so that a different SEED may be entered to generate a different sequence of random numbers if desired. The value of I should be an integer between 0 and 200.
CASE 1: i.1 1.2 1.3
0 <= I <= 49: A job has entered the system
0 <= I <= 25: Class A job enters Queue A
26 <= I <= 39: Class B job enters Queue B
40 <= I <= 49: Class C job enters Queue C.
CASE 2: 2.1 2.2 2.3
50 <= I <= 100: Job has finished execution.
0 <= I <= 75: Partition A is now empty
76 <= I <= 89: Partition B is now empty
90 <= I <= 100: Partition C is now empty
The three queues should be implemented as linked structures. If a partition becomes empty and there is no job that can be run in it, generate the next random number and continue. Repeat for 100 iterations and at every fifth iteration, print the following information:
a) Current state of each queue
b) Current state of each partition
c) How many jobs of each class have been run so far.