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 11:00
Which are examples of note-taking tools? check all that recording devices sticky notes digital highlighters paper flags highlighting pens digital displays digital flags
Answers: 1
question
Computers and Technology, 23.06.2019 01:50
Write a program that uses a random number generator to generate a two digit positive integer and allows the user to perform one or more of the following operations: a. double the number. b. reverse the digits of the number. c. raise the number to the power of 2, 3, or 4. d. sum the digits of the number. e. if the number is a two-digit number, then raise the first digit to the power of the second digit. f. if the number is a three-digit number and the last digit is less than or equal to 4, then raise the first two digits to the power of the last digit. after performing an operation if the number is less than 10, add 10 to the number. also, after each operation determine if the number is prime. each successive operation should be performed on the number generated by the last operation. your program should not contain any global variables and each of these operations must be implemented by a separate function. also, your program should be menu driven. 7. (fraction calculator) write a program that
Answers: 1
question
Computers and Technology, 23.06.2019 03:30
How can you repin an image on your pinterest pin board a. click on the "repin" button b. click on the "add pin" button c. click on the "upload a pin" button d. click on the "save pin" button.
Answers: 2
question
Computers and Technology, 23.06.2019 09:30
Write a function called checkfactor that takes two arrays of positive numbers, firstnumberrow and secondnumberrow. checkfactor checks if the first entry in firstnumberrow is divisible by the first entry in secondnumberrow, and performs the same operation on the next array elements until all entries have been checked. all the numbers are positive and the number of entries in the arrays are the same. the function should return the identified divisible numbers in two row arrays named firstdivisible and seconddivisible.restrictions: branches or loops should not be used. the code must use the internal mod and logical functions.hint: the mod function should be used to determine if two numbers are divisible. ex: for num1 and num2 if mod(num1,num2) is 0, then the two numbers are divisible.this is matlab
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, 12.03.2021 22:50
question
Mathematics, 12.03.2021 22:50
question
Mathematics, 12.03.2021 22:50
question
Mathematics, 12.03.2021 22:50
Questions on the website: 13722362