⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 checkdiskqueue_hrrn.m

📁 3个CPU调度算法的simulation. 分别是Short Job First,High Return Ration Next, Round Robin. 模拟得到R,U,S等重要指标。
💻 M
字号:
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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -