先来先服务算法(FCFS)

  • 一、实验内容
  • 二、算法设计思路
    • 1.理解先来先服务算法的思想
    • 2.构思代码实现的流程
    • 3.代码实现
      • (1)结构体的定义
      • (2)按照到达时间进行排序
      • (3)完整代码
      • (4)运行结果

一、实验内容

输入N(N>0)个作业,输入每个作业的名字,到达时间,服务时间,按照先来先服务算法,计算每个作业的完成时间,周转时间,带权周转时间(保留2位小数)。

输入格式:
第一行输入作业数目,第二行输入作业的名字,第三行输入到达时间,第四行输入服务时间。

输出格式:
按照到达时间从小到大排序,第一行输出作业的名字,第二行输出到达时间,第三行输出服务时间,第四行输出完成时间,第五行输出完成时间,第六行输出带权周转时间。

输入样例:
在这里给出一组输入。例如:

5
A B C D E
0 1 2 3 4
4 3 4 2 4

输出样例:
在这里给出相应的输出。例如:

作 业 名:A B C D E
到达时间:0 1 2 3 4
服务时间:4 3 4 2 4
完成时间:4 7 11 13 17
周转时间:4 6 9 10 13
带权周转时间:1.00 2.00 2.25 5.00 3.25

二、算法设计思路

1.理解先来先服务算法的思想

FCFS是最简单的调度算法,该算法既可用于作业调度,也可用于进程调度。当在作业调度中采用该算法时,系统将按照作业到达的先后次序来进行调度,或者说它是优先考虑在系统中等待时间最长的作业,而不管该作业所需执行时间的长短,从后备作业队列中选择几个最先进入该队列的作业,将它们调入内存,为它们分配资源和创建进程,然后把它放入就绪队列。
当在进程调度中采用FCFS算法时,每次调度是从就绪的进程队列中选择一个最先进入该队列的进程,为之分配处理机,使之投入运行。

2.构思代码实现的流程

#mermaid-svg-YcMofbmlM8Y12iga .label{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);fill:#333;color:#333}#mermaid-svg-YcMofbmlM8Y12iga .label text{fill:#333}#mermaid-svg-YcMofbmlM8Y12iga .node rect,#mermaid-svg-YcMofbmlM8Y12iga .node circle,#mermaid-svg-YcMofbmlM8Y12iga .node ellipse,#mermaid-svg-YcMofbmlM8Y12iga .node polygon,#mermaid-svg-YcMofbmlM8Y12iga .node path{fill:#ECECFF;stroke:#9370db;stroke-width:1px}#mermaid-svg-YcMofbmlM8Y12iga .node .label{text-align:center;fill:#333}#mermaid-svg-YcMofbmlM8Y12iga .node.clickable{cursor:pointer}#mermaid-svg-YcMofbmlM8Y12iga .arrowheadPath{fill:#333}#mermaid-svg-YcMofbmlM8Y12iga .edgePath .path{stroke:#333;stroke-width:1.5px}#mermaid-svg-YcMofbmlM8Y12iga .flowchart-link{stroke:#333;fill:none}#mermaid-svg-YcMofbmlM8Y12iga .edgeLabel{background-color:#e8e8e8;text-align:center}#mermaid-svg-YcMofbmlM8Y12iga .edgeLabel rect{opacity:0.9}#mermaid-svg-YcMofbmlM8Y12iga .edgeLabel span{color:#333}#mermaid-svg-YcMofbmlM8Y12iga .cluster rect{fill:#ffffde;stroke:#aa3;stroke-width:1px}#mermaid-svg-YcMofbmlM8Y12iga .cluster text{fill:#333}#mermaid-svg-YcMofbmlM8Y12iga div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);font-size:12px;background:#ffffde;border:1px solid #aa3;border-radius:2px;pointer-events:none;z-index:100}#mermaid-svg-YcMofbmlM8Y12iga .actor{stroke:#ccf;fill:#ECECFF}#mermaid-svg-YcMofbmlM8Y12iga text.actor>tspan{fill:#000;stroke:none}#mermaid-svg-YcMofbmlM8Y12iga .actor-line{stroke:grey}#mermaid-svg-YcMofbmlM8Y12iga .messageLine0{stroke-width:1.5;stroke-dasharray:none;stroke:#333}#mermaid-svg-YcMofbmlM8Y12iga .messageLine1{stroke-width:1.5;stroke-dasharray:2, 2;stroke:#333}#mermaid-svg-YcMofbmlM8Y12iga #arrowhead path{fill:#333;stroke:#333}#mermaid-svg-YcMofbmlM8Y12iga .sequenceNumber{fill:#fff}#mermaid-svg-YcMofbmlM8Y12iga #sequencenumber{fill:#333}#mermaid-svg-YcMofbmlM8Y12iga #crosshead path{fill:#333;stroke:#333}#mermaid-svg-YcMofbmlM8Y12iga .messageText{fill:#333;stroke:#333}#mermaid-svg-YcMofbmlM8Y12iga .labelBox{stroke:#ccf;fill:#ECECFF}#mermaid-svg-YcMofbmlM8Y12iga .labelText,#mermaid-svg-YcMofbmlM8Y12iga .labelText>tspan{fill:#000;stroke:none}#mermaid-svg-YcMofbmlM8Y12iga .loopText,#mermaid-svg-YcMofbmlM8Y12iga .loopText>tspan{fill:#000;stroke:none}#mermaid-svg-YcMofbmlM8Y12iga .loopLine{stroke-width:2px;stroke-dasharray:2, 2;stroke:#ccf;fill:#ccf}#mermaid-svg-YcMofbmlM8Y12iga .note{stroke:#aa3;fill:#fff5ad}#mermaid-svg-YcMofbmlM8Y12iga .noteText,#mermaid-svg-YcMofbmlM8Y12iga .noteText>tspan{fill:#000;stroke:none}#mermaid-svg-YcMofbmlM8Y12iga .activation0{fill:#f4f4f4;stroke:#666}#mermaid-svg-YcMofbmlM8Y12iga .activation1{fill:#f4f4f4;stroke:#666}#mermaid-svg-YcMofbmlM8Y12iga .activation2{fill:#f4f4f4;stroke:#666}#mermaid-svg-YcMofbmlM8Y12iga .mermaid-main-font{font-family:"trebuchet ms", verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-YcMofbmlM8Y12iga .section{stroke:none;opacity:0.2}#mermaid-svg-YcMofbmlM8Y12iga .section0{fill:rgba(102,102,255,0.49)}#mermaid-svg-YcMofbmlM8Y12iga .section2{fill:#fff400}#mermaid-svg-YcMofbmlM8Y12iga .section1,#mermaid-svg-YcMofbmlM8Y12iga .section3{fill:#fff;opacity:0.2}#mermaid-svg-YcMofbmlM8Y12iga .sectionTitle0{fill:#333}#mermaid-svg-YcMofbmlM8Y12iga .sectionTitle1{fill:#333}#mermaid-svg-YcMofbmlM8Y12iga .sectionTitle2{fill:#333}#mermaid-svg-YcMofbmlM8Y12iga .sectionTitle3{fill:#333}#mermaid-svg-YcMofbmlM8Y12iga .sectionTitle{text-anchor:start;font-size:11px;text-height:14px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-YcMofbmlM8Y12iga .grid .tick{stroke:#d3d3d3;opacity:0.8;shape-rendering:crispEdges}#mermaid-svg-YcMofbmlM8Y12iga .grid .tick text{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-YcMofbmlM8Y12iga .grid path{stroke-width:0}#mermaid-svg-YcMofbmlM8Y12iga .today{fill:none;stroke:red;stroke-width:2px}#mermaid-svg-YcMofbmlM8Y12iga .task{stroke-width:2}#mermaid-svg-YcMofbmlM8Y12iga .taskText{text-anchor:middle;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-YcMofbmlM8Y12iga .taskText:not([font-size]){font-size:11px}#mermaid-svg-YcMofbmlM8Y12iga .taskTextOutsideRight{fill:#000;text-anchor:start;font-size:11px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-YcMofbmlM8Y12iga .taskTextOutsideLeft{fill:#000;text-anchor:end;font-size:11px}#mermaid-svg-YcMofbmlM8Y12iga .task.clickable{cursor:pointer}#mermaid-svg-YcMofbmlM8Y12iga .taskText.clickable{cursor:pointer;fill:#003163 !important;font-weight:bold}#mermaid-svg-YcMofbmlM8Y12iga .taskTextOutsideLeft.clickable{cursor:pointer;fill:#003163 !important;font-weight:bold}#mermaid-svg-YcMofbmlM8Y12iga .taskTextOutsideRight.clickable{cursor:pointer;fill:#003163 !important;font-weight:bold}#mermaid-svg-YcMofbmlM8Y12iga .taskText0,#mermaid-svg-YcMofbmlM8Y12iga .taskText1,#mermaid-svg-YcMofbmlM8Y12iga .taskText2,#mermaid-svg-YcMofbmlM8Y12iga .taskText3{fill:#fff}#mermaid-svg-YcMofbmlM8Y12iga .task0,#mermaid-svg-YcMofbmlM8Y12iga .task1,#mermaid-svg-YcMofbmlM8Y12iga .task2,#mermaid-svg-YcMofbmlM8Y12iga .task3{fill:#8a90dd;stroke:#534fbc}#mermaid-svg-YcMofbmlM8Y12iga .taskTextOutside0,#mermaid-svg-YcMofbmlM8Y12iga .taskTextOutside2{fill:#000}#mermaid-svg-YcMofbmlM8Y12iga .taskTextOutside1,#mermaid-svg-YcMofbmlM8Y12iga .taskTextOutside3{fill:#000}#mermaid-svg-YcMofbmlM8Y12iga .active0,#mermaid-svg-YcMofbmlM8Y12iga .active1,#mermaid-svg-YcMofbmlM8Y12iga .active2,#mermaid-svg-YcMofbmlM8Y12iga .active3{fill:#bfc7ff;stroke:#534fbc}#mermaid-svg-YcMofbmlM8Y12iga .activeText0,#mermaid-svg-YcMofbmlM8Y12iga .activeText1,#mermaid-svg-YcMofbmlM8Y12iga .activeText2,#mermaid-svg-YcMofbmlM8Y12iga .activeText3{fill:#000 !important}#mermaid-svg-YcMofbmlM8Y12iga .done0,#mermaid-svg-YcMofbmlM8Y12iga .done1,#mermaid-svg-YcMofbmlM8Y12iga .done2,#mermaid-svg-YcMofbmlM8Y12iga .done3{stroke:grey;fill:#d3d3d3;stroke-width:2}#mermaid-svg-YcMofbmlM8Y12iga .doneText0,#mermaid-svg-YcMofbmlM8Y12iga .doneText1,#mermaid-svg-YcMofbmlM8Y12iga .doneText2,#mermaid-svg-YcMofbmlM8Y12iga .doneText3{fill:#000 !important}#mermaid-svg-YcMofbmlM8Y12iga .crit0,#mermaid-svg-YcMofbmlM8Y12iga .crit1,#mermaid-svg-YcMofbmlM8Y12iga .crit2,#mermaid-svg-YcMofbmlM8Y12iga .crit3{stroke:#f88;fill:red;stroke-width:2}#mermaid-svg-YcMofbmlM8Y12iga .activeCrit0,#mermaid-svg-YcMofbmlM8Y12iga .activeCrit1,#mermaid-svg-YcMofbmlM8Y12iga .activeCrit2,#mermaid-svg-YcMofbmlM8Y12iga .activeCrit3{stroke:#f88;fill:#bfc7ff;stroke-width:2}#mermaid-svg-YcMofbmlM8Y12iga .doneCrit0,#mermaid-svg-YcMofbmlM8Y12iga .doneCrit1,#mermaid-svg-YcMofbmlM8Y12iga .doneCrit2,#mermaid-svg-YcMofbmlM8Y12iga .doneCrit3{stroke:#f88;fill:#d3d3d3;stroke-width:2;cursor:pointer;shape-rendering:crispEdges}#mermaid-svg-YcMofbmlM8Y12iga .milestone{transform:rotate(45deg) scale(0.8, 0.8)}#mermaid-svg-YcMofbmlM8Y12iga .milestoneText{font-style:italic}#mermaid-svg-YcMofbmlM8Y12iga .doneCritText0,#mermaid-svg-YcMofbmlM8Y12iga .doneCritText1,#mermaid-svg-YcMofbmlM8Y12iga .doneCritText2,#mermaid-svg-YcMofbmlM8Y12iga .doneCritText3{fill:#000 !important}#mermaid-svg-YcMofbmlM8Y12iga .activeCritText0,#mermaid-svg-YcMofbmlM8Y12iga .activeCritText1,#mermaid-svg-YcMofbmlM8Y12iga .activeCritText2,#mermaid-svg-YcMofbmlM8Y12iga .activeCritText3{fill:#000 !important}#mermaid-svg-YcMofbmlM8Y12iga .titleText{text-anchor:middle;font-size:18px;fill:#000;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-YcMofbmlM8Y12iga g.classGroup text{fill:#9370db;stroke:none;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);font-size:10px}#mermaid-svg-YcMofbmlM8Y12iga g.classGroup text .title{font-weight:bolder}#mermaid-svg-YcMofbmlM8Y12iga g.clickable{cursor:pointer}#mermaid-svg-YcMofbmlM8Y12iga g.classGroup rect{fill:#ECECFF;stroke:#9370db}#mermaid-svg-YcMofbmlM8Y12iga g.classGroup line{stroke:#9370db;stroke-width:1}#mermaid-svg-YcMofbmlM8Y12iga .classLabel .box{stroke:none;stroke-width:0;fill:#ECECFF;opacity:0.5}#mermaid-svg-YcMofbmlM8Y12iga .classLabel .label{fill:#9370db;font-size:10px}#mermaid-svg-YcMofbmlM8Y12iga .relation{stroke:#9370db;stroke-width:1;fill:none}#mermaid-svg-YcMofbmlM8Y12iga .dashed-line{stroke-dasharray:3}#mermaid-svg-YcMofbmlM8Y12iga #compositionStart{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-YcMofbmlM8Y12iga #compositionEnd{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-YcMofbmlM8Y12iga #aggregationStart{fill:#ECECFF;stroke:#9370db;stroke-width:1}#mermaid-svg-YcMofbmlM8Y12iga #aggregationEnd{fill:#ECECFF;stroke:#9370db;stroke-width:1}#mermaid-svg-YcMofbmlM8Y12iga #dependencyStart{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-YcMofbmlM8Y12iga #dependencyEnd{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-YcMofbmlM8Y12iga #extensionStart{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-YcMofbmlM8Y12iga #extensionEnd{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-YcMofbmlM8Y12iga .commit-id,#mermaid-svg-YcMofbmlM8Y12iga .commit-msg,#mermaid-svg-YcMofbmlM8Y12iga .branch-label{fill:lightgrey;color:lightgrey;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-YcMofbmlM8Y12iga .pieTitleText{text-anchor:middle;font-size:25px;fill:#000;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-YcMofbmlM8Y12iga .slice{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-YcMofbmlM8Y12iga g.stateGroup text{fill:#9370db;stroke:none;font-size:10px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-YcMofbmlM8Y12iga g.stateGroup text{fill:#9370db;fill:#333;stroke:none;font-size:10px}#mermaid-svg-YcMofbmlM8Y12iga g.statediagram-cluster .cluster-label text{fill:#333}#mermaid-svg-YcMofbmlM8Y12iga g.stateGroup .state-title{font-weight:bolder;fill:#000}#mermaid-svg-YcMofbmlM8Y12iga g.stateGroup rect{fill:#ECECFF;stroke:#9370db}#mermaid-svg-YcMofbmlM8Y12iga g.stateGroup line{stroke:#9370db;stroke-width:1}#mermaid-svg-YcMofbmlM8Y12iga .transition{stroke:#9370db;stroke-width:1;fill:none}#mermaid-svg-YcMofbmlM8Y12iga .stateGroup .composit{fill:white;border-bottom:1px}#mermaid-svg-YcMofbmlM8Y12iga .stateGroup .alt-composit{fill:#e0e0e0;border-bottom:1px}#mermaid-svg-YcMofbmlM8Y12iga .state-note{stroke:#aa3;fill:#fff5ad}#mermaid-svg-YcMofbmlM8Y12iga .state-note text{fill:black;stroke:none;font-size:10px}#mermaid-svg-YcMofbmlM8Y12iga .stateLabel .box{stroke:none;stroke-width:0;fill:#ECECFF;opacity:0.7}#mermaid-svg-YcMofbmlM8Y12iga .edgeLabel text{fill:#333}#mermaid-svg-YcMofbmlM8Y12iga .stateLabel text{fill:#000;font-size:10px;font-weight:bold;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-YcMofbmlM8Y12iga .node circle.state-start{fill:black;stroke:black}#mermaid-svg-YcMofbmlM8Y12iga .node circle.state-end{fill:black;stroke:white;stroke-width:1.5}#mermaid-svg-YcMofbmlM8Y12iga #statediagram-barbEnd{fill:#9370db}#mermaid-svg-YcMofbmlM8Y12iga .statediagram-cluster rect{fill:#ECECFF;stroke:#9370db;stroke-width:1px}#mermaid-svg-YcMofbmlM8Y12iga .statediagram-cluster rect.outer{rx:5px;ry:5px}#mermaid-svg-YcMofbmlM8Y12iga .statediagram-state .divider{stroke:#9370db}#mermaid-svg-YcMofbmlM8Y12iga .statediagram-state .title-state{rx:5px;ry:5px}#mermaid-svg-YcMofbmlM8Y12iga .statediagram-cluster.statediagram-cluster .inner{fill:white}#mermaid-svg-YcMofbmlM8Y12iga .statediagram-cluster.statediagram-cluster-alt .inner{fill:#e0e0e0}#mermaid-svg-YcMofbmlM8Y12iga .statediagram-cluster .inner{rx:0;ry:0}#mermaid-svg-YcMofbmlM8Y12iga .statediagram-state rect.basic{rx:5px;ry:5px}#mermaid-svg-YcMofbmlM8Y12iga .statediagram-state rect.divider{stroke-dasharray:10,10;fill:#efefef}#mermaid-svg-YcMofbmlM8Y12iga .note-edge{stroke-dasharray:5}#mermaid-svg-YcMofbmlM8Y12iga .statediagram-note rect{fill:#fff5ad;stroke:#aa3;stroke-width:1px;rx:0;ry:0}:root{--mermaid-font-family: '"trebuchet ms", verdana, arial';--mermaid-font-family: "Comic Sans MS", "Comic Sans", cursive}#mermaid-svg-YcMofbmlM8Y12iga .error-icon{fill:#522}#mermaid-svg-YcMofbmlM8Y12iga .error-text{fill:#522;stroke:#522}#mermaid-svg-YcMofbmlM8Y12iga .edge-thickness-normal{stroke-width:2px}#mermaid-svg-YcMofbmlM8Y12iga .edge-thickness-thick{stroke-width:3.5px}#mermaid-svg-YcMofbmlM8Y12iga .edge-pattern-solid{stroke-dasharray:0}#mermaid-svg-YcMofbmlM8Y12iga .edge-pattern-dashed{stroke-dasharray:3}#mermaid-svg-YcMofbmlM8Y12iga .edge-pattern-dotted{stroke-dasharray:2}#mermaid-svg-YcMofbmlM8Y12iga .marker{fill:#333}#mermaid-svg-YcMofbmlM8Y12iga .marker.cross{stroke:#333}:root { --mermaid-font-family: "trebuchet ms", verdana, arial;}#mermaid-svg-YcMofbmlM8Y12iga {color: rgba(0, 0, 0, 0.75);font: ;}

数据
按照到达时间进行排序
计算完成时间-周转时间-带权周转时间
输出

3.代码实现

(1)结构体的定义

struct work{char name[10]; //作业名称 int Atime;     //到达时间 int Stime;     //服务时间 int Ftime;     //完成时间int Rtime;     //周转时间double DRtime; //带权周转时间
};

(2)按照到达时间进行排序

for(int i=0; i<N-1; i++)            //按到达时间排序
{struct work temp;for(int j=i+1; j<N; j++){if(s[i].Atime>s[j].Atime){temp=s[i];s[i]=s[j];s[j]=temp;    }}
}

(3)完整代码

#include<stdio.h>
#include<stdlib.h>
struct work{char name[10]; //作业名称 int Atime;     //到达时间 int Stime;     //服务时间 int Ftime;     //完成时间int Rtime;     //周转时间double DRtime; //带权周转时间
};
int main(void){int N;                              //输入N个作业 scanf("%d",&N);struct work s[N];for(int i=0; i<N; i++)              //输入作业名字 scanf("%s",&s[i].name);for(int i=0; i<N; i++)              //输入作业到达时间scanf("%d",&s[i].Atime);        for(int i=0; i<N; i++)              //输入作业服务时间 scanf("%d",&s[i].Stime);for(int i=0; i<N-1; i++)            //按到达时间排序 {struct work temp;for(int j=i+1; j<N; j++){if(s[i].Atime>s[j].Atime){temp=s[i];s[i]=s[j];s[j]=temp; }}}for(int i=0; i<N; i++)             //计算完成时间 {if(i==0)s[0].Ftime=s[0].Atime+s[0].Stime;else{if(s[i].Atime>s[i-1].Ftime)s[i].Ftime=s[i].Atime+s[i].Stime;elses[i].Ftime=s[i-1].Ftime+s[i].Stime;} } for(int i=0; i<N; i++)            //计算周转时间 s[i].Rtime=s[i].Ftime-s[i].Atime;for(int i=0; i<N; i++)            //计算带权周转时间 s[i].DRtime=1.0*s[i].Rtime/s[i].Stime;printf("作 业 名:");              //输出 for(int i=0; i<N; i++){if(i==N-1){printf("%s",s[N-1].name);printf("\n");}elseprintf("%s ",s[i].name);}printf("到达时间:"); for(int i=0; i<N; i++){if(i==N-1){printf("%d",s[N-1].Atime);printf("\n");}elseprintf("%d ",s[i].Atime);}printf("服务时间:"); for(int i=0; i<N; i++){if(i==N-1){printf("%d",s[N-1].Stime);printf("\n");}elseprintf("%d ",s[i].Stime);}printf("完成时间:");for(int i=0; i<N; i++){if(i==N-1){printf("%d",s[N-1].Ftime);printf("\n");}elseprintf("%d ",s[i].Ftime);}printf("周转时间:");for(int i=0; i<N; i++){if(i==N-1){printf("%d",s[N-1].Rtime);printf("\n");}elseprintf("%d ",s[i].Rtime);}printf("带权周转时间:");for(int i=0; i<N; i++){if(i==N-1){printf("%.2f",s[N-1].DRtime);printf("\n");}elseprintf("%.2f ",s[i].DRtime);}return 0;
}

(4)运行结果

** 实验的部分代码也可以写成函数的形式,这样主函数看起来会显得相对简洁一点,不至于像上述函数那么臃肿。**
感兴趣的小伙伴可以自己尝试一下哟!

第一次尝试,不足之处,希望大家见谅!
感谢小伙伴的支持!!!

作业调度-先来先服务算法相关推荐

  1. 软件测试——进程调度(短作业优先调度算法+先来先服务算法)测试

    源代码 被测代码 Schedule package net.mooctest;import java.util.ArrayList; import java.util.List;public clas ...

  2. 操作系统 先来先服务算法(FCFS)、最短寻到时间优先算法(SSTF)、扫描算法(电梯算法,SCAN)、循环扫描算法(CSCAN)

    操作系统 先来先服务算法(FCFS).最短寻到时间优先算法(SSTF).扫描算法(电梯算法,SCAN).循环扫描算法(CSCAN)和N步扫描算法(NStepScan)的程序实现 复制到本地即可运行 # ...

  3. 一、操作系统——处理机(作业)调度算法:先来先服务算法FCFS、最短作业优先算法SJF(非抢占式)、 最短剩余时间优先算法SRTN(抢占式)、最高响应比优先算法HRRN

    各种调度算法的学习思路: 调度算法的评价指标: 一.先来先服务算法(FCFS):First Come First Serve 二.最短作业优先算法(SJF非抢占式):Shortest Job Firs ...

  4. 先来先服务算法-FCFS

    #include <iostream> #include <cstdlib> #include <numeric> using namespace std; #de ...

  5. 先来先服务算法——FCFS

    输入N(N>0)个作业,输入每个作业的名字,到达时间,服务时间,按照先来先服务算法,计算每个作业的完成时间,周转时间,带权周转时间(保留2位小数). 输入格式: 第一行输入作业数目,第二行输入作 ...

  6. JAVA编写FCFS(先来先服务算法) 和 SJF(最短进程优先调度算法)

    核心代码如下: import java.util.ArrayList; import java.util.Scanner;public class opera {private static doub ...

  7. 【操作系统】-- 先来先服务算法(FCFS)、短作业优先算法(SJF)、高响应比调度算法(HRRN)

    一.先来先服务(FCFS) 1.算法思想 主要从公平的角度考虑. 2.算法规则 按照 作业/进程 到达的先后顺序进行服务. 3.是否可抢占 非抢占式算法. 4.是否可导致饥饿 不会导致饥饿. 5.优缺 ...

  8. 先来先服务算法代码_程序员算法与数据结构基础中的基础,栈与递归

    在此之前,我们介绍了动态规划.深度优先搜索等基础算法,但是,有部分好友评论说,难度太难了,我们知道动态规划的自顶向下跟深度优先搜索一般都用递归实现,今天我们就先来讲讲算法与数据结构中,基础中的基础递归 ...

  9. matlab车辆贪心作业调度,贪心算法-区间调度-Interval Scheduling

    什么是贪心算法呢? 贪心算法可以认为是动态规划算法的一个特例,相比动态规划,使用贪心算法需要满足更多的条件(贪心选择性质),但是效率比动态规划要高. 比如说一个算法问题使用暴力解法需要指数级时间,如果 ...

最新文章

  1. python流程控制:while循环
  2. sql 关联使用id还是code_使用sh格式化nginx访问日志并存入mysql
  3. scrum 敏捷开发
  4. 70%的付费率 手游还在愁什么?
  5. Intel RealSense 数码相机和摄像机的ISO是什么意思?
  6. poj 2777(线段树+区间染色)
  7. Spring MVC之@RequestMapping 详解
  8. “天下第一长联”与“元跨革囊”
  9. mysql多表成绩查询_MySQL多表数据记录查询(一)
  10. 【C++】int与string转换
  11. 命令查看mysql端口映射_【转载】烂泥:如何利用telnet命令检测端口映射是否成功...
  12. 一组飒气十足的商务海报PSD分层海报
  13. python sorted下标_Python列表实用的代码片段
  14. jenkins手把手教你从入门到放弃02-jenkins在Windows系统安装与配置(详解)
  15. ASCII码 编码对照表
  16. 开学季:好好聊聊自己的大学生活
  17. Spatiotemporal Multi-Graph Convolution Network for Ride-Hailing Demand Forecasting
  18. Latest for Mac 0.7.3 应用更新管理器
  19. 带你玩转区块链--区块链面试问题及答案-第四章【总结篇】
  20. 1000字小论文格式是怎样的?

热门文章

  1. 默纳克全系列电梯软件刷协议
  2. 在IDEA中使用密码连接GitHub报错“lnvalid authentication data. 404 Not Found - NotFound“
  3. 以目标为导向,实现高质量的项目复盘
  4. Python【8】-分析json文件
  5. python入门书籍(爬虫方面)
  6. 2022-2028年中国多功能电动护理床行业市场发展潜力及投资风险预测报告
  7. 2分钟学会物联网平台协议解析——实践类
  8. 16.windbg-.cxr、.frame、dt(查找设置设备上下文、切换局部上下文、查找结构体)
  9. 中国护照上两行88个字符的含义
  10. 【良品】运维实施工程师面试题