g53srp introduction to real time scheduling
Download
Skip this Video
Download Presentation
G53SRP: Introduction to Real Time Scheduling

Loading in 2 Seconds...

play fullscreen
1 / 27

g53srp: introduction to real time scheduling - PowerPoint PPT Presentation


  • 313 Views
  • Uploaded on

G53SRP: Introduction to Real Time Scheduling. Chris Greenhalgh School of Computer Science. Contents. Specifying timing constraints Specifying the system Current system example Tasks, values, time lines General strategy Fixed Priority Scheduling & DMPO Further issues

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

PowerPoint Slideshow about 'g53srp: introduction to real time scheduling' - salena


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
g53srp introduction to real time scheduling

G53SRP: Introduction to Real Time Scheduling

Chris Greenhalgh

School of Computer Science

contents
Contents
  • Specifying timing constraints
  • Specifying the system
  • Current system example
    • Tasks, values, time lines
  • General strategy
    • Fixed Priority Scheduling & DMPO
  • Further issues
    • Modes, fault tolerance, resource contention
  • Book: Wellings 7.5-7.7; Burns & Wellings 13.1-13.3
real time
Real time…
  • A real-time system is any information processing system which has to respond to externally generated input stimuli within a finite and specified period
    • the correctness depends not only on the logical result but also the time it was delivered
specifying timing constraints temporal scopes
Specifying timing constraints: temporal scopes
  • For a section of code (“process”, “task”, “scope”, Java Runnable), specify:
    • When it should (nominally) start
    • When it must be completed by

class Foo implements Runnable {

public void run()

{

}

}

slide5

Minimum delay

Maximum delay

a

Blocking (sleeping,

waiting, I/O),

other task(s) running

Maximum elapsed time

b

c

Units of execution

i.e. actually on CPU

Deadline

Release

Time

Maximum execution time = a + b +c

specifying the system
Specifying the system
  • Decompose into a fixed set of tasks
  • For each task:
    • Specify when it should be started
      • E.g. periodic (repeated, on a timer) or triggered by some other/external event (such as an interrupt)
    • Specify then deadline within which it should finish
      • Timing requirements derived from specification, e.g. system stability requirements
  • Arrange for the system to run those tasks at the right times and in the right order 
concurrency example review

T

P

S

Concurrency Example (review)

ADC

Thermocouples

Pressure

Transducer

  • Overall objective is to keep the temperature and pressure of some chemical process within well-defined limits

ADC

Switch

Heater

Screen

DAC

Pump/Valve

example system processes or tasks
Example system processes (or “tasks”, …)
  • P1 - temperature control task
    • (say) Run once every 100ms
    • Complete within 50ms
  • P2 – pressure control task
    • Run once every 150ms
    • Complete within 100ms
example system abstract time line

Process Release Time

Process Completion Time

Deadline

Possible task

execution

0

50

100

150

200

250

Example system abstract time-line

Process

P1

P2

Time (ms)

more questions
More questions…
  • How long will each task actually take execute?
  • In what order should the tasks be executed?
  • How many processors does the system have?
    • If more than one, on which processor should each task be run?
  • Will the deadlines be met?
more questions example system
More questions…example system
  • How long will each task actually take execute?
    • (say) P1 40ms, P2 60ms
  • In what order should the tasks be executed?
    • (say) P1 before P2
  • How many processors does the system have?
    • (say) 1
  • Will the deadlines be met?
    • See next slide…
example system concrete time line

0

50

100

150

200

250

Example system concrete time-line

Process Release Time

Process

All deadlines met 

Process Completion Time

Deadline met

Process Completion Time

Deadline missed

P1

Actual

task execution

60

50

10

P2

Task waiting/

pre-empted

Time (ms)

example system gantt chart
Example system Gantt Chart

CPU-1

P1

P2

P1

P2

P1

P2

0

50

100

150

200

250

Time (ms)

more questions example system v 2
More questions…example system (v.2)
  • How long will each task actually take execute?
    • (say) P1 40ms, P2 70ms
  • In what order should the tasks be executed?
    • (say) P1 before P2
  • How many processors does the system have?
    • (say) 1
  • Will the deadlines be met?
    • See next slide…
example system v 2 concrete time line

0

50

100

150

200

250

Example system (v.2) concrete time-line

Process Release Time

Process

P2 deadlines missed 

Process Completion Time

Deadline met

Process Completion Time

Deadline missed

P1

Actual

task execution

60

10

50

20

P2

Task waiting/

pre-empted

Time (ms)

more questions example system v 3
More questions…example system (v.3)
  • How long will each task actually take execute?
    • (say) P1 40ms, P2 60ms
  • In what order should the tasks be executed?
    • (say) P2 before P1
  • How many processors does the system have?
    • (say) 1
  • Will the deadlines be met?
    • See next slide…
example system v 3 concrete time line

0

50

100

150

200

250

Example system (v.3) concrete time-line

Process Release Time

Process

First P1 deadline missed 

Process Completion Time

Deadline met

Process Completion Time

Deadline missed

P1

Actual

task execution

60

60

P2

Task waiting/

pre-empted

Time (ms)

general answers 1
General answers… (1)
  • How long will each task actually take execute?
    • i.e. worst-case execution time
    • Determine from static code analysis and/or controlled testing
general answers 2
General answers… (2)
  • In what order should the tasks be executed?

1. Decide a general strategy, (e.g.) fixed priority scheduling

    • Assign a priority to each process in advance and always run the highest-priority runnable process
    • (Want a strategy that is flexible but deterministic and analysable – and supported)
slide20
2. Assign priorities to each process, (e.g.) Shortest Deadline First
  • Also known as Deadline Monotonic Priority Ordering (DPMO)
  • Can be shown to be optimal, i.e. if any strategy works then this will
    • Example system: P1 deadline 40 < P2 deadline 60
general answers 3
General answers… (3)
  • How many processors does the system have? If more than one, on which processor should each task be run?
    • Depends on system design
    • Typically fix tasks to processors for predictability
general answers 4
General answers… (4)
  • Will the deadlines be met?
    • Can be tackled through static analysis of whole system
    • E.g. response time analysis - see later notes
      • Note: equivalent to example time-line with all processes released at time zero
    • N.B. this is what we were after: predictable timing behaviour
further issues modes
Further issues: modes
  • Many systems have different “modes” of operation
    • e.g. start-up, active, shut-down
    • Each may have its own
      • Specified process set
      • Timing parameters
      • Priorities
      • Scheduling analysis
    • Plus changes between modes must be checked
further issues fault tolerance
Further issues: fault tolerance
  • What if the running system does…
    • Miss a deadline?
    • Use more processor time than it should?
  • System may
    • Detect missed deadlines or cost overrun
    • Interrupt or suspect that process
    • Call an error handler, to take contingency actions
further issues resource contention
Further issues: resource contention
  • If processes
    • share resources (e.g. common data or devices)
    • and require exclusive access (i.e. locks)

then this must be taken into account when

    • setting process priorities
      • perhaps dynamically – see later notes
    • analysing the system’s schedulability
      • may introduce additional process blocking
summary
Summary
  • A real-time system is comprised of tasks or processes with specified timing constraints
    • When/how often it should happen
    • When it should finish by (deadline)
    • How long it would take in isolation (cost)
  • The real-time system schedules these tasks
    • e.g. using fixed priority scheduling and deadline-monotonic priority ordering
summary 2
Summary (2)
  • On- or off-line analysis of the system can then determine whether deadlines should be met or not
  • Missed deadlines or cost over-runs may be detected, allowing the system to respond to failures (fault tolerance)
  • Scheduling and analysis may be complicated by (e.g.) system modes or contention for shared resources
ad