操作系统复习二

Week5_Lec 1-2

CPU调度
CPU scheduling

Basic Concepts - Typical Program Behavior
–Maximun CPU utilization obtained with multiprogramming
–CPU-I/O Burst Cycle: Process execution consists of a cycle of CPU excution and I/O wait在这里插入图片描述

CPU Scheduling: Part 1

–Selects from among the processes in memory that are ready to execute, and allocates the CPU to one of them
Non-preemptive(cooperative) scheduling : once the CPU has been allocated to a process, the process keeps the CPU until it releases the CPU either by terminating or by switching to the waiting state
–Dispatcher module gives control of the process selected by the short-term scheduler, this involves:
1.switching context
2.switching to user mode
3.jumping to the proper location in the program to restart that program
Dispatch latency: time it takes for the dispatcher to stop one process and start another running.


Scheduling Criteria:
1.CPU utilization: keep the CPU as busy as possible :40%-90%.
2.Throughput: no. of processes that complete their execution per time unit
3.Turnaround time: amount of time to execute a particular process
4.Waiting time: amount of time a process has been waiting in the ready queue=completion time - arrival time - execution time
5.Response time (for time-sharing environment): amount of time it takes from when a job was submitted until the first response is produced, not output (excludes speed of output device)


CPU Scheduling Algorithms

  1. First Come First Sever (FCFS)
  2. Shortest-Job-First Scheduling (SJF)
  3. Shortest Remaining Time First (SRTF)
  4. Priority Scheduling
  5. Round Robin Scheduling (RR)
  6. Multilevel Queue Scheduling

Turnaround time:
the interval from the time of submission of a process to the time of completion.
Average turnaround time:

https://blog.csdn.net/weixin_36465540/article/details/105560419?spm=1001.2014.3001.5506


1.FCFS(先来先服务)
1.
在这里插入图片描述

Waiting time :
P1 = 24 - 0 - 24 = 0
P2 = 27 - 0 - 3 = 24
P3 = 30 - 0 - 3 = 27
Average waiting time = ( 0 + 24 + 27 ) / 3 = 17

2
在这里插入图片描述
Waiting time :
P1 = 30 - 0 - 24 = 6
P2 = 3 - 0 - 3 = 0
P3 = 6 - 0 - 3 = 3
Average waiting time = ( 6 + 0 + 3 ) / 3 = 3

3.
在这里插入图片描述

在这里插入图片描述


2.SJ(P)F(短进程优先)
1.
在这里插入图片描述
在这里插入图片描述
Waiting time :
P1 = 0 - 0 = 0
P2 = 8 - 2 = 6
P3 = 7 - 4 = 3
P4 = 12 - 5 = 7
Average waiting time = ( 0 + 6 + 3 + 7 ) / 4 = 4

2.
在这里插入图片描述

在这里插入图片描述


3.SRTF(最短剩余时间优先)
在这里插入图片描述
Waiting time :
P1 = 16 - 7 - 0 = 9
P2 = 7 - 4 - 3 = 1
P3 = 5 - 1 - 4 = 0
P4 = 11 - 4 - 5 = 2
Average waiting time = ( 9 + 1 + 0 + 2 ) / 4 = 3


4.RR(时间轮转调度算法)
1.
在这里插入图片描述
Waiting time :
P1 = 134- 0 = 134
P2 = 37 - 0 = 37
P3 = 162 - 0 = 162
P4 = 121 - 0 = 121
Average waiting time = ( 134 + 37 +162 + 121 ) / 4 = 113.5

在这里插入图片描述

在这里插入图片描述
3.在这里插入图片描述

在这里插入图片描述
在这里插入图片描述
4.
在这里插入图片描述
5.
在这里插入图片描述
在这里插入图片描述


5.Highest Response ratio Next(HRRN)
优先进行高响应进程
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述


Asymmetric multiprocessing(非对称多处理):
only one processor accesses the system data structures, alleviating the need for data sharing.(只有一个处理器访问系统数据结构,减轻了数据共享的需要。)

Hard real-time systems(硬件实时系统):
required to complete a critical task within a guaranteed amount of time.(要求在保证的时间内完成一项关键任务。)

Soft real-time computing(软件实时计算):
requires that critical processes receive priority over less fortunate ones.(要求关键进程优先于不太幸运的进程。)

starvation:(饥饿现象)
A potential problem where low priority processes may never excdute.(即进程长时间得不到调度)


  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值