• No results found

Lecture 4. Homework 1, Process Management Project posted to course webpage Questions? Wednesday, January 19 CS 470 Operating Systems - Lecture 4 1

N/A
N/A
Protected

Academic year: 2021

Share "Lecture 4. Homework 1, Process Management Project posted to course webpage Questions? Wednesday, January 19 CS 470 Operating Systems - Lecture 4 1"

Copied!
21
0
0

Loading.... (view fulltext now)

Full text

(1)

Lecture 4

 Homework 1, Process Management Project

posted to course webpage

(2)

Outline

 Round-robin (RR) scheduling  Process management project  Multi-level queue scheduling  Multi-processor scheduling

(3)

Round-Robin (RR)

Round-robin (RR) scheduling can be thought

of as FCFS with preemption at fixed intervals.

 As its name implies, each process gets some

CPU time in a round-robin manner, making it very good for time sharing OS's.

Define a time quantum (or time slice) q,

usually 10-100ms. The Ready Queue is FIFO. The currently running process gets up to 1

(4)

Round-Robin (RR)

 Reconsider the first example from last time:

Process CPU burst time Arrival time

p1 24 0

p2 3 0

p3 3 0

with arrival order p1, p2, p3

 Do wait time analysis with q = 4ms. Do again

(5)

Round-Robin (RR)

 Wait time is bounded: (n-1)*q ms is maximum

wait time between each quantum. Actual performance depends on size of q.

 One extreme: q =

=> FCFS

 Other extreme: q = 1ms, approaches

appearance of n processes each having its own processor that is 1/n as fast as the physical

(6)

Round-Robin (RR)

 Making this all work requires hardware support.

In particular, context switches are costly. This tends to favor larger q sizes to reduce the

number of switches. E.g. for a process with burst size of 10 ms:

 q = 12ms requires only one switch at the end

 q = 6ms requires two switches

(7)

Round-Robin (RR)

 Too large of q size approaches FCFS. Luckily,

recall distribution of burst sizes:

 General rule is 80% of processes should finish

(8)

Process Management Project

 Process management project is to simulate a

round-robin (RR) schedule with cascading

termination (i.e., when any process terminates, its children are terminated).

 Simulation is parameterized by quantum size

(q) and an input file of actions.

 Each action represents one time unit of

execution. A process may hold the CPU for up

to q time units, then a scheduling decision must

(9)

Multi-level Queue Scheduling (MQS)

 The processes that do not finish in 1 quantum

may be very long as the chart indicates.

 If we want to minimize the maximum wait time,

it might be better to give these processes more time the next time it gets the CPU.

 Also, processes may have different processing

(10)

Multi-level Queue Scheduling (MQS)

 For more flexibility, we can partition the Ready

Queue into separate queues each with a

different scheduling algorithm. Called

multi-level queue scheduling (MQS).

 Example: foreground processes in one queue

using RR, background processes in another queue using FCFS.

 Also must schedule between queues. Example:

(11)

Multi-level Queue Scheduling (MQS)

 Example: different queues for different priority

processes. Could be absolute, preemptive. (highest)

System

Interactive

Interactive Editing

(12)

Multi-level Feedback Queue

Scheduling (MFQS)

 Another organization would be to allow

processes to move between queue levels.

 Example:

admitted

q = 8

q = 16

(13)

Multi-level Feedback Queue

Scheduling (MFQS)

 Processes start in first queue, then if do not

terminate, put on the second queue, etc. Usually preemptive.

 Parameters for MQS and MFQS include

 number of queues

 schedule for each queue

 when to put into lower queue

 when to raise to higher queue, e.g. for aging

(14)

Multiprocessor Scheduling

 Assume homogeneous hardware; any process

can run on any processor. Would like to share the load among processors. Two approaches:

Asymmetric multiprocessing: all scheduling is

done by one processor, the master server. Others only execute code given to them. System data

structures are not shared, simplifying system.

Symmetric multiprocessing (SMP): each

(15)

Multiprocessor Scheduling

 Some issues in conflict in multiprocessor

scheduling

Processor affinity: once a process is running on a

processor, its data is already there, so we would like to keep the process running on the same

processor, if possible

Load balancing: try to keep utilization evenly

(16)

Multi-Core Processor Scheduling

 Multi-core processors usually provide a limited

number of hardware threads that run on each core. To the OS, each hardware thread

appears as a logical processor. Example: UltraSPARC T1 CPU has 8 cores and 4 hardware threads per core giving an

appearance of 32 logical processors.

 OS assigns a software thread to a hardware

(17)

How to Choose a Scheduling Algorithm?

 Select criteria for evaluation and performance

measurement. For example,

 Maximize CPU utilization while keeping maximum

response time under 1 second

 Maximize throughput such that turnaround time is

(18)

How to Choose a Scheduling Algorithm?

 Our method of evaluation is called

deterministic modeling, a form of analysis

that uses a synthetic workload to produce a formula or number for comparison.

 This method is simple and fast to compute, but

not very realistic. Using real system traces can give more realistic numbers, but mostly this

(19)

How to Choose a Scheduling Algorithm?

Queuing models are a more mathematically

accurate evaluation method. Need to

determine the distribution of CPU and I/O

bursts as a probability function and an arrival (process creation) distribution.

 Using queuing-network analysis can compute

utilization, average queue length, average wait time, etc.

 Still need lots of simplifying assumptions to

(20)

How to Choose a Scheduling Algorithm?

Simulations can be used to evaluate

algorithms. Most interesting aspect is how to generate data to drive the simulation.

 Random number generation in some probability

distribution (a la queuing models)

 Trace tapes from actual systems

 Some drawbacks: expensive, time-consuming,

(21)

How to Choose a Scheduling Algorithm?

 Can evaluate a scheduling algorithm by

implementing it into an actual OS and taking actual measurements.

References

Related documents

 Continually review the capability needed to support the organisation in delivering on outcomes and ensure action is taken to address identified capability gaps within the

Make  changes  to  section  on  agreements  to   reflect  emphasis  of  agreements  in  new

The government co ll ect s revenue f rom taxes on capital and labour income and value-added taxes on fina l demand , production taxes on intermediate inputs, and...

Colliers International makes no guarantees, representations or warranties of any kind, expressed or implied, regarding the information including, but not limited to, warranties

• Our goal is to make Pittsburgh Public Schools First Choice by offering a portfolio of quality school options that promote high student achievement in the most equitable and

The only time you should export to MP3 is if your client has requested it, if the video editing software you are using doesn’t support WAV, or if you have a particularly long voice

When you install CIC 2015 R1 or later to the IC Server, a Microsoft Outlook Interaction Desktop Add-in plugin install is added to the IC User Applications (32-bit and 64-bit)

Comments This can be a real eye-opener to learn what team members believe are requirements to succeed on your team. Teams often incorporate things into their “perfect team