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

📄 inqueue3hrrn.m

📁 3个CPU调度算法的simulation. 分别是Short Job First,High Return Ration Next, Round Robin. 模拟得到R,U,S等重要指标。
💻 M
字号:
%flag 'D'-diskqueue, 'R'-readyqueue
% the function use only for Readyqueue

function [Q,pos]=InQueue3HRRN(p,BeginToWaitTime,Tb,Q,Qlen,flag)
% disp('=========in InQueue3================');
i=1;
while i<=Qlen
   if Q(i,1)==0
      Q(i,1)=p;
      Q(i,2)=Tb;
      Q(i,3)=BeginToWaitTime;                    %never be 0 after running
      
      pos=i;
      
%       fprintf('In the p%d to QReady, start to wait at T=%d\n',p,BeginToWaitTime);
      break;
   end
   i=i+1;
end
if i>Qlen
    fprintf('The Queue(%c) is Full!\n',flag);
    pos=-1;                                          %could cause the TB(-1) in CPU.m
    return;
end

%-----------------------------------



⌨️ 快捷键说明

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