首页 > 编程知识 正文

进程的周转时间和等待时间,进程调度的时机分为两大类

时间:2023-05-04 08:28:13 阅读:221540 作者:1106

参考链接

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:

hpddy:

响应时间(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

扩展:

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

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。