Answered You can buy a ready-made answer or pick a professional tutor to order an original one.
Implementation of source code for different types of Algorithms in the Advanced Operating System. List of algorithms are( FCFS, SJF, PRIORITY SCHEDULING, ROUND-ROBIN, PRIORITY WITH ROUND-ROBIN)
Implementation of source code for different types of Algorithms in the Advanced Operating System. List of algorithms are( FCFS, SJF, PRIORITY SCHEDULING, ROUND-ROBIN, PRIORITY WITH ROUND-ROBIN)
- @
- 311 orders completed
- ANSWER
-
Tutor has posted answer for $80.00. See answer's preview
************** ** ****** code *** ******* Scheduling ********** ** ** ********* ******************* <stdioh>#include "jobh"// run **** *** *** *** ********* **** ********* ******* **** *** ****** {printf("Running *** = **** [%d] [%d] *** %d ******************** **************** ************* ************************* <stdioh>#include *********************** *********************** "jobh"#include "listh"#include "schedulersh"#define **** ****** ******** **** **** ************* ******** *temp;char ************** *name;int priority;int ******** * *********************** ***************** ** ***** ***** * ************ ** ******* * ******* ** ****** = strsep(&temp"");priority * ******************************* * **************************** *** *** job to *** *********** **** of **** *********************** free(temp);}fclose(in);// invoke *** ************************** ***************** <stdlibh>#include ********************** *********************** *************** ******** add * *** *** ** the **** ** ******** ************* node **head *** *newJob) {// add *** *** job to *** ********** **** ******** = ******************** ********************** = *********************** * *********** * newNode;}// delete the ******** job **** *** ******** ************* node ****** Job ***** ******* **** ************ **** ********** * ******** ******* **** * ********* of ****** ****************************************** ** ** {*head * ********************** *** ******** or **** ******* in *** ******** * ********** * temp->next;while ****************************************** != 0) ***** * ********* * **************************** * ****************** **** through *** listvoid **** ************** **** ****** ******* **** ********** * ********** ***** ** ***** {printf("[%s] [%d] [%d]\n"temp->job->name ************************* temp->job->burst);temp = ********************************************************** <stdlibh>#include ********************** *********************** ************** "listh"#include "schedulersh"#include ************ node ***** * NULL;struct node *last * NULL;struct **** *new * ******** *** = ****** add(char *name *** ******** *** burst) *** (head ** NULL) {head * ******************** ****** ***** = ******************** ****** ;// *** the **** ** *** *************** = ******************** job));head->job->name * *************************** * ******************************* * *********** set the **** **** to be ***************** * NULL;last = ********** **** * ******************** ******************** * *** ************ * ******************** job));new->job->name * ************************** * burst;new->job->priority * ********************* * NULL;last = new;}}// invoke the ************* ********** **** ***** = ******* ************** = ******* ******** * ******* ************ = ******** **** * ref = ********** **** ****** ) {num = *** ********************************************** * ***** + ********************** ** * ** **************** * turnaroundtime * ***** * *** ********** ** ** * **** + 5+10+15)if ************* ******* ************* * ************ + final;}ref * ********************** * ************** * final;printf("The ******* turnaround **** ** * ** time ***** *** ******************************* average ************ ** * ** time units *** ***************************** average ******** ** * ** **** units\n * ***************** *************************** <stdlibh>#include <stdioh>#include *********************** ************** "listh"#include ********************* "cpuh"struct **** * **** * *********** **** * ******* * NULL;struct **** * new * *********** node * final = ********* ******** * **** int priority int burst) {if ***** == ***** ***** * ******************** node));// *** the **** ** *** jobhead ***** *** * ******************** ********** ***** *** ***** **** = name;head ***** *** ***** burst = burst;head ***** *** ***** ******** * *********** *** *** next **** ** be nullhead -> **** * ************ = head;} **** **** * ******************** node));new -> *** * ******************** ********* ***** *** ***** burst = burst;new ***** job -> **** = name;new -> job ***** priority * *********** if current->next ** NULLif (!(current ***** ****** *** (((new ***** *** ***** ********* **** ******** ***** job -> priority)) ** ((new ***** job ***** priority) ********** -> *** -> *********** ******** -> next = new; // head ****** to second ******* ***** next = ***** * ** ** *** ****** **** burst ** smaller than *** ******* ***** **** * ** *** *** to ***** to head which ** ** the second ******** ************ * ******** ** head *** holds *** address ** *** ***** ** ** *** ***** ******** **** * **** ** reset ******* to ********** * new; ** we ***** have *** ****** node ********* ** ***** * ** ** *** on execute **** here * ***** **** { ******** * if ((new ***** *** ***** ******** **** ******* ***** next ***** job ***** priority) * * ** ************************* **** current->job->priority) * ************ = ***************** current->next * *** * ******* * head; break; * **** if (new->job->priority **** ***************************** * **** = **************** = current; ******* * ***** ****** * ** ** the *** ******** == *** ******* priority **** *************************** == ***************************** * ************ * ********************************* = ********** * * **** if **** ***** job ***** ******** ** ******* ***** **** ***** *** ***** priority) * current * ******* ***** **** * ** ***************** ** ***** {new->next * ***** * else ** (new-> job-> priority ** current->next->job->priority) { ******* = ******* -> next * ************ * ***************** * **** * ************ * ***************** * **************** * **** ******* = ***** break; * // ** *** *** ******** is less **** the current ******** **** ** ((new ***** *** ***** priority) ************ ***** next ***** *** ***** ********** * ******* * current -> ***** ** * **************** ** ***** { ******************** **************** * **** new->next = ***** ******* * head; ****** } * ****** invoke *** ************* schedule() **** *** = ******* ************ = ******* turnaroundtime = ******* ******** = ***** ***** * 0;struct **** * *** = ********** (ref ** ***** **** = num + ********* -> job *** -> *** ***** burst);burst = ***** + ********************** ************** * turnaroundtime * ***** ; *** (5+10+5)20 ** ** * **** * ******** if (ref->next ******* * ************ = ************ * ****** **** * ref -> next;}WaitTime * turnaroundtime * burst;printf("The average ********** **** is * ** time units \n" ************************************** ******* ResponseTime is : ** **** units *** ************************************ ******* ******** ** * ** time ******* " ******************************************************************** *********************** ********************** <stringh>#include ************** *************** "schedulersh"#include "cpuh"struct **** ***** = NULL;struct **** ***** = *********** **** **** * *********** **** * ******* * ********* ******** ***** *** priority *** burst) *** ***** ** ***** {head * ******************** ********* *** *** **** ** *** ******* -> job * ******************** ********** ***** *** -> **** = name;head ***** *** -> ***** * ********** ***** job ***** priority * priority;// *** the **** **** ** ** ******** ***** **** * NULL;current = ****** **** {new = malloc(sizeof(struct ********** ***** *** * ******************** ********* ***** *** ***** burst = ********* -> *** ***** **** * name;new ***** *** ***** priority * priority;// ** **************** ** ****** ********** -> next)) *** ****** -> *** ***** ********* **** ******** -> *** ***** ********** ** ***** -> *** -> priority) ==(current ***** *** ***** priority))) {current -> next = **** ** **** ****** ** ****** ******* ***** **** * ***** * ** if *** second **** burst ** ******* than the current burst **** * // *** new to point to head which ** ** *** ****** ******** ************ * ******** ** **** now ***** the ******* ** new which ** ** *** ***** ******** **** = **** // ***** ******* ** ********** * **** ** ** ***** **** *** second **** connected to ***** } ** ** and ** ******* **** **** * ***** else * ******** *** ((new ***** *** ***** ******** **** ******* ***** **** ***** *** ***** ********* * { ** ************************* **** ***************************** * new->next = current->next; **************** * new * current * ***** break; * **** ** ************************* **** ***************************** { **** = new;new->next * ******** ******* = ***** ****** } ** ** *** *** ******** ** *** ******* priority else if(new->job->priority ** ***************************** { ************ = ********************************* * ********** * * **** ** **** ***** job -> ******** ** ******* ***** next -> *** ***** ********* * current * ******* -> **** ; ** ***************** ** NULL) ************* * ***** * **** if ********* job-> priority ** ************************************** * ******* = current ***** **** ; new->next * ***************** } else * ************ * ***************** } **************** * **** ******* * ***** ****** * // ** *** *** ******** is **** than *** current ******** **** ** ((new ***** job -> ********* ************ ***** next -> job -> ********** * current * ******* ***** ***** ** * **************** == NULL) * ******************** **************** * **** ************ * ***** ******* * ***** ****** ** ****** ****** *** ************* ********** ******** * *********** node * *** * *********** node ********** = ******************** ********** ******** * ******* (ref ******* {// ref->next * * ***** ** *** second ****** ************* ******* **************** ref->job->burst);break;}else *** ************************ = ***** 3// ********************************* = ****** *** ((ref->job->priority != *********************************** ****************************************** * ************* ** *** * ***** 3}else *** ************* !=NULL) *** first * * second * ********** ************************** == *********************************** {// set current ** ***** ** *** * location ** first ********* * ref ;// **************** ** 3while (current->next ** NULL) ******** * ***************** ** current ** third 3// the *** * ******** ** the *** 3 *********** (current->job->priority != ************************************** ********** * ***************** ** *** *** beginningcurrent->next * ************ * ref; ** move ******* back to ref ** ** *** ** ***** **************** {//current * ***************** ** current * *** * *************** (ref ****** * *** (ref->job->burst >= *** {newburst * ************************* ** set ******** to ********************** * 10;run(ref->job10);}else ** (ref-> job-> ***** < *** ********* = ************************************************* *** ***************** ******* {current * current->next; ** ******* ****** ** newT3if (current->next == ***** * //if ********* ** ** ******* **** * newnode * malloc(sizeof(struct node));newnode->job * ******************** ****************************** = ******************** ************************** = ************************************* * **************************** = ************ ***************** * ************************ * ************ * *************** if ********* == ** **** * ref->next; ** *** points ** new ********* * ref; // ******* ****** ** *** *************** * // ** **** ** *** **** ********** = ************* // *** ** **** after thiscurrent * ********************** * beginning;}}}}}}//round_robin_ ****************** *********************** ********************** *********************** ************** "listh"#include "schedulersh"#include ************ **** ***** * NULL;struct **** ***** * *********** **** **** * *********** **** ***** = NULL;int *** * 0;void ******** ***** *** priority *** ****** **** * num * **** ***** == ***** ***** * ******************** ****** ;last = ******************** ****** ;// *** *** name of the jobhead->job = ******************** *************************** = *************************** * burst;head->job->priority * *********** *** the **** **** to ** ***************** * ********* * ********** **** = ******************** node));last->next * *** ************ = ******************** job));new->job->name = name;new->job->burst * ****************************** * priority;new->next * NULL;last * ******** ****** *** ************* ********** {struct node * ******* * *********** node * *** * head;struct node * ******* = ************ * malloc(sizeof ( struct ***** ********* * ******** ******** = 0;int ******** * ******* ************** * ******* ************ = ******* ******** * ***** ***** = 1;while **** ****** * *** ********************** ***** *** ********* * ************************* ** *** ******** ** 10if *************** ************************ *** ******************************** ************************* ** ** ****** * **************** = monitor->next;}monitor = head;}if ********************** >10 ********** ********** {if (ref->next ******* { ** ****** ** 1){ResponseTime * ResponseTime * ********* ***** ********************** **** * {if ****** ***************** * ************ * totburst;}}totburst * ******** + *** // ******** ** 60if ********************** ***** {turnaroundtime = ******** * *************** ** ************** * 60}ref->job->burst * *************************** ** ********* job-> ***** < ** * ********* = 0;if ****** ==1) ************* * ************ + ****************** * ******** * ************************************ = ************** * totburst ;run(ref->jobref->job->burst);}while(1) {if ***************** !=NULL) ******** * current->next; ** current = ***** ***************** ** NULL) *** ********* != ** ******* **** * ******* * ******************** node));newnode->job * ******************** job));newnode->job->name * ******************** ************************** * ************************************* = **************************** * ref->next * // ref ****** ** ****************** * ******** // P4 points ** *** **** P1newnode->next = NULL; ** P4 ****** to *********** * ref; ** ******* ****** ** ************* if ********* ** ** **** * ref->next; ** *** points ** T3current * ref; ** current ****** ** T3break;}} }else * ** ** this ** the **** ********* ********* **** ******* **** * new = ******************** ****************** = ******************** ************************** * ******************** ************************* * ref->job->priority;new->job->burst * ********************* = new;ref = ************************* = ************ * new;}else **** * ********************** ********* = ************** * ******************** ******* ********** **** is * %f time units \n" ******************** *********** ******* ******** time ** * ** time ***** *** ResponseTime/num);printf("The average **** **** is : ** **** ***** *** WaitTime/num);}//shortest_job_first_scheduling#include *********************** <stdioh>#include *********************** ************** "listh"#include ********************* ************ **** * **** * *********** **** * ******* * *********** **** * *** * *********** **** * ***** * NULL;int *** * 0;void ******** * name *** priority *** ****** {if ***** == NULL) ***** = ******************** ********* *** *** name of *** jobhead ***** job * ******************** ********** ***** *** ***** **** * ********* ***** *** ***** ***** * burst;head ***** *** ***** ******** * priority;// *** *** **** **** ** ** nullhead -> **** = NULL;current = ****** **** **** * malloc(sizeof(struct node));new ***** *** * ******************** job));new ***** *** ***** burst * ********* ***** *** ***** **** = ******** ***** job ***** ******** = priority;// ** **************** ** ****** ********** ***** ****** *** (((new ***** *** ***** ****** > ******** ***** *** ***** ******* || ***** ***** job ***** ****** ********** -> *** -> burst))) ******** ***** **** * **** // **** points ** ****** ******* ***** next * ***** * // if *** ****** **** ***** ** ******* **** *** ******* ***** **** { ** *** *** to ***** ** head ***** is in *** ****** ******** ************ * current; // head *** holds *** ******* ** *** which ** ** *** ***** ******** **** * **** ** ***** ******* ** ********** = **** ** ** ***** **** *** second node ********* ** null} * ** T3 *** ** execute **** here I ***** **** * while(1) { ** ***** -> *** ***** ***** **** ******* ***** **** ***** *** ***** burst) * * ** ********************** **** current->job->burst) * new->next * ***************** **************** * *** ; ******* = ***** // ** * **** this ****** * **** if ********************** **** ************************** { **** * **************** * current; ******* * ***** ****** ** **** if (new ***** job -> ***** == ******* -> **** ***** *** -> ****** * ******* * ******* -> **** * ** ***************** ** NULL) ************* * NULL; * **** if (new-> job-> ***** == current->next->job->burst) * current = ******* ***** **** * new->next * ***************** * **** { ************ * ***************** * current->next * **** ******* * ***** ****** * ** if the new ***** ** ******* **** *** ******* ***** **** ** ((new -> job ***** ****** **** ******** ***** **** ***** *** ***** ******* { ******* * current ***** ***** ** * current->next ** ***** * //printf("testing"); **************** = **** ************ * ***** ******* = ***** ******** ****** ****** the ************* schedule() ****** ************** * ******* ************ * ******* ******** = 0;int burst * ******** node * *** * ********** **** ** ***** * *** * num + ********* ***** *** *** ***** *** ***** ************ = ***** + ********************** turnaroundtime * ************** * ***** ; //5 (5+10+5)20 ** (5 * **** * 5+10+15) if ************* ******* { ************ * ************ * ****** * *** * *** ***** next;}WaitTime * turnaroundtime * ***************** ******* ********** **** ** * ** **** units *** ********************************* ******* ************ is * ** **** ***** *** ******************************* ******* ******** ** * ** time ******* * *****************