subject

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;

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 00:00
Sam is a data analyst at an advertising firm. he often uses a spreadsheet that contains media ratings details. he would like to filter the spreadsheet data based on different filter criteria. which operators can he use to specify the combination of filter criteria? sam can use the ( blank ) operators to specify a combination of filter criteria.
Answers: 3
question
Computers and Technology, 22.06.2019 22:00
What is a distinguishing feature of today’s graphic application software?) graphic applications are used today on a variety of devices, including touch-screen kiosks and mobile phones.
Answers: 3
question
Computers and Technology, 23.06.2019 07:00
What are three software programs for mobile computing?
Answers: 1
question
Computers and Technology, 23.06.2019 21:40
Draw the resistor’s voltage and current phasors at t=15ms. draw the vectors with their tails at the origin. the orientation of your vectors will be graded. the exact length of your vectors will not be graded.
Answers: 2
You know the right answer?
Suppose you are given the following data structure, variables and several functions to manage the li...
Questions
question
Mathematics, 28.07.2020 22:01
Questions on the website: 13722363