A completed source code for multi-level feedback scheduling should contain high, normal, and low queues, as well as a queue that is to be run when the system is idle. The queues should be rotated to lower priorities once a process has been run, while the idle queue is used when no other process is being run.
#include<stdio.h>
#include"g:\file.cpp"
#define ERROR -1
#define ok 1
int i,h;
int m,a,b,c;
CHANGE(LinkQueue &P,LinkQueue &Q,QueuePtr q){
QueuePtr s;
if(Q.front==Q.rear) return ERROR;
q=Q.front->next;
Q.front->next=q->next;
if(Q.rear==q)Q.rear=Q.front;
s=(QueuePtr)malloc(sizeof (QNode));
if(!s) exit(OVERFLOW);
s->ID=q->ID;s->Hour=q->Hour;s->Minute=q->Minute;s->Alltime=q->Alltime;
s->next=NULL;
P.rear->next=s;
P.rear=s;
free(q);
return OK;
}
DeQueue(LinkQueue &P){
if(P.front==P.rear)
return ERROR;
p=P.front->next;
i=p->ID;h=p->Hour;m=p->Minute;a=p->Alltime;
P.front->next=p->next;
if(P.rear==p)
P.rear=P.front;
free(p);
return OK;
}
change(QueuePtr &p){
int l,n;
l=p->Hour;
n=p->Minute;
n=l*60+n;
return n;
}
int time1,time2,time3,time4,time5,serve;
LinkQueue Q1,Q2,Q3,Q4,Q5;
int input,length;
int PCB[100];
void TIME()
{ int i=0,t;
printf("Please input the first redayqueue's timer(int):\n");
scanf("%d",&t);
time1=t;
time2=2*time1;
time3=2*time2;
time4=2*time3;
time5=2*time4;
printf(" Please input the key '1' to go on!\n\n");
scanf("%d",&input);
if(input==ok)
printf(" The State of the processes Dequeue:\n\n");
printf(" ID nowtime Queue timer server_time left_time\n");
while(Q.front->next!=NULL)
loop: {p=Q.front->next;
CHANGE(Q1,Q,p);
s=Q1.front->next;
b=change(s);
if(s->Alltime-time1<=0) //in the Q1 ,finish
{ b+=s->Alltime;
s->Hour=b/60;
s->Minute=b%60;
scanf("%d",&input);
if(input==ok)
printf(" %d\t%d:%d\tQ1\t%d\t%d\t -\n",s->ID,s->Hour,s->Minute,time1,s->Alltime);
PCB[i]=s->ID;
i++;
DeQueue(Q1);
}
else //don't finish
{ b=b+time1;
s->Hour=b/60;s->Minute=b%60;
s->Alltime-=time1;
scanf("%d",&input);
if(input==ok)
printf(" %d\t%d:%d\tQ1\t%d\t%d\t %d\n",s->ID,s->Hour,s->Minute,time1,time1,s->Alltime);
CHANGE(Q2,Q1,s); //input Q2
while(Q2.front->next!=NULL)
{ s=Q2.front->next;
p=Q.front->next;
if(p!=NULL) //have a new pcb
{ p=Q.front->next;
c=change(p);
if(b>=c) //new pcb arrive
goto loop;
else //new pcb do not arrive
{ if(b+time2-c>0) //arrive when other doing
{ if(b+s->Alltime-c>0) //work is not finish
{ serve=c-b;
s->Alltime=s->Alltime-serve;
scanf("%d",&input);
if(input==ok)
printf(" %d\t%d:%d\tQ2\t%d\t%d\t %d\n",s->ID,p->Hour,p->Minute,time2,serve,s->Alltime);
CHANGE(Q2,Q2,s);
goto loop;
}
else //finish
{ b+=s->Alltime;
s->Hour=b/60;s->Minute=b%60;
scanf("%d",&input);
if(input==ok)
printf(" %d\t%d:%d\tQ2\t%d\t%d\t -\n",s->ID,s->Hour,s->Minute,time2,s->Alltime);
PCB[i]=s->ID;
i++;
DeQueue(Q2);
}
}
else // arrive when finish
{ if(s->Alltime<=time2) //work is finish
{ b+=s->Alltime;
s->Hour=b/60;s->Minute=b%60;
scanf("%d",&input);
if(input==ok)
printf(" %d\t%d:%d\tQ2\t%d\t%d\t -\n",s->ID,s->Hour,s->Minute,time2,s->Alltime);
PCB[i]=s->ID;
i++;
DeQueue(Q2);
}
else //work is not finish
{ b+=time2;
s->Hour=b/60;s->Minute=b%60;
s->Alltime-=time2;
scanf("%d",&input);
if(input==ok)
printf(" %d\t%d:%d\tQ2\t%d\t%d\t %d\n",s->ID,s->Hour,s->Minute,time2,time2,s->Alltime);
CHANGE(Q3,Q2,s);
}//else
}//else
}//else
}//else
else //no new pcb
{ if(s->Alltime-time2<=0) //in the Q2 ,finish
{ b+=s->Alltime;
s->Hour=b/60;s->Minute=b%60;
scanf("%d",&input);
if(input==ok)
printf(" %d\t%d:%d\tQ2\t%d\t%d\t -\n",s->ID,s->Hour,s->Minute,time2,s->Alltime,s->Alltime);
PCB[i]=s->ID;
i++;
DeQueue(Q2);
}
else //don't finish
{ b=b+time2;
s->Hour=b/60;s->Minute=b%60;
s->Alltime-=time2;
scanf("%d",&input);
if(input==ok)
printf(" %d\t%d:%d\tQ2\t%d\t%d\t %d\n",s->ID,s->Hour,s->Minute,time2,time2,s->Alltime);
CHANGE(Q3,Q2,s); //input Q3
}
}
} //while //the whole pcbs of the Q2 are finish
while(Q3.front->next!=NULL)
{ s=Q3.front->next;
p=Q.front->next;
if(p!=NULL) //have a new pcb
{ p=Q.front->next;
c=change(p);
if(b>=c) //new pcb arrive
goto loop;
else //new pcb do not arrive
{ if(b+time3-c>0) //arrive when other doing
{ if(b+s->Alltime-c>0) //work is not finish
{ serve=c-b;
s->Alltime=s->Alltime-serve;
scanf("%d",&input);
if(input==ok)
printf(" %d\t%d:%d\tQ3\t%d\t%d\t %d\n",s->ID,p->Hour,p->Minute,time3,serve,s->Alltime);
CHANGE(Q3,Q3,s);
goto loop;
}
else //finish
{
b+=s->Alltime;
s->Hour=b/60;s->Minute=b%60;
scanf("%d",&input);
if(input==ok)
printf(" %d\t%d:%d\tQ3\t%d\t%d\t -\n",s->ID,s->Hour,s->Minute,time3,s->Alltime);
PCB[i]=s->ID;
i++;
DeQueue(Q3);
}
}
else // arrive when finish
{ if(s->Alltime<=time3) //work is finish
{ b+=s->Alltime;
s->Hour=b/60;s->Minute=b%60;
scanf("%d",&input);
if(input==ok)
printf(" %d\t%d:%d\tQ3\t%d\t%d\t -\n",s->ID,s->Hour,s->Minute,time3,s->Alltime);
PCB[i]=s->ID;
i++;
DeQueue(Q3);
}
else //work is not finish
{ b+=time3;
s->Hour=b/60;s->Minute=b%60;
s->Alltime-=time3;
scanf("%d",&input);
if(input==ok)
printf(" %d\t%d:%d\tQ3\t%d\t%d\t %d\n",s->ID,s->Hour,s->Minute,time3,time3,s->Alltime);
CHANGE(Q4,Q3,s);
}//else
}//else
}//else
}//else
else //no new pcb
{ if(s->Alltime-time3<=0) //in the Q3 ,finish
{ b+=s->Alltime;
s->Hour=b/60;s->Minute=b%60;
scanf("%d",&input);
if(input==ok)
printf(" %d\t%d:%d\tQ3\t%d\t%d\t -\n",s->ID,s->Hour,s->Minute,time3,s->Alltime,s->Alltime);
PCB[i]=s->ID;
i++;
DeQueue(Q3);
}
else //don't finish
{ b=b+time3;
s->Hour=b/60;s->Minute=b%60;
s->Alltime-=time3;
scanf("%d",&input);
if(input==ok)
printf(" %d\t%d:%d\tQ3\t%d\t%d\t %d\n",s->ID,s->Hour,s->Minute,time3,time3,s->Alltime);
CHANGE(Q4,Q3,s); //input Q4
}
}
} //while //the whole pcbs of the Q3 are finish
while(Q4.front->next!=NULL)
{ s=Q4.front->next;
p=Q.front->next;
if(p!=NULL) //have a new pcb
{ p=Q.front->next;
c=change(p);
if(b>=c) //new pcb arrive
goto loop;
else //new pcb do not arrive
{ if(b+time4-c>0) //arrive when other doing
{ if(b+s->Alltime-c>0) //work is not finish
{ serve=c-b;
s->Alltime=s->Alltime-serve;
scanf("%d",&input);
if(input==ok)
printf(" %d\t%d:%d\tQ4\t%d\t%d\t %d\n",s->ID,p->Hour,p->Minute,time4,serve,s->Alltime);
CHANGE(Q4,Q4,s);
goto loop;
}
else //finish
{ b+=s->Alltime;
s->Hour=b/60;s->Minute=b%60;
scanf("%d",&input);
if(input==ok)
printf(" %d\t%d:%d\tQ4\t%d\t%d\t -\n",s->ID,s->Hour,s->Minute,time4,s->Alltime);
PCB[i]=s->ID;
i++;
DeQueue(Q4);
}
}
else // arrive when finish
{ if(s->Alltime<=time4) //work is finish
{ b+=s->Alltime;
s->Hour=b/60;s->Minute=b%60;
scanf("%d",&input);
if(input==ok)
printf(" %d\t%d:%d\tQ4\t%d\t%d\t -\n",s->ID,s->Hour,s->Minute,time4,s->Alltime);
PCB[i]=s->ID;
i++;
DeQueue(Q4);
}
else //work is not finish
{ b+=time4;
s->Hour=b/60;s->Minute=b%60;
s->Alltime-=time4;
scanf("%d",&input);
if(input==ok)
printf(" %d\t%d:%d\tQ4\t%d\t%d\t %d\n",s->ID,s->Hour,s->Minute,time4,time4,s->Alltime);
CHANGE(Q5,Q4,s);
}//else
}//else
}//else
}//else
else //no new pcb
{ if(s->Alltime-time4<=0) //in the Q4 ,finish
{ b+=s->Alltime;
s->Hour=b/60;s->Minute=b%60;
scanf("%d",&input);
if(input==ok)
printf(" %d\t%d:%d\tQ4\t%d\t%d\t -\n",s->ID,s->Hour,s->Minute,time4,s->Alltime,s->Alltime);
PCB[i]=s->ID;
i++;
DeQueue(Q4);
}
else //don't finish
{ b=b+time4;
s->Hour=b/60;s->Minute=b%60;
s->Alltime-=time4;
scanf("%d",&input);
if(input==ok)
printf(" %d\t%d:%d\tQ4\t%d\t%d\t %d\n",s->ID,s->Hour,s->Minute,time4,time4,s->Alltime);
CHANGE(Q5,Q4,s); //input Q5
}
}
} //while //the whole pcbs of the Q4 are finish
while(Q5.front->next!=NULL)
{ s=Q5.front->next;
p=Q.front->next;
if(p!=NULL) //have a new pcb
{ p=Q.front->next;
c=change(p);
if(b>=c) //new pcb arrive
goto loop;
else //new pcb do not arrive
{ if(b+time5-c>0) //arrive when other doing
{ if(b+s->Alltime-c>0) //work is not finish
{ serve=c-b;
s->Alltime=s->Alltime-serve;
scanf("%d",&input);
if(input==ok)
printf(" %d\t%d:%d\tQ5\t%d\t%d\t %d\n",s->ID,p->Hour,p->Minute,time5,serve,s->Alltime);
CHANGE(Q5,Q5,s);
goto loop;
}
else //finish
{ b+=s->Alltime;
s->Hour=b/60;s->Minute=b%60;
scanf("%d",&input);
if(input==ok)
printf(" %d\t%d:%d\tQ5\t%d\t%d\t -\n",s->ID,s->Hour,s->Minute,time5,s->Alltime);
PCB[i]=s->ID;
i++;
DeQueue(Q5);
}
}
else // arrive when finish
{ if(s->Alltime<=time5) //work is finish
{ b+=s->Alltime;
s->Hour=b/60;s->Minute=b%60;
scanf("%d",&input);
if(input==ok)
printf(" %d\t%d:%d\tQ5\t%d\t%d\t -\n",s->ID,s->Hour,s->Minute,time5,s->Alltime);
PCB[i]=s->ID;
i++;
DeQueue(Q5);
}
else //work is not finish
{ b+=time5;
s->Hour=b/60;s->Minute=b%60;
s->Alltime-=time5;
scanf("%d",&input);
if(input==ok)
printf(" %d\t%d:%d\tQ5\t%d\t%d\t %d\n",s->ID,s->Hour,s->Minute,time5,time5,s->Alltime);
CHANGE(Q5,Q5,s);
}//else
}//else
}//else
}//else
else //no new pcb
{ if(s->Alltime-time5<=0) //in the Q5 ,finish
{ b+=s->Alltime;
s->Hour=b/60;s->Minute=b%60;
scanf("%d",&input);
if(input==ok)
printf(" %d\t%d:%d\tQ5\t%d\t%d\t -\n",s->ID,s->Hour,s->Minute,time5,s->Alltime,s->Alltime);
PCB[i]=s->ID;
i++;
DeQueue(Q5);
}
else //don't finish
{ b=b+time5;
s->Hour=b/60;s->Minute=b%60;
s->Alltime-=time5;
scanf("%d",&input);
if(input==ok)
printf(" %d\t%d:%d\tQ5\t%d\t%d\t %d\n",s->ID,s->Hour,s->Minute,time5,time5,s->Alltime);
CHANGE(Q5,Q5,s); //input Q5
}
}
} //while //the whole pcbs of the Q5 are finish
}
}
length=i;
}
void main()
{
printf(" *****************\n");
printf(" Now,begining!\n");
printf(" *****************\n\n");
InitQueue(Q);
file();
InitQueue(Q1);
InitQueue(Q2);
InitQueue(Q3);
InitQueue(Q4);
InitQueue(Q5);
TIME();
scanf("%d",&input);
if(input==ok)
printf("\nThe order of Dequeue processes:");
for(i=0;i<length;i++)
printf("%d ",PCB[i]);
printf("\n");
scanf("%d",&input);
if(input==ok)
printf("\n *****************\n");
printf(" The end!\n");
printf(" *****************\n");
scanf("%d",&input);
if(input==ok)
printf("\nThe order of Dequeue processes:");
}
//------------------------------------------------------------------------
#include<stdio.h>
#include<stdlib.h>
#define SIZE 10
#define OVERFLOW 0
#define OK 1
struct data{
int ID;
int hour;
int minute;
int Alltime;
}data[SIZE];
typedef struct QNode{
int ID;
int Hour;
int Minute;
int Alltime;
struct QNode * next;
}QNode,*QueuePtr;
typedef struct{
QueuePtr front;
QueuePtr rear;
}LinkQueue;
LinkQueue Q;
QueuePtr p,q,s;
int size;
change(int &i){
int l;
int n;
l=data[i].hour;
n=data[i].minute;
n=l*60+n;
return n;
}
void bubble_sort();
EnQueue(LinkQueue &Q,int i);
void file(){
int i=0;
printf("Please input the processes's informations:ID,Hour,Minute,Alltime\n\n");
printf("Attention! ID(number) Hour(0---12) Minute(0---60)\n");
printf("\n If you input the ID=0,you can't input anything!\n\n");
scanf("%d%d%d%d",&data[i].ID,&data[i].hour,&data[i].minute,&data[i].Alltime);
while(data[i].ID!=0)
{ i++;
scanf("%d%d%d%d",&data[i].ID,&data[i].hour,&data[i].minute,&data[i].Alltime);
}
size=i;
bubble_sort();
for(i=0;i<size;i++)
EnQueue(Q,i);
}
void bubble_sort()
{
int swap1,swap2,swap3,swap4;
int i,j;
for(i=size-1;i>0;i--)
for(j=0;j<i;++j)
if(change(j)>change(j+1))
{swap1=data[j].ID;
data[j].ID=data[j+1].ID;
data[j+1].ID=swap1;
swap2=data[j].hour;
data[j].hour=data[j+1].hour;
data[j+1].hour=swap2;
swap3=data[j].minute;
data[j].minute=data[j+1].minute;
data[j+1].minute=swap3;
swap4=data[j].Alltime;
data[j].Alltime=data[j+1].Alltime;
data[j+1].Alltime=swap4;
}
}
LinkQueue InitQueue(LinkQueue &Q){
Q.front=Q.rear=(QueuePtr)malloc(sizeof (QNode));
if(!Q.front)
exit(OVERFLOW);
Q.front->next=NULL;
return Q;
}
EnQueue(LinkQueue &Q,int i){
p=(QueuePtr)malloc(sizeof (QNode));
if(!p)
exit(OVERFLOW);
p->ID=data[i].ID; p->Hour=data[i].hour; p->Minute=data[i].minute; p->Alltime=data[i].Alltime;
p->next=NULL;
Q.rear->next=p;
Q.rear=p;
return OK;
} ...
//BY: SHOAIB AHMAD SIDHU
//CS Department
//QAU
Sorry! - beans are a source of protein but they are not pure protein...
The circuit may not be complete. The power source may not be sufficient. The polarity of the battery is messed up.
you need an electrical supply and a load. nice and simple.
The main source of plastic is Crude Oil
You don't say what source you mean
Feedback is the response from the audience to the source. When the feedback is distorted, it is not an accurate response.
it is the responce from the audience to the source
immediate feedback occurs when the reactions of the receiver are directly perceived by the source .
Feedback
A 360 degree feedback survey is feedback that comes from members of an employee's immediate work circle. It is also called multi-rater feedback and multi source assessment.
The 360-degree feedback survey, also known as multi-rater feedback, multi source feedback, and multi source assessment was first introduced during World War II. This assessment was used by the German Military to evaluate the performance during the war.
Source idea Message Encoding Channel Receiver Decoding Feedback
Patient Feedback forms the direct source to get insights into patient satisfaction.
feedback is the response by the source to determine if the message has been receiver and understood thus after the receiver has decodes and interpreted a message then becomes the sourced also vital part in communication because it enables the original source to evaluate how the receiver has received his.
Intrinsic feedback comes from within the individual, such as the feeling of accomplishment from completing a task. Extrinsic feedback is information provided by an external source, like a teacher or coach, to guide performance or skill development.
meat
Patient feedback comprises the views & opinions of patients/ service users on the care they have experienced from the respective healthcare provider. Four important ways to gather patient feedback? 1. Feedback Forms 2. Audits 3. Comments 4. Complaints Source - Patient feedback is another name to ‘insight to patient satisfaction’ by Nth Sense