Question 1 - PowerPoint PPT Presentation

1 / 36
About This Presentation
Title:

Question 1

Description:

Simplicity of implementation (a priori information) Addresses concerns: ... Need a priori knowledge of use of resources. Time-Demand Analysis: ... – PowerPoint PPT presentation

Number of Views:51
Avg rating:3.0/5.0
Slides: 37
Provided by: AmyLa3
Category:
Tags: priori | question

less

Transcript and Presenter's Notes

Title: Question 1


1
Question 1
  • Use time-demand analysis to show whether or not
    the RM scheduler can feasibly schedule the
    following tasks. Show your work.
  • T1 (6,3) T2 (9,4) T3 (20,1).

2
Question 2
  • Consider the following system of fixed-priority
    tasks and write the time-demand functions w3(t)
    of T3 AND w5(t) of T5.
  • T1 (10,2) T2 (14,2) T3 (15,3) T4
    (50,1) T5 (24,3)
  • Assume a context switch takes 0.1 unit time.
  • T3 can self-suspend twice for 1 unit of time
    each,
  • T4 contains a nonpreemptable section with
    execution time 0.3, and
  • T5 contains a nonpreemptable section with
    execution time 0.5.

3
Question 3
  • Consider the following tasks given in (?,p,e,D)
    form that are scheduled using the RM algorithm
  • T1 (0,2,0.5,4) T2 (0,3,1.3,10) T3
    (0,5,1.0,10)
  • For which job(s) of task 3 do you need to
    calculate the worst (i.e. maximum) response time
    to verify schedulability? How did you determine
    this?

4
Question 4
  • RM algorithm T1 (15,3) T2 (25,2.5) T3
    (35,7)
  • If aperiodic tasks are scheduled with a simple
    sporadic server with period 20, what is the
    maximum execution budget?
  • If T3 has a nonpreemptable critical section of
    length 5 time units and aperiodic tasks are
    scheduled with a deferrable server with period
    20, what is the maximum execution budget?

5
Ch 6 Sample Problems
  • 6.9. (3,1) (4,2) (6,1)
  • graph time-demand
  • schedulable
  • graph used to determine schedulability of
    arbitrary priority-driven algorithm?
  • 6.11. (5,1) (3,1) (8,1.6) (18,3.5)
  • solve for maximum response time of w4(t) by
    solving iteratively.
  • 6.15. (3,1) (5,2) (8,3)
  • reduce execution time of task 3 to achieve
    schedulability using EDF.
  • 6.21. (5,1) (8,2) (14,3) RM algorithm
  • first x units of (8,2) nonpreemptable, what is
    the max x for it to remain schedulable?

6
Ch 7 Sample Problems
  • 7.1. (2.5,1) (4,0.5) (5, 0.75) periodic server
    (2,0.5). RM algorithm
  • S1(3,0.75) and S2(7.5,0.6)
  • response times of S1 and S2 using polling server
  • response times of S1 and S2 using sporadic server
  • response times of S1 and S2 using deferrable
    server
  • modify periodic server to (1,0.25) keeping
    utilization same)
  • response times of S1 and S2 using sporadic server
  • response times of S1 and S2 using deferrable
    server
  • more interesting problem periodic server (4,1).
  • response times improved ??

7
Ch 7 Sample Problems
  • 7.3. (10,2) (14,3) (21,4) periodic server ps
    8.
  • RM algorithm
  • if server deferrable, maximum execution time of
    server?
  • if server sporadic, maximum execution time of
    server?
  • EDF algorithm
  • if server total bandwidth, maximum server size?

8
Ch 7 Sample Problems
  • Determine if each of the following sporadic jobs
    will be accepted given tasks (10,3) (12,3)(20,5)
    scheduled with EDF.
  • (2,1,8)
  • (3,2,15)
  • (7,1,13)
  • Determine if each of the following sporadic jobs
    will be accepted given tasks (10,3) (12,3)(20,5)
    scheduled with RM.
  • (2,1,8)
  • (3,2,15)
  • (7,1,13)

9
Priority Scheduling
  • Assigning Priority
  • task-level fixed (RM, DM)
  • task-level dynamic, job-level fixed (EDF)
  • Schedulability Test
  • Schedulable (Breakdown) Utilization
  • Time-Demand Analysis
  • Assumptions
  • Preemptable at any time.
  • No self-suspension.
  • Independence.

10
Non-Preemptability and Self-Suspension
  • Priority Inversion task of lower priority
    executing while higher priority task waits.
  • Blocking Time time higher priority task waits
    while lower priority task executing.

11
Consequences of Blocking
  • Job waits (self-suspends) until resource
    available,
  • thus it is blocked by another job.
  • If you use self-suspension exclusively
  • to control access to resources
  • BAD THINGS CAN HAPPEN
  • Unbounded priority inversion wait is
    potentially infinite.
  • Deadlock job A waits for job B, job B waits for
    job A.

12
Unbounded Priority Inversion
13
Unbounded Priority Inversion
14
Deadlock
  • Critical sections can be nested, thus jobs can
    hold locks to multiple resources at one time.

J1
J2
J1
J2
15
Sharing Resources Control Protocols
  • Resource Access Control Protocols
  • Nonpreemptive Critical Section (NPCS)
  • Basic Priority-Inheritance Protocol
  • Basic Priority-Ceiling Protocol
  • Stack-Based, Priority-Ceiling (Ceiling-Priority)
    Protocol
  • Distinguished by
  • Scheduling Rule
  • Allocation Rule
  • Priority Rule
  • Implementation
  • Priority Algorithm (fixed or dynamic)
  • Simplicity of implementation (a priori
    information)
  • Addresses concerns
  • Unbounded Priority Inversion
  • Deadlock
  • Blocking Time

16
Nonpreemptive Critical Sections (NPCS)
  • Job locks resource and hogs processor.
  • Rules of NPCS
  • Scheduling Rule
  • Ready jobs scheduled on the processor
    preemptively (but nonpreemptively when using a
    resource).
  • Allocation Rule
  • Jobs granted resource when requested. (Resource
    guaranteed to be free at time of request.)
  • Priority Rule
  • Priority set to MAX when using resource
    (effectively running nonpreemptively).

17
NPCS
Fig 8-7a
18
NPCS Good and Bad
  • Job locks resource and hogs processor.
  • GOOD
  • Simple
  • No deadlock.
  • No unbounded priority inversion
  • No prior knowledge about resources.
  • Works with fixed and dynamic priorities.
  • (especially good for short critical sections with
    high contention)
  • BAD
  • Tasks blocked even when no contention exists.
  • Time-Demand Analysis
  • Each task blocked by at most 1 task of lower
    priority
  • Block time added to time-demand wi
  • bi(rc) ?Tk i lt k ? n max (ck)
  • (i.e. max exec time while locking resource)

19
Problem with NPCS
Fig 8-7a
20
Basic Priority Inheritance Protocol
R resource J job holding resource JB job
requesting resource
  • Rules of Basic Priority Inheritance
  • Scheduling Rule
  • Ready jobs scheduled preemptively at assigned
    priority except as indicated by priority rule.
  • Allocation Rule
  • if resource free, allocate.
  • else, block.
  • Priority Rule
  • if JB blocked by J, J inherits current priority
    of JB.
  • once R released, returns to priority at time of
    acquiring R.
  • J gets resource R
  • JB requests resource R, but blocked
  • J inherits current priority of JB

21
Fixing NPCS with Priority Inheritance
22
Example of Basic Priority Inheritance Protocol
When job JB blocked by J due to resource R, J
inherits current priority of JB When job J
releases R, priority of J returns to priority at
time of blocking JB
23
Listing Resource Access
24
Basic Priority Inheritance Protocol and Deadlock
DOES NOT PREVENT DEADLOCK
25
Basic Priority-Inheritance Protocol Good and Bad
  • When lower priority job blocks, it inherits
    priority of blocked job.
  • GOOD
  • No unbounded priority inversion
  • Simple
  • No prior knowledge required
  • Works with fixed and dynamic priorities.
  • BAD
  • Deadlock.
  • Blocking of jobs not in resource contention.
  • Blocking time could be better. (Fig 8.10)
  • Time-Demand Analysis
  • Fig. 8-9
  • v resources, k lower priority jobs in conflict
  • min(v,k)(length of critical section)

26
Worst-Case Block Time
27
Basic Priority Ceiling Protocol
  • Ceiling of Resource Ri ?(Ri) max priority of
    all jobs needing Ri
  • Ceiling of System ?(t) max ceiling of all
    resources in use at time t
  • Resource allocated only when
  • Scheduling
  • Ready jobs scheduled preemptively at assigned
    priority except as indicated by priority rule.
  • Allocation
  • if resource locked, job is blocked.
  • if resource free
  • if ?(job) gt ? (t) allocate
  • else if job holding some Ri s.t. ?(t) ?(Ri)
    allocate
  • else block
  • Priority Inheritance
  • J inheriets current ?(JB)
  • When job releases all resources with ?(Ri)
    ?(t),
  • job returns to priority at time of acquiring
    resource(s).

28
Example of Basic Priority Ceiling Protocol
29
Basic Priority Ceiling and Deadlock
  • Allocation
  • if resource locked, job is blocked.
  • if resource free
  • if ?(j) gt ? (t) allocate
  • else if job holding some Ri s.t. ?(t) ?(Ri)
    allocate
  • else block
  • At any time t, if ?i(j) gt ?(t) then
  • job Ji will not require any resource currently in
    use
  • any Jk with ?k gt ?j will not require any resource
    currently in use
  • In other words
  • no job currently holding a resource can inherit a
    higher priority and preempt Ji

30
Basic Priority Ceiling and Deadlock
Preventing Deadlock
31
Basic Priority-Ceiling Protocol Good and Bad
  • Lower priority job inherits priority of blocked
    job.
  • Job may be denied resource even when available.
  • GOOD
  • No deadlock.
  • No unbounded priority inversion.
  • Blocking time reduced. (Review Fig. 8-9)
  • BAD
  • Priorities are fixed.
  • Need a priori knowledge of use of resources.
  • Time-Demand Analysis
  • Blocking Time Described in Section 8.5.4

32
Stack-Based, Priority-Ceiling Protocol
  • Simpler protocol.
  • All tasks can share run-time stack.
  • Scheduling
  • jobs scheduled preemptively by assigned priority
    except as indicated by priority rule.
  • Allocation
  • allocate resource whenever requested
  • Priority
  • ?i max ?(Rk) of all resources held by Ji

33
Stack-Based Protocol
34
Basic Priority Ceiling vs Stack-Based Protocol
35
Stack-Based, Priority-Ceiling Protocol Good and
Bad
  • Lower priority job inherits priority of blocked
    job.
  • Job may be denied resource even when available.
  • GOOD
  • Simple.
  • Shared run-time stack.
  • Reduced Context-Switching
  • No deadlock.
  • No unbounded priority inversion.
  • BAD
  • Jobs cannot self-suspend.
  • Priorities are fixed.
  • Need a priori knowledge of use of resources.
  • Time-Demand Analysis
  • Blocking Time Described in Section 8.5.4

36
Sharing Resources Control Protocols
  • Resource Access Control Protocols
  • Nonpreemptive Critical Section (NPCS)
  • Basic Priority-Inheritance
  • Basic Priority-Ceiling Protocol
  • Stack-Based, Priority-Ceiling (Ceiling-Priority)
    Protocol
  • Distinguished by
  • Scheduling Rule
  • Allocation Rule
  • Priority Rule
  • Implementation
  • Priority Algorithm (fixed or dynamic)
  • Simplicity of implementation (a priori
    information)
  • Addresses concerns
  • Unbounded Priority Inversion
  • Deadlock
  • Blocking Time
Write a Comment
User Comments (0)
About PowerShow.com