checkdiskqueue_hrrn.m
来自「8个进程的改进版CPU schedule 算法-HRRN」· M 代码 · 共 30 行
M
30 行
function [QDisk,QReady]=CheckDiskQueue_HRRN(QDisk,QReady,Qlen,GlobalCycle,TB,EndTime)
%disp('=========CheckDiskQueue_HRRN================');
QDisk=sortrows(QDisk,2);
i=1;
flag=0; %whether move p from QDisk to QReady
% fprintf('before checking(Time is %d)',GlobalCycle);
% QDisk
% QReady
while i<=Qlen
if QDisk(i,2)<=GlobalCycle %if there is a empty element the QDisk(i,2)=Endtime+100>GlobalCycle
BeginToWaitTime=QDisk(i,2); %should be save before Out put
[QDisk,p]=OutQueue2(QDisk,Qlen,EndTime+100,'D');
[QReady,pos]=InQueue3HRRN(p,BeginToWaitTime,TB(p),QReady,Qlen,'R'); %Only for HRRN
% fprintf('Move the p%d from the QDisk to QReady\n',p);
flag=1;
end
i=i+1;
end
if flag==0
% disp('Nothing to move from QDisk');
end
% disp('-----After Check..---');
% QReady
%disp('after checking');
% QDisk
% QReady
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?