日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 运维知识 > windows >内容正文

windows

操作系统(五):FCFS/SJF/非抢占优先级/RR

發(fā)布時(shí)間:2023/12/20 windows 37 豆豆
生活随笔 收集整理的這篇文章主要介紹了 操作系统(五):FCFS/SJF/非抢占优先级/RR 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

操作系統(tǒng)(五):FCFS/SJF/非搶占優(yōu)先級(jí)/RR

一、題目1(書上170頁5.7)

5.4
5.4 Consider the following set of processes, with the length of the CPU burst time given in milliseconds:

The processes are assumed to have arrived in the order P1, P2, P3, P4, P5, all at time 0.

a. Draw four Gantt charts that illustrate the execution of these processes using the following scheduling algorithms: FCFS, SJF, nonpreemptive priority (a larger priority number implies a higher priority), and RR (quantum = 2).

b. What is the turnaround time of each process for each of the scheduling algorithms in part a?

c. What is the waiting time of each process for each of these scheduling algorithms?

d. Which of the algorithms results in the minimum average waiting time (over all processes)?

大致翻譯:這里有五個(gè)進(jìn)程以P1,P2,P3,P4,P5的順序同時(shí)在0時(shí)刻到達(dá),畫出FCFS,SJF,非搶占式優(yōu)先級(jí)和RR(時(shí)間片長度為2)的甘特圖,寫出上述四種算法得輪轉(zhuǎn)時(shí)間、等待時(shí)間和最小平均等待時(shí)間。

知識(shí)點(diǎn):對(duì)調(diào)度算法的理解,甘特圖的繪制。

二、做題1

1.概念1

(1)FCFS: 先到先服務(wù)(非搶占)
直接按到達(dá)順序先到先服務(wù)啦~

(2)SJF:最短作業(yè)優(yōu)先調(diào)度(優(yōu)先級(jí)調(diào)度的特例)(可搶占可非搶占)
執(zhí)行時(shí)間短的先啦~
當(dāng)?shù)竭_(dá)時(shí)間不同時(shí), 將 新來的執(zhí)行時(shí)間 與 之前的剩余的執(zhí)行時(shí)間 對(duì)比,短的優(yōu)先~(就可能存在搶占啦)

(3)非搶占優(yōu)先級(jí):
就是多加了個(gè)優(yōu)先級(jí),優(yōu)先級(jí)大的優(yōu)先,執(zhí)行時(shí)間少的優(yōu)先~(注意看數(shù)字大的代表優(yōu)先級(jí)大還是數(shù)字小代表優(yōu)先級(jí)大)

(4)RR:非搶占輪轉(zhuǎn)調(diào)度
固定時(shí)間片!!!!也就是固定一個(gè)程序最多一次只能運(yùn)行一個(gè)時(shí)間片的時(shí)間(如 時(shí)間片=2)
然后注意到達(dá)時(shí)間,不看優(yōu)先級(jí),按順序噢~

(5)搶占輪轉(zhuǎn)調(diào)度(第二題用)
考慮優(yōu)先級(jí)、時(shí)間片、到達(dá)先后 ,時(shí)間相同的話按先到先服務(wù)

2.概念2

(1)周轉(zhuǎn)時(shí)間:從到達(dá)時(shí)間 到 執(zhí)行完 所用的時(shí)間~

(2)等待時(shí)間:到達(dá)以后 等待的所有小時(shí)間相加

(3)平均等待時(shí)間:每個(gè)任務(wù)等待時(shí)間相加,除以總?cè)蝿?wù)數(shù)

(4)CPU運(yùn)行效率:非空轉(zhuǎn)時(shí)間占總時(shí)間的比例

3.做題啦



平均時(shí)間最短的就是SJF啦~

三、題目2(書上P170 5.8)

5.5
The following processes are being scheduled using a preemptive, roundrobin scheduling algorithm.

Each process is assigned a numerical priority,with a higher number indicating a higher relative priority. In addition to the processes listed below, the system also has an idle task (which consumes no CPU resources and is identified as [公式] ). This task has priority 0 and is scheduled whenever the system has no other available processes to run. The length of a time quantum is 10 units. If a process is preempted by a higher-priority process, the preempted process is placed at the end of the queue.

a. Show the scheduling order of the processes using a Gantt chart.

b. What is the turnaround time for each process?

c. What is the waiting time for each process?

d. What is the CPU utilization rate?

大致翻譯:這些進(jìn)程將會(huì)被搶占式的輪轉(zhuǎn)調(diào)度算法所調(diào)度,每一個(gè)進(jìn)程都擁有一個(gè)數(shù)字表示的優(yōu)先級(jí),數(shù)字大代表著高優(yōu)先級(jí),除了上述所說的進(jìn)程,系統(tǒng)在空轉(zhuǎn)的時(shí)候會(huì)執(zhí)行Pidle 進(jìn)程(不消耗任何CPU資源),時(shí)間片的大小為10個(gè)時(shí)間單元,如果一個(gè)進(jìn)程被高優(yōu)先級(jí)的進(jìn)程搶占,被搶占的進(jìn)程將會(huì)放在隊(duì)列的末尾。

使用甘特圖畫出這些進(jìn)程的調(diào)度情況,計(jì)算出每個(gè)進(jìn)程的輪轉(zhuǎn)時(shí)間、等待時(shí)間和CPU的使用率。

知識(shí)點(diǎn):搶占式RR算法

四、做題啦2

概念上面那題有噢

五、題目三

一個(gè)program~
看下面連接叭:https://zhuanlan.zhihu.com/p/83470448

總結(jié)

以上是生活随笔為你收集整理的操作系统(五):FCFS/SJF/非抢占优先级/RR的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。