Computers and Technology

Suppose you are given the following data structure, variables and several functions to manage the list of processes in a CPU scheduling algorithm. struct list_item{
struct Proc_Ctrl_Block *PCB;
int cpu_burst; int io_burst;
struct list_item *next;
} struct list_item *head=NULL, *tail=NULL;
Suppose we have several functions that are already implemented to create new list items, associate them with PCBs which we don't consider here, add/insert a given item to the end of the list, which is accessed through global variables: head and tail. Now you are asked to implement the following two Get_... functions!
struct list_item *Get_next_item_FCFS( );
/* remove the first item from the beginning of the list, and returns its address. If there is no item, return NULL */
struct list_item *Get_next_item_SJF( );
/* remove the item that has the shortest cpu_burst time from the list, and returns its address. If there is no item, return NULL. Note that the list is not sorted! */
My code looks like this:
*Get_next_item_FCFS( ){
struct list_item *tmp;
UNSURE WHERE TO GO FROM HERE
*Get_next_item_SJF( ){
struct list_item *tmp, *prev,
*min_i, *prev_i;

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 01:50, rhonda45801
Free points just awnser this. what should i watch on netflix
Answers: 2
image
Computers and Technology, 23.06.2019 13:30, valeriegarcia12
Select the correct answer from each drop-down menu. which types of computer networks are bigger as well as smaller than a man? a man is a network of computers that covers an area bigger than a , but smaller than a .
Answers: 1
image
Computers and Technology, 23.06.2019 16:00, AM28
Does read theory have answers keys ?
Answers: 1
image
Computers and Technology, 24.06.2019 12:30, coursonianp8izbc
Do you think media is stereotype ? and why?
Answers: 1
Do you know the correct answer?
Suppose you are given the following data structure, variables and several functions to manage the li...

Questions in other subjects:

Konu
Mathematics, 13.04.2021 23:20