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

📄 outqueue4disk.m

📁 3个CPU调度算法的simulation. 分别是Short Job First,High Return Ration Next, Round Robin. 模拟得到R,U,S等重要指标。
💻 M
字号:
%
%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)!
%flag 'D'-diskqueue, 'R'-readyqueue
%ONLY for QDisk-4-D
%Move the first p out of the Diskqueue

function [Q,Head,rmTime,newStartFlag]=OutQueue4Disk(Q,Qlen,default,flag)
%disp('=========in OutQueue3================');   

Head=-1; %Empty Queue or Error

if Q(1,1)~=0 
   Head=Q(1,1); %Head is only the head process
   rmTime=Q(1,3);
   newStartFlag=Q(1,4);
   %---------------------------------
%    if flag=='D'
%       fprintf('out the p%d from QDisk\n',Head);
%    elseif flag=='R'
%        fprintf('out the p%d from QReady\n',Head);
%    end

else
   fprintf('This is a EMPTY Queue(%c), You can not Pick up anything!\n',flag);
   return;
end
%-----------------shift the data---------------------
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;
Q(Qlen,4)=0;





⌨️ 快捷键说明

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