Time Quantum and Context Switch Time - PowerPoint PPT Presentation

1 / 21
About This Presentation
Title:

Time Quantum and Context Switch Time

Description:

Silberschatz, Galvin and Gagne 2005. Operating System Concepts ... requires that critical processes receive priority over less fortunate ones ... – PowerPoint PPT presentation

Number of Views:156
Avg rating:3.0/5.0
Slides: 22
Provided by: marily186
Category:

less

Transcript and Presenter's Notes

Title: Time Quantum and Context Switch Time


1
Time Quantum and Context Switch Time
2
Turnaround Time Varies With The Time Quantum
3
Multilevel Queue
  • Ready queue is partitioned into separate
    queuesforeground (interactive)background
    (batch)
  • Each queue has its own scheduling algorithm
  • foreground RR
  • background FCFS
  • Scheduling must be done between the queues
  • Fixed priority scheduling (i.e., serve all from
    foreground then from background). Possibility of
    starvation.
  • Time slice each queue gets a certain amount of
    CPU time which it can schedule amongst its
    processes i.e., 80 to foreground in RR
  • 20 to background in FCFS

4
Multilevel Queue Scheduling
5
Multilevel Feedback Queue
  • A process can move between the various queues
    aging can be implemented this way
  • Multilevel-feedback-queue scheduler defined by
    the following parameters
  • number of queues
  • scheduling algorithms for each queue
  • method used to determine when to upgrade a
    process
  • method used to determine when to demote a process
  • method used to determine which queue a process
    will enter when that process needs service

6
Example of Multilevel Feedback Queue
  • Three queues
  • Q0 time quantum 8 milliseconds
  • Q1 time quantum 16 milliseconds
  • Q2 FCFS
  • Scheduling
  • A new job enters queue Q0 which is served FCFS.
    When it gains CPU, job receives 8 milliseconds.
    If it does not finish in 8 milliseconds, job is
    moved to queue Q1.
  • At Q1 job is again served FCFS and receives 16
    additional milliseconds. If it still does not
    complete, it is preempted and moved to queue Q2.

7
Multilevel Feedback Queues
8
Multiple-Processor Scheduling
  • CPU scheduling more complex when multiple CPUs
    are available
  • Homogeneous processors within a multiprocessor
  • Load sharing
  • Asymmetric multiprocessing only one processor
    accesses the system data structures, alleviating
    the need for data sharing
  • Load balancing techniques (need not be mutually
    exclusive)
  • Push migration (process migration to idle CPUs)
  • Pull migration (idle CPUs offload busy CPUs on
    imbalance)

9
Symmetric Multiprocessor (SMP) Scheduling
10
Asymmetric Multiprocessor (ASMP) Scheduling
Compute Node
11
Real-Time Scheduling
  • 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

12
Thread Scheduling
  • Levels of threads
  • User level threads managed by a thread library
    (higher level) and scheduled (based on, e.g.,
    priorities to a designated kernel thread or a
    LWP)
  • Kernel level threads managed and scheduled by
    the OS to the actual CPU (hardware)
  • Process-contention scope (PCS)
  • Scheduling technique used to schedule user-level
    threads belonging to the same process
  • System-contention scope (SCS)
  • Scheduling technique used to schedule
    kernel-level threads to the CPUs
  • E.g., POSIX, Pthread scheduling uses the
    following APIs See Fig 5.9
  • pthread_attr_setscope(pthread_attr_t attr, int
    scope)
  • pthread_attr_getscope(pthread_attr_t attr, int
    scope)

13
Solaris 2 Scheduling
14
5.11
15
Windows XP Priorities
16
Linux Scheduling
  • Two algorithms time-sharing and real-time
  • Time-sharing
  • Prioritized credit-based process with most
    credits is scheduled next
  • Credit subtracted when timer interrupt occurs
  • When credit 0, another process chosen
  • When all processes have credit 0, recrediting
    occurs
  • Based on factors including priority and history
  • Real-time
  • Soft real-time
  • Posix.1b compliant two classes
  • FCFS and RR
  • Highest priority process always runs first

17
Linux Scheduling priorities vs t-slices
Each processor maintains its own runqueue for
designated tasks
18
Linux Scheduling
As an SMP system, Linux processors schedule all
tasks, first, from the active array, and, then
switch to the expired array when all time
slices expire and get reset.
19
Algorithm Evaluation
  • Deterministic modeling takes a particular
    predetermined workload and defines the
    performance of each algorithm for that workload
  • Queueing models
  • Implementation

20
Evaluation of CPU Schedulers by Simulation
21
End of Chapter 5
Write a Comment
User Comments (0)
About PowerShow.com