进程调度:一个例子区分响应时间、周转时间和等待时间

进程调度:一个例子区分响应时间、周转时间和等待时间参考链接 arrival time the time when a process enters into the ready state and is ready for its execution 进程进入就绪态的时刻 burst time the total time taken by the process for its execution on the

大家好,我是讯享网,很高兴认识大家。

参考链接

arrival time:the time when a process enters into the ready state and is ready for its execution.(进程进入就绪态的时刻)
burst time: the total time taken by the process for its execution on the CPU(进程在CPU上执行花费的时间,不包括I/O时间)

响应时间(Response time):Response time is the time spent when the process is in the ready state and gets the CPU for the first time. (自进程就绪至进程第一次获得CPU响应的时间)

Response time = Time at which the process gets the CPU for the first time - Arrival time

周转时间(turnarouad time):Turnaround time is the total amount of time spent by the process from coming in the ready state for the first time to its completion.(进程从第一次进入就绪状态到完成所花费的总时间。)

Turnaround time = Exit time - Arrival time

等待时间(Waiting time):Waiting time is the total time spent by the process in the ready state waiting for CPU.(进程处于就绪状态等待CPU所花费的总时间)


讯享网

Waiting time = Turnaround time - Burst time

例题:

Suppose round robin scheduler(时间片轮转调度算法) is used and the quantum is 2. Given the below 4 processes:
在这里插入图片描述
甘特图:
调度方式
补充一下就绪队列时刻表:(就绪队列队首的进程即为当前要运行的进程
在这里插入图片描述
:时刻2 :此时p1完成一个时间片,p2到来,先将新进程(p2)插入到就绪队列尾部,再将经过一个时间片后未执行完毕的p1插入到就绪队列尾部。

响应时间(Response time) : (第一次响应 - 到达时间)
P1: 0 - 0 = 0
P2: 2 - 2 = 0
P3: 6 - 3 = 3
P4: 12 - 9 = 3

周转时间(turnarouad time): (结束时刻 - 到达时间)
P1: 14 - 0 = 14
P2: 10 - 2 = 8
P3: 8 - 3 = 5
P4: 13 - 9 = 4

等待时间(Waiting time):(周转时间 - 运行时间)
P1: 14 - 7 = 7
P2: 8 - 4 = 4
P3: 5 - 2 = 3
P4: 4 - 1 = 3

扩展:

带权周转时间 = 周转时间/运行时间

小讯
上一篇 2025-03-31 10:57
下一篇 2025-01-24 08:19

相关推荐

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容,请联系我们,一经查实,本站将立刻删除。
如需转载请保留出处:https://51itzy.com/kjqy/61028.html