Lab. No 12 Feed Back Scheme Direction: Feedback scheme.

Lab. No 12 Feed Back Scheme Direction: Feedback scheme. #include #include usingnamespace std; structprocess { int pid; int atime; int btime; int rtime; int priority; int stime; int etime; }; structmycomp { booloperator()(constprocess& lhs, constprocess& rhs) const { return lhs.priority > rhs.priority; } }; void printproc(process arr[],int n) { printf("\nPROCESS TABLE"); for(int i=0;i, mycomp> q1; queue q2; int time=0,turn; turn = 0; int quanta=4,rquanta=4; int flag1=0; while((!q1.empty())||(!q2.empty())||(flag1==0)||(turn0) q2.push(q1.top()); q1.pop(); quanta=4; } } elseif(!q2.empty()) { q2.front().rtime = q2.front().rtime-1; printf("\nIn RR rtime for %d is : %d",q2.front().pid,q2.front().rtime); chart[time]=q2.front().pid; rquanta--; if(q2.front().rtime==0) { q2.pop(); rquanta=4; } elseif(rquanta==0) { printf("\trquanta is zero, removing and adding at end %d",q2.front().pid); q2.push(q2.front()); q2.pop(); rquanta=4; } } printf("\nAt time= %d Current Chart: ",time); for(i=0;i<=time;i++) printf("%d",chart[i]); printf("\n"); time= time+1;} printf("\nCurrent Chart: "); for(i=0;i<=time;i++) printf("%d",chart[i]); printf("\n"); for(i=0;i

Comments

Popular posts from this blog

Magnifier- Magnifying Glass Privacy Policy

Boot Windows Oops, we get this horrible error! new method

Lab. No 8 Shortest Job First Operating System