subject

Define a very basic PCB structure:
struct PCB {int ProcId; int ProcPR, int CPUburst; int Reg[8]; int queueEnterClock, waitingTime; /* other info */ struct PCB *next;}

Define a very basic CPU consisting of 8 integer registers: int CPUreg[8] = {0};
Initialize your linked list: struct PCB *Head=NULL; struct PCB *Tail=NULL;
Initialize your other data: int CLOCK=0; int Total_waiting_time=0; int Total_turnaround_time=0; int Total_job=0;
Open the input file
For each input line, read a line consisting of three integers: Process Id, Process Priority, CPU Burst time.
dynamically create a struct PCB pointed by PCB,
save the given data into corresponding fields of PCB,
set all PCB->Reg[8] to the Process ID, set PCB->queueEnterClock and PCB->waitingTime to 0, then
insert this PCB at the end of the link list.
Close input file
Print your name, the name of the scheduling algorithm, and the input file name, as mentioned before.
The above steps will be the same for the next session too
Now implement a FIFO_Scheduling() function and call it to print the order of completed processes.

This function simply removes the PCB from the head of the linked list and performs the followings until the linked list is empty:
Do context-switching:

copy PCB->Reg[8] into CPUreg[8],
suppose some work is done on CPU (e. g, increment each CPUreg by one),
copy CPUreg[8] into PCB->Reg[8]
Data collection for performance metrics
PCB->waitingTime = PCB->waitingTime + CLOCK - PCB->queueEnterClock;
Total_waiting_time = Total_waiting_time + PCB->waitingTime ;
CLOCK = CLOCK + PCB->CPUburst;
Total_turnaround_time = Total_turnaround_time + CLOCK;
Total_job = Total_job + 1;
Free PCB. Since there is no more CPUburst or I/O burst, this process is terminated here! Otherwise, it will be put in a ready or waiting queue.
Finally, print the perfromance metrics mentioned before:
Total_waiting_time / Total_job,
Total_turnaround_time / Total_job,
Total_job / CLOCK

For each input file, copy/paste your screen output into a text file (say output1.txt)
input1.txt:

1 3 5
2 3 7
3 1 6
4 5 4

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 02:00
6. the is particularly susceptible to the effects of alcohol because it receives a large portion of total blood flow and has a high concentration of neurons. a. heart b. pancreas c. brain d. liver
Answers: 2
question
Computers and Technology, 22.06.2019 20:00
Awide variety of “ apps “ are available to customize devices. which category of app does the word processing software fall into?
Answers: 2
question
Computers and Technology, 23.06.2019 21:20
In microsoft word, when you highlight existing text you want to replace, you're in              a.  advanced mode.    b.  automatic mode.    c.  basic mode.    d.  typeover mode
Answers: 1
question
Computers and Technology, 24.06.2019 07:00
Why would a business likely use a java applet - to back up their data files for the business - to create a program that a customer can launch in their web browser - to create music on a powerpoint presentation - to organize files on their company directory
Answers: 3
You know the right answer?
Define a very basic PCB structure:
struct PCB {int ProcId; int ProcPR, int CPUburst; int Reg[...
Questions
question
Mathematics, 15.12.2020 19:20
question
Physics, 15.12.2020 19:20
Questions on the website: 13722367