Program will simulate multilevel feedback queues of processes.Every process in t
ID: 3609117 • Letter: P
Question
Program will simulate multilevel feedback queues of processes.Every process in this simulation is represented by the followingstructure: 1) process id; 2) process (remaining) lifetime; 3)(pointer to the next element of the queue).
First,program should generate 24 processes. Each process musthave a (randomly generated) lifetime between 1 and 18 time units(as every process must also have an id, the easiest way to createan id is to use the number of the step in a loop running 24 times).The 24 processes should be distributed between three queuesaccording to the following criterion: if the (generated) lifetimeis < 7, then the process is added to the queue Q1 (of thehighest priority), if the lifetime is between 7 and 12, then theprocess is added to the Q2 (of medium priority), and if thelifetime is between 13 and 18, the process is added to the Q3 (ofthe lowest priority).
Now program must start simulating execution of the processes.First it simulates a process from Q1 for 3 times units (the head ofQ1, of course), then a process from Q2 for 2 times units, then aprocess from Q3 for 1 time unit, then it returns to Q1, etc. Theprogram should stop simulation after choosing processes from eachqueue 60 times (60 times - from Q1, 60 times - from Q2, 60 times -from Q3). For each of the queues, the scheduler uses simpleround robin – with the time quantum 3 for Q1, 2 for Q2, and 1for Q3.
Simulating a process for k time units means simply subtracting kfrom the process (current) lifetime.
If the lifetime of a process expires, it must be deleted fromthe corresponding queue, a new process with the lifetime between 1and 18 must be generated and added to the queue Q1, Q2, or Q3,based on its lifetime (the id of new process could be the stepnumber on which it is generated + 24; remember that ids from 0 to23 have already been used).
If the lifetime of a process from Q2 becomes smaller than 7, itmust be moved to Q1. If the lifetime of a process from Q3 becomessmaller than 13, it must be moved to Q2.
Output of the program. On each step of thesimulation, your program must print out id of the process picked torun; remaining lifetime; if the process expires, id and lifetime ofthe new process; if a process is moved to a different queue, thenindicate to which one. See examples below:
Step 15: Process 6 from Q2 is picked to run. Remaining lifetime:5.
Process 6 is moved to Q1.
Step 23: Process 8 from Q1 is picked to run. Remaininglifetime: 0
Process 8 is deleted. Process 47 with lifetime 16 is generatedand
placed into Q3.
Explanation / Answer
Sorry Buddy, I don't now how to write a program in C#Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.