Question: implement this initialization in java This is a simulation of Round Robin (RR) CPU scheduling algorithm and the system queues: Given the following declarations: struct

implement this initialization in java

This is a simulation of Round Robin (RR) CPU scheduling algorithm and the system queues:

Given the following declarations:

struct PCB

{ int proc-id;

int PC; // Program Counter (Instruction Pointer IP)

int CPU-Bust;

int R1 , R2; // Two dummy Registers

};

PCB readyQ[8];

PCB jobQ[9];

PCB ioQ[17];

int jobqF , jobqR; // Front & Rear pointers of job queue

int ioqF , ioqR; // Front & Rear pointers of the i/o queue

int nrQ; // Number of processes in the ready queue

int reg1 , reg2;

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 ioQ 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 117 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.

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!