inqueue3hrrn.m
来自「8个进程的改进版CPU schedule 算法-HRRN」· M 代码 · 共 30 行
M
30 行
%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 + =
减小字号Ctrl + -
显示快捷键?