outqueue3qready.m

来自「8个进程的改进版CPU schedule 算法-RoundRobin-所有上载程」· M 代码 · 共 31 行

M
31
字号
%
%Suppose always move the head out of the queue, and when it is moved out,
%we have the last element available(set it to be 0 for the QReady and EndTime for the QDisk)!
%Only for RR
%move the first p out of ReadyQueue

function [Q,Head,rmTime,curstartFlag]=OutQueue3QReady(Q,Qlen,default,flag)
%disp('=========in OutQueue2================');
Head=-1; %Empty Queue or Error

if Q(1,1)~=0 
   Head=Q(1,1);   %Head is only the head process
   rmTime=Q(1,2);
   curstartFlag=Q(1,3);  %newstartFlag
else
   fprintf('This is a EMPTY Queue(%c)!\n',flag);
   return;
end

i=1;
while i<Qlen
   Q(i,:)=Q(i+1,:);
   i=i+1;
end
Q(Qlen,1)=0; %for the P
Q(Qlen,2)=default; % 0 for the QReady, EndTime for QDisk
Q(Qlen,3)=0; %the new start flag                           ====>>



⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?