Реализация стратегии диспетчеризации SJF
Курсовой проект - Компьютеры, программирование
Другие курсовые по предмету Компьютеры, программирование
\nEnter Burst Time For Process No.%d:, i);(%d,&time);(&p, i, time);(Any More Process (Y/N)?);= getche();++;
}();();(\nThe Order Of Execution Of Process For SJF Algorithm Will be: -);(p, 1);();(\nThe Waiting Time Of Process For SJF Algorithm Will be: -);(p, 2);();(&p);();
}append (struct node **q, int i, int time)
{struct node *r,*temp = *q;= (struct node *) malloc (sizeof(struct node));>process_no = i;>btime = time;
/* If list is empty or new data to be inserted b4 the first node */(*q==NULL || (*q)->btime > time)
{*q = r;
(*q)->link = temp;
}
{/* traverse the entire linked listsearch the position the new node to be inserted */(temp!= NULL)
{if (temp->btime link ==NULL))
{r->link = temp->link;>link = r;>link = NULL;
}= temp->link;
}
}
}display (struct node *q, int kk)
{struct node *temp;wtime, avg=0, total = 0, count=0;= q;i;(\n);(\n\t\t % c, 218);(i=1; i<33; i++)
{if (i==17)(%c, 194);(%c, 196);
}(%c, 191);(kk==1)
{printf (\n\t\t % c PROCESS NO. %c BURST TIME %c\n, 179,179,179);
}(kk==2)
{printf (\n\t\t % c PROCESS NO. %c WAIT TIME %c\n, 179,179,179);
}(\t\t % c, 195);(i=1; i<33; i++)
{if (i==17)(%c, 197);(%c, 196);
}(%c, 180);(temp!=NULL)
{count++;(kk==1)
{printf (\n\t\t % c %d. %c %c, 179, temp->process_no, 179, temp->btime, 179);
}(kk==2)
{if (temp ==q) /* First Process In The Ready Queue */
{wtime = 0;+= temp->btime;+=wtime;
}
{wtime = total;+= temp->btime;+=wtime;
}(\n\t\t % c %d. %c %c, 179, temp->process_no, 179, wtime, 179);
}=temp->link;
}(\n\t\t % c, 192);(i=1; i<33; i++)
{if (i==17)(%c, 193);(%c, 196);
}(%c, 217);(kk==2)
{printf (\nThe Average Waiting Time (%d % c % d) =%.2f, avg, 246, count, float (avg/float(count)));
}
}chart (struct node **q)
{(\n);(\nThe Glant Chart Is As Follows:-\n);node *temp,*temp1,*temp2,*temp3,*temp4;= *q; temp1 = *q; temp2 = *q; temp3 = *q; temp4=*q;sum = 0; float sfactor;(temp4!=NULL)
{sum+=temp4->btime;= temp4->link;
}(sum<80)
{sfactor = 1.0;
}
{sfactor = (sum % 80)/float(sum);
}i, k=0;(%d, k);(temp3!= NULL)
{if((sfactor*temp3->btime) == 0)
{goto harsh;
}(i=-1; ibtime); i++)
{printf();
}+=temp3->btime;(%d, k);:=temp3->link;
}(\n);(temp!=NULL)
{if (temp == *q)
{(%c % c, 218,196);((sfactor*temp->btime) == 0)
{goto last;
}(i=-1; ibtime); i++)
{printf (%c, 196);
}(temp->link!= NULL)
{printf (%c, 194);
}
{printf (%c, 191);
}
}
{if((sfactor*temp->btime) == 0)
{goto last;
}(i=-1; ibtime); i++)
{printf (%c, 196);
}(temp->link!= NULL)
{printf (%c, 194);
}
{printf (%c, 191);
}
}:= temp->link;
}(\n);(%c, 179);(temp1!= NULL)
{if((sfactor*temp1->btime) == 0)
{goto last1;
}(i=0; ibtime); i++)
{if (i==int (sfactor*temp1->btime)/2)
{printf (P % d, temp1->process_no);
}();
}(%c, 179);:= temp1->link;
}(\n);(temp2!=NULL)
{if (temp2 == *q)
{printf (%c % c, 192,196);((sfactor*temp2->btime) == 0)
{goto last2;
}(i=-1; ibtime); i++)
{printf (%c, 196);
}(temp2->link!= NULL)
{printf (%c, 193);
}
{printf (%c, 217);
}
}
{if((sfactor*temp2->btime) == 0)
{goto last2;
}(i=-1; ibtime); i++)
{printf (%c, 196);
}(temp2->link!= NULL)
{printf (%c, 193);
}
{printf (%c, 217);
}
}:=temp2->link;
}
}