Question: please code in language java or c The solution is by writing the code struct PCB { int proc-id; int PC; int CPU-Bust; int R1,

 please code in language java or c The solution is by

writing the code struct PCB { int proc-id; int PC; int CPU-Bust;

please code in language java or c

The solution is by writing the code

struct PCB { int proc-id; int PC; int CPU-Bust; int R1, R2, // Program Counter (Instruction Pointer IP) // Two dummy Registers PCB readyQ[8]; PCB jobQ[91; PCB ioQ[17); int jobqF, jobqR; int ioqF, ioqR; int nrQ; int regl , reg2; // Front & Rear pointers of job queue // Front & Rear pointers of the i/o queue // Number of processes in the ready queue The main function may look like: void main() { initialize: processor: (A) In initialize function Create 8 processes in the readyQ. Create 9 processes in the jobQ. The ioQ is initially empty. The jobQ and io queues, each has two pointers to the Front & Rear, the processes are added to the Rear of the queue and removed from the Front. You may use any data structure you want in the queue implementation, but I suggest to use the idea of circular array concept for jobQ and ioQ, for the readyQ use a normal array since processes are serviced sequentially using RR scheduling algorithm. Set program counter PC to 100 in all processes. Give a number 1...17 to process-id number. Set CPU-Burst(service time) to a value between 0-100 using random function. R1 & R2 are just dummy registers, set them to 0. (B) In processor function. It must contain a repeat for ever loop. Consider a quantum time, Q=20 units of time. Inside a do .. while statement, consider a switch statement with 10 options which starts with PC=100,200,...1000. The process changes PC each time it executes one of the switch statement options (choices). In one of the switch choices use a random function. Let the process wait on the ioQ for 10 on a certain value of the random function. In one of the switch choices , do a service for one of the processes in the ioQ and swap it into the readyQ. Each time the process enters the do .. while loop, the process CPU-time in decremented by 1, except if an I/O service is being done, that is, the process is waiting in the ioQ. When the process finishes execution, the process is moved or swapped out from the readyQ to the jobQ initializing its PCB fields to new values and another process is brought (swapped in) from the jobQ. When a process needs I/O, it is moved to the ioQ to be serviced. Change the contents of the registers as you like using a random function. These registers must be saved and reloaded when needed. e (C) What is the output?? Some messages: 1. A message showing which process starts execution in case choice (100), showing the total CPU burst time 2. which process is swapped out to the jobQ and to io Q queue, and which is swapped in the readyQ 3. Which process is being serviced in the ioQ. 4. Which process has finished execution and moved to the jobQ showing its new PCB values. Notes Use any additional data structure you may need. You may program your project using C or JAVA only struct PCB { int proc-id; int PC; int CPU-Bust; int R1, R2, // Program Counter (Instruction Pointer IP) // Two dummy Registers PCB readyQ[8]; PCB jobQ[91; PCB ioQ[17); int jobqF, jobqR; int ioqF, ioqR; int nrQ; int regl , reg2; // Front & Rear pointers of job queue // Front & Rear pointers of the i/o queue // Number of processes in the ready queue The main function may look like: void main() { initialize: processor: (A) In initialize function Create 8 processes in the readyQ. Create 9 processes in the jobQ. The ioQ is initially empty. The jobQ and io queues, each has two pointers to the Front & Rear, the processes are added to the Rear of the queue and removed from the Front. You may use any data structure you want in the queue implementation, but I suggest to use the idea of circular array concept for jobQ and ioQ, for the readyQ use a normal array since processes are serviced sequentially using RR scheduling algorithm. Set program counter PC to 100 in all processes. Give a number 1...17 to process-id number. Set CPU-Burst(service time) to a value between 0-100 using random function. R1 & R2 are just dummy registers, set them to 0. (B) In processor function. It must contain a repeat for ever loop. Consider a quantum time, Q=20 units of time. Inside a do .. while statement, consider a switch statement with 10 options which starts with PC=100,200,...1000. The process changes PC each time it executes one of the switch statement options (choices). In one of the switch choices use a random function. Let the process wait on the ioQ for 10 on a certain value of the random function. In one of the switch choices , do a service for one of the processes in the ioQ and swap it into the readyQ. Each time the process enters the do .. while loop, the process CPU-time in decremented by 1, except if an I/O service is being done, that is, the process is waiting in the ioQ. When the process finishes execution, the process is moved or swapped out from the readyQ to the jobQ initializing its PCB fields to new values and another process is brought (swapped in) from the jobQ. When a process needs I/O, it is moved to the ioQ to be serviced. Change the contents of the registers as you like using a random function. These registers must be saved and reloaded when needed. e (C) What is the output?? Some messages: 1. A message showing which process starts execution in case choice (100), showing the total CPU burst time 2. which process is swapped out to the jobQ and to io Q queue, and which is swapped in the readyQ 3. Which process is being serviced in the ioQ. 4. Which process has finished execution and moved to the jobQ showing its new PCB values. Notes Use any additional data structure you may need. You may program your project using C or JAVA only

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!