Docsity

Multilevel Queue Scheduling in Operating Systems: Issues and Solutions, Slides of Advanced Operating Systems

Partial preview of the text

Download Multilevel Queue Scheduling in Operating Systems: Issues and Solutions and more Slides Advanced Operating Systems in PDF only on Docsity!

  • Lecture No.

Some problems with multilevel queue concept

 Can’t low priority threads starve?

 Ad hoc: when skipped over, increase priority

 What about when past doesn’t predict future?

 e.g., CPU bound switches to I/O bound

 Want past predictions to “age” and count less towards current

view of the world.

Some Unix scheduling problems

 How does the priority scheme scale with number of processes?

 How to give a process a given percentage of CPU?

 OS implementation problem:

 OS takes precedence over user process

 user process can create lots of kernel work: e.g., many network

packets come in, OS has to process. When doing a read or

write system call, ….

Linux Scheduling

 Builds on traditional UNIX multi-level feedback queue scheduler by adding two new scheduling classes.

 Linux scheduling classes:

  • SCHED_FIFO: FCFS real-time threads
  • SCHED_RR: round-robin real-time threads
  • SCHED_OTHER: Other non-real-time threads

Multiple priorities may be used within a class

Priorities in real-time classes are higher than non-real-

time classes.

Linux Scheduling (3)

 SCHED_RR class is similar to SCHED_FIFO except that there is a time-slice associated with an RR thread. On expiry of the time slice, if the thread is still executing, it is pre-empted and another thread from either SCHED_FIFO or SCHED_RR is selected for execution.

 SCHED_OTHER class is managed by the traditional UNIX scheduling algorithms i.e. multi-level feedback queue.

Lottery scheduling: random simplicity

 Problem: this whole priority thing is really ad hoc.

 How to ensure that processes will be equally penalized under load?

 Lottery scheduling! Very simple idea:

 give each process some number of lottery tickets  On each scheduling event, randomly pick ticket  run winning process  to give process P n% of CPU, give it (total tickets)* n%

 How to use?

 Approximate priority: low-priority, give few tickets, high-priority give many  Approximate STCF: give short jobs more tickets, long jobs fewer. Key: If job has at least 1, will not starve

Classifications of Multiprocessor

Systems

 Loosely coupled or distributed multiprocessor, or

cluster

 Each processor has its own memory and I/O channels

 Functionally specialized processors

 Such as I/O processor

 Controlled by a master processor

 Tightly coupled multiprocessing

 Processors share main memory

 Controlled by operating system

Granularity of parallelism

 Coarse and Very Coarse-Grained Parallelism

 Synchronization among processes at a very gross level

(after > 2000 instructions on the average)

 Good for concurrent processes running on a

multiprogrammed uniprocessor

 Can by supported on a multiprocessor with little change