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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 08:40, baue4431
What are the three parts to physical security standards for various types of army equipment and the risk level
Answers: 2
image
Computers and Technology, 23.06.2019 01:30, shelley3135
For a typical middle-income family, what is the estimated cost of raising a child to the age of 18? $145,500 $245,340 $304,340 $455,500
Answers: 2
image
Computers and Technology, 23.06.2019 02:00, vivian2020
Read this excerpt from helen keller’s autobiography, the story of my life. have you ever been at sea in a dense fog, when it seemed as if a tangible white darkness shut you in, and the great ship, tense and anxious, groped her way toward the shore with plummet and sounding-line, and you waited with beating heart for something to happen? i was like that ship before my education began, only i was without compass or sounding-line, and had no way of knowing how near the harbour was. "light! give me light! " was the wordless cry of my soul, and the light of love shone on me in that very hour. . the morning after my teacher came she led me into her room and gave me a doll. the little blind children at the perkins institution had sent it and laura bridgman had dressed it; but i did not know this until afterward. when i had played with it a little while, miss sullivan slowly spelled into my hand the word "d-o-l-l." i was at once interested in this finger play and tried to imitate it. when i finally succeeded in making the letters correctly i was flushed with childish pleasure and pride. running downstairs to my mother i held up my hand and made the letters for doll. i did not know that i was spelling a word or even that words existed; i was simply making my fingers go in monkey-like imitation. in the days that followed i learned to spell in this uncomprehending way a great many words, among them pin, hat, cup and a few verbs like sit, stand and walk. based on this excerpt, which words best describe helen keller?
Answers: 2
image
Computers and Technology, 23.06.2019 03:10, kyleereeves2007
Acomputer has a two-level cache. suppose that 60% of the memory references hit on the first level cache, 35% hit on the second level, and 5% miss. the access times are 5 nsec, 15 nsec, and 60 nsec, respectively, where the times for the level 2 cache and memory start counting at the moment it is known that they are needed (e. g., a level 2 cache access does not even start until the level 1 cache miss occurs). what is the average access time?
Answers: 1
You know the right answer?
Suppose you are given the following data structure, variables and several functions to manage the li...

Questions in other subjects: