scheduling algorithmic research
Skip this Video
Download Presentation
Scheduling Algorithmic Research

Loading in 2 Seconds...

play fullscreen
1 / 20

scheduling algorithmic research - PowerPoint PPT Presentation

  • Uploaded on

Scheduling Algorithmic Research. Rami Abielmona 94.571 (ELG 6171) Monday March 27, 2000 Prof. T. W. Pearce. Scheduling Algorithms Introduction. Problem definition:

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
Download Presentation

PowerPoint Slideshow about 'scheduling algorithmic research' - Lucy

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
scheduling algorithmic research

Scheduling Algorithmic Research

Rami Abielmona

94.571 (ELG 6171)

Monday March 27, 2000

Prof. T. W. Pearce

scheduling algorithms introduction
Scheduling Algorithms Introduction
  • Problem definition:
    • “One CPU with a number of processes. Only one process can use the CPU at a time and each process is specialized in one, and one task. What’s the best way to organize the processes (schedule them) ?” [1]
    • “How will the CPU time be divided among the processes and threads competing to use it ?” [2]
scheduling algorithms embedded os architecture
Scheduling AlgorithmsEmbedded OS Architecture
  • Kernel:
    • The executor
  • Executive:
    • The manager
  • Application Programs:
    • The programmer tasks
  • Real World Interfacing:
    • S/W handling the H/W
scheduling algorithms basic assumptions
Scheduling AlgorithmsBasic Assumptions
  • A pool of runnable processes are contending for one CPU;
  • The processes are independent and compete for resources;
  • The job of the scheduler is to distribute the scarce resource of the CPU to the different processes “fairly” and in an optimal way;
  • The job of the dispatcher is to provide the mechanism for running the processes;
  • The OS is a multitasking, but not a multiprocessor, one;
  • Only CPU scheduling is considered (the lowest level of scheduling).
scheduling algorithms processes and resources


Take resource away, use it for something else, then give it back. (e.g. processor or I/O channel)


Once give, it can’t be reused until process gives it back. (e.g. file space or terminal)


IO bound:

Perform lots of IO operations.

IO burst ---- short CPU burst to process IO --- IO burst

CPU bound:

Perform lots of computation and do little IO

CPU burst ----------- Small IO burst ----------- CPU burst

Scheduling AlgorithmsProcesses and Resources
scheduling algorithms process state transitions
Scheduling AlgorithmsProcess State Transitions
  • The states of a process, at any given time, is comprised of the following minimal set:
    • Running:
      • The CPU is currently executing the code belonging to the process.
    • Ready:
      • The process could be running, but another process has the CPU.
    • Waiting:
      • Before the process can run, some external event must occur.
scheduling algorithms types of schedulers
Scheduling AlgorithmsTypes of Schedulers
  • Long-term scheduler:
    • admits new processes to the system;
    • required because each process needs a portion of the available memory for its code and data.
  • Medium-term scheduler:
    • is not found in all systems;
    • required to control the temporary removal from memory of a process when the latter is extractable.
  • Short-term scheduler:
    • determines the assignment of the CPU to ready processes;
    • required because of IO requests and completions.
scheduling algorithms the contestants 1
Scheduling AlgorithmsThe Contestants (1)
  • First-Come First-Serve (FCFS)
    • One ready queue;
    • OS runs the process at head of the queue;
    • New processes come in at the end of the queue;
    • Running process does not give up the CPU until it terminates or it performs IO.
  • Round Robin
    • Process runs for one time slice, then moved to back of the queue;
    • Each process gets equal share of the CPU.
scheduling algorithms the contestants 2
Scheduling AlgorithmsThe Contestants (2)
  • Shortest Time to Completion (STCF)
    • Process with shortest computation time left is picked;
    • Varianted by preemption;
    • Requires knowledge of the future.
  • Exponential Queue (Multi-level Feedback)
    • Gives newly runnable processes a high priority and a very short time slice;
    • If process uses up the time slice without blocking then decrease priority by one and double time slice for next time;
    • Solves both efficiency and response time problems.
scheduling algorithms the contestants 3 priorities
Scheduling AlgorithmsThe Contestants (3) - Priorities
  • Priority Systems
    • The highest priority ready process is selected
    • In case of a tie, FCFS can be used
    • Priorities could be assigned:
      • Externally (e.g. by a system manager)
      • Internally (e.g. by some algorithm)
      • Combination of external and internal
    • Preemptive schemes:
      • Once a process starts executing, allow it to continue until it voluntarily yields the CPU
    • Non-preemptive schemes:
      • A running process may be forced to yield the CPU by an external event rather than by its own action
scheduling algorithms first come first serve
Scheduling AlgorithmsFirst-Come First-Serve
  • Non-preemptive FCFS (no priority scheme)
    • Simplest implementation of scheduling algorithms
    • Used on timeshared systems (with timer interruption)
  • Non-preemptive FCFS (with priority scheme)
    • Next highest priority process is picked when CPU is yielded
    • Once process grabs CPU, former keeps latter until completion
    • Rarely used in real-time systems
  • Preemptive FCFS (with priority scheme)
    • Most popular FCFS algorithm
scheduling algorithms round robin
Scheduling AlgorithmsRound Robin
  • Used mostly on timeshared systems
  • Allows multiple users slices of the CPU on a “round robin” basis
  • Majority of users have the same priority
  • Not a popular scheme with dynamic priority systems
scheduling algorithms shortest time to completion
Scheduling AlgorithmsShortest Time to Completion
  • Priorities are assigned in inverse order of time needed for completion of the entire job
  • Minimizes average turnaround time
  • Exponential averaging is used to estimate the process’ burst duration
  • A job exceeding the resource estimation is aborted
  • A job exceeding the time estimation is preempted
  • Store estimated value in PCB for the current burst, and compare with actual value
scheduling algorithms exponential queues
Scheduling AlgorithmsExponential Queues
  • Popular in interactive systems
  • A single queue is maintained for each priority level
  • A new process is added at the end of the highest priority queue
    • It is alloted a single time quantum when it reaches the front
      • If it yields the CPU within the time quantum, it is moved to the rear
      • If not, it is placed at the rear of the next queue down
  • Dispatcher selects the head of the highest priority queue
    • A job that “succeeds” moves up
    • A job that “fails” moves down
scheduling algorithms implementation data structures
Scheduling AlgorithmsImplementation - Data Structures
  • A queue of processes is implemented by linking PCB’s together using a linked list (with first and last node pointers)
  • Since this project’s queues are known to be short, priority is implemented by using priority queues, and PriorityInsert() function calls
  • Different queues are used to represent different states of processes (Ready, Suspended)
  • Self-release of CPU
    • Internal signal
    • Process completion
  • Forced-release of CPU
    • Time slot expired
    • External signal

Process ID



Next Process

scheduling algorithms implementation progress
Scheduling AlgorithmsImplementation - Progress
  • Used an OO template in order to easily and efficiently implement any necessary queue
  • Used structurally defined functions to “simulate” the scheduler and dispatcher
    • fill_poolQ(), get_tasks(src,dest), sort(queue)
  • Implemented FCFS, RR and STCF
    • RR was implemented to fairly compare schemes
  • Theoretical work still needs to be done
    • comparison and evaluation
scheduling algorithms implementation issues
The underlying interrupt system basically readies the task for a switch, but does not perform the switch

Process switches are directly handled by the scheduler

This causes a delay from the time of readiness to the time of the switch, which is not tolerated for, let’s say, system exceptions

The solution is to completely by-pass the scheduler (OS) and go directly to an ISR. [1]

Each process is allocated its own private stack and workspace

This is done to avoid different processes overwriting each other’s data and code

This is based on a strict process model, where all heavyweight processes do not share resources

Code that can be shared safely is called ‘re-entrant’ code [1]

Scheduling AlgorithmsImplementation - Issues
scheduling algorithms implementation analysis
Scheduling AlgorithmsImplementation - Analysis
  • Direct analysis
    • Pick a task set and observe results
  • Apply queueing theory to obtain results
    • Multi-level feedback queue scheme
  • Simulations of scheme implementations
    • FCFS, RR, STCF
  • Innovations and projections
    • “Lottery” scheduling and “own” algorithm
scheduling algorithms references
Scheduling AlgorithmsReferences

1)Cooling, J.E. Software Design for Real-Time Systems. Chapman & Hall, London, UK: 1995.

2) Stallings, William. Operating Systems: Internals and Design Principles. Upper Saddle River, NJ: Prentice Hall, 1998.

3) - viewed on 03/24/2000

4) Savitzky, Stephen. Real-Time Microprocessor Systems. Van Nostrand Reinhold Company, N.Y.: 1985.

5) Undergraduate Operating System Course Notes (Ottawa University, 1998)