Sie sind auf Seite 1von 16

Embedded Systems Design

Program: MS (Electrical Engineering)


Semester: Spring 2019

Lecture 05
Instructor: Dr. Khurram Bhatti
Assistant Professor

khurram.bhatti@itu.edu.pk

Dr. M. Khurram Bhatti Embedded Systems, Spring’19, ITU, Lahore www.itu.edu.pk

Real-time Embedded Systems

Handling Hybrid Task Sets


Fixed Priority Servers

2 Dr. M. Khurram Bhatti Embedded Systems, Spring’19, ITU, Lahore

1
Real-time Embedded Systems
§  Fixed Priority Servers
§  Task Systems
§  Homogeneous Task Systems: Where all computational
activities are of the same type (Periodic for instance)

§  Hybrid Task Systems: Where the computational activities are of


different type

§  In a Hybrid Task System, Real-time control applications may


have different types of tasks (Periodic, Aperiodic, Sporadic)
and they may also differ for their criticality.

3 Dr. M. Khurram Bhatti Embedded Systems, Spring’19, ITU, Lahore

Real-time Embedded Systems


§  Fixed Priority Servers
§  Hybrid Task Systems
§  Periodic Tasks:
§  Homogeneous or Identical sets of jobs that recur at strict periodic
interval

§  Aperiodic Tasks:
§  Tasks do not have a period parameter. No prior knowledge of
their arrival to the system designer.

§  Sporadic Tasks:
§  Tasks are not released at strict periodic intervals of time. The
parameter Period indicates the minimum inter-arrival time
between two successive jobs
4 Dr. M. Khurram Bhatti Embedded Systems, Spring’19, ITU, Lahore

2
Real-time Embedded Systems
§  Fixed Priority Servers
§  Hybrid Task Systems
§  Periodic Tasks:
§  Periodic tasks are time-driven and execute critical control activities
with hard timing constraints

§  Aperiodic Tasks:
§  Aperiodic tasks are usually event-driven and may have hard, soft,
or non-real-time requirements depending on the specific
application.

5 Dr. M. Khurram Bhatti Embedded Systems, Spring’19, ITU, Lahore

Real-time Embedded Systems


§  Fixed Priority Servers
§  Hybrid Task Systems
§  Objective:
§  To simultaneously handle Periodic as well as Aperiodic
tasks at runtime, which may have different levels of
criticality

§  To guarantee the schedulability of all critical tasks in worst-


case conditions and provide good average response times
for soft and non-real-time activities, along with hard and
real-time activities (tasks)

§  Fixed Priority Servers do this!

6 Dr. M. Khurram Bhatti Embedded Systems, Spring’19, ITU, Lahore

3
Real-time Embedded Systems
§  Fixed Priority Servers
§  Hybrid Task Systems
§  Schedulability of Hybrid Systems
§  Off-line guarantee of event-driven aperiodic tasks with
critical timing constraints can be done only by assuming a
maximum arrival rate for each critical event

§  Problem: Aperiodic tasks have no periodicity!

§  Online guarantee of event-driven Aperiodic tasks can be


provided for each instance (job) individually through an
acceptance test!

7 Dr. M. Khurram Bhatti Embedded Systems, Spring’19, ITU, Lahore

Real-time Embedded Systems


§  Fixed Priority Servers
§  Hybrid Task Systems
§  Background Schedulability
§  Simplest method to handle a set of soft Aperiodic activities
in the presence of periodic tasks

§  Run Aperiodic tasks when there is no periodic task ready

§  For high periodic loads, the response time of Aperiodic


requests can be too long.

§  Background scheduling can be adopted only when the


Aperiodic activities do not have stringent timing constraints
and the periodic load is not high.

8 Dr. M. Khurram Bhatti Embedded Systems, Spring’19, ITU, Lahore

4
Real-time Embedded Systems
§  Fixed Priority Servers
§  Hybrid Task Systems
§  Background Schedulability –Example
§  Two periodic tasks to be scheduled under RM such that
U=0.73 (which is less than U(2) < 0.83)

§  Two Aperiodic tasks to be scheduled in the background

9 Dr. M. Khurram Bhatti Embedded Systems, Spring’19, ITU, Lahore

Real-time Embedded Systems


§  Fixed Priority Servers
§  Hybrid Task Systems
§  Background Schedulability –Example
§  Tasks are taken from the Aperiodic queue only when the
periodic queue is empty.
§  Activation of a new periodic instance causes any Aperiodic
tasks to be immediately preempted.
§  The two queuing strategies are independent and can be
realized by different algorithms

10 Dr. M. Khurram Bhatti Embedded Systems, Spring’19, ITU, Lahore

5
Real-time Embedded Systems
§  Fixed Priority Servers
§  Hybrid Task Systems
§  Background Schedulability –Example

11 Dr. M. Khurram Bhatti Embedded Systems, Spring’19, ITU, Lahore

Real-time Embedded Systems


§  Fixed Priority Servers
§  Hybrid Task Systems
§  Servers
§  Used in hybrid task systems to improve average response time
of Aperiodic tasks
§  A server is a periodic task whose purpose is to service
Aperiodic requests as soon as possible
§  A server runs as a periodic task along with other periodic tasks
in the system
§  Server possesses the same parameters as other periodic
tasks. Such as: a period and a WCET (C)
§  WCET for servers is called the capacity or budget of server
12 Dr. M. Khurram Bhatti Embedded Systems, Spring’19, ITU, Lahore

6
Real-time Embedded Systems
§  Fixed Priority Servers
§  Hybrid Task Systems
§  Servers
§  The server is scheduled with the same algorithm used for
scheduling other periodic tasks

§  Once active, it serves the Aperiodic requests within the limit of


its budget

§  The ordering of Aperiodic requests does not depend on the


scheduling algorithm used for periodic tasks

13 Dr. M. Khurram Bhatti Embedded Systems, Spring’19, ITU, Lahore

Real-time Embedded Systems


§  Fixed Priority Servers
§  Hybrid Task Systems
§  Servers
§  Polling Servers (PS)
§  Deferrable Servers (DS)
§  Priority Exchange (PE) Algorithm

14 Dr. M. Khurram Bhatti Embedded Systems, Spring’19, ITU, Lahore

7
Real-time Embedded Systems
§  Fixed Priority Servers
§  Hybrid Task Systems
§  Polling Servers (PS)
§  Polling Server is an algorithm in which, server task appears at
regular intervals to serve the pending Aperiodic jobs (if any)

§  Once active, PS serves the pending Aperiodic task ONLY


within the limit of its capacity (C)

§  If no Aperiodic requests are pending, PS suspends itself until


the beginning of its next period, and its budget is discharged
and given to periodic tasks
15 Dr. M. Khurram Bhatti Embedded Systems, Spring’19, ITU, Lahore

Real-time Embedded Systems


§  Fixed Priority Servers
§  Hybrid Task Systems
§  Polling Servers (PS) –Example (RM schedule)
§  Polling Server has been allocated a budget/capacity of 2 time
units (WCET) after every 5 time units (periodicity)
§  Once PS capacity is finished, Aperiodic request must wait until
the beginning of the next period, when the server capacity is
replenished at its full value.

To Do:
•  Run T1 & T2 with RM

16 Dr. M. Khurram Bhatti Embedded Systems, Spring’19, ITU, Lahore

8
Real-time Embedded Systems
§  Fixed Priority Servers
§  Hybrid Task Systems
§  Polling Servers (PS) –Example (RM schedule)

17 Dr. M. Khurram Bhatti Embedded Systems, Spring’19, ITU, Lahore

Real-time Embedded Systems


§  Fixed Priority Servers
§  Hybrid Task Systems
§  Polling Servers (PS) –Example
§  At time t = 0, the processor is assigned to task T1, which is the highest-priority task according to
RM.
§  At time t = 1, T1 completes its execution and the processor is assigned to PS.
§  However, since no aperiodic requests are pending, the server suspends itself and its capacity is
used by periodic tasks.
§  As a consequence, the Aperiodic request arriving at time t = 2 cannot receive immediate service
but must wait until the beginning of the second server period (t = 5).
§  At t=5, the capacity is replenished at its full value (C = 2) and used to serve the Aperiodic task
until completion. Note that, since the capacity has been totally consumed, no other Aperiodic
requests can be served in this period; thus, the server becomes idle.
§  Second Aperiodic request receives the same treatment.
§  Since the second request only uses half of the server capacity, the remaining half is discarded
because no other Aperiodic tasks are pending.
§  At time t = 16, the third Aperiodic request is preempted by task T1, and the server capacity is
preserved.
18 Dr. M. Khurram Bhatti Embedded Systems, Spring’19, ITU, Lahore

9
Real-time Embedded Systems
§  Fixed Priority Servers
§  Hybrid Task Systems
§  Polling Servers (PS) –Example-2 (RM schedule)

3
1 6
8
4 10

2 1 3
1 5 11

19 Dr. M. Khurram Bhatti Embedded Systems, Spring’19, ITU, Lahore

Real-time Embedded Systems


§  Fixed Priority Servers
§  Hybrid Task Systems
§  Polling Servers (PS) –Example-3 (RM schedule)

2
2 7
8
3 9

Aperiodic Jobs
1 2 3
1 6 11

20 Dr. M. Khurram Bhatti Embedded Systems, Spring’19, ITU, Lahore

10
Real-time Embedded Systems
§  Fixed Priority Servers
§  Hybrid Task Systems
§  Polling Servers (PS) –Schedulability analysis
§  Schedulability test for Periodic Tasks is the same as under RM

§  Polling server creates interference with periodic tasks at


periodic intervals

§  In the best case, such an interference is zero as there are no


Aperiodic tasks present to consume the budget of Polling
Server

§  In the worst case, such an interference is the same as the one


introduced by an equivalent periodic task having a period equal
to TS and a computation time equal to Cs.
21 Dr. M. Khurram Bhatti Embedded Systems, Spring’19, ITU, Lahore

Real-time Embedded Systems


§  Fixed Priority Servers
§  Hybrid Task Systems
§  Polling Servers (PS) –Schedulability analysis
§  Schedulability Analysis is based on the worst-case!

§  Independent of the number of Aperiodic tasks handled by the


PS, a maximum time equal to Cs is dedicated to Aperiodic
requests at each server period.

§  As a consequence, the processor utilization factor of the PS is


Us = Cs/Ts, and hence the Schedulability of a periodic set with n
tasks and utilization Up can be guaranteed if

22 Dr. M. Khurram Bhatti Embedded Systems, Spring’19, ITU, Lahore

11
Real-time Embedded Systems
§  Fixed Priority Servers
§  Hybrid Task Systems
§  Polling Servers (PS) –Guarantees for Aperiodic jobs
§  In order to possibly perform an online guarantee of Aperiodic
tasks, RESPONSE TIME Analysis of Aperiodic jobs can be
used!

§  For single Aperiodic task with (ra, Ca, Da)

§  Since, in the worst case, the job can wait for at most one
period before receiving service, if Ca ≤ Cs , the request is
completed within two server periods.

2Ts ≤ Da
23 Dr. M. Khurram Bhatti Embedded Systems, Spring’19, ITU, Lahore

Real-time Embedded Systems


§  Fixed Priority Servers
§  Hybrid Task Systems
§  Polling Servers (PS) –Guarantees for Aperiodic jobs
§  For single Aperiodic task with (ra, Ca, Da)

§  For arbitrary computation times fo Aperiodic jobs, the Aperiodic


request is certainly completed in ⌈ Ca /Cs ⌉server periods.

§  Hence, it is guaranteed if

24 Dr. M. Khurram Bhatti Embedded Systems, Spring’19, ITU, Lahore

12
Real-time Embedded Systems
§  Fixed Priority Servers
§  Hybrid Task Systems
§  Polling Server (PS) Limitations
§  PS is generally low or intermediate priority task

§  Causes larger response time for Aperiodic Tasks (they need


to wait longer)

§  PS loses its capacity if no Aperiodic job is waiting for them

§  Therefore, Aperiodic job must be already present in the


Aperiodic Task Queue.

25 Dr. M. Khurram Bhatti Embedded Systems, Spring’19, ITU, Lahore

Real-time Embedded Systems


§  Fixed Priority Servers
§  Hybrid Task Systems
§  Deferrable Servers (DS)
§  The Deferrable Server (DS) algorithm is a service technique
introduced (in 1995) to improve the average response time of
Aperiodic requests with respect to PS

§  As the PS, the DS algorithm creates a periodic task for


servicing Aperiodic requests

§  Usually DS task have a high priority

§  Unlike polling, DS preserves its capacity if no requests are


pending upon the invocation of the server.

26 Dr. M. Khurram Bhatti Embedded Systems, Spring’19, ITU, Lahore

13
Real-time Embedded Systems
§  Fixed Priority Servers
§  Hybrid Task Systems
§  Deferrable Servers (DS)
§  In DS, the capacity or Budget is maintained until the end of the
period

§  Aperiodic requests can be serviced at the same server s


priority at anytime, as long as the capacity has not been
exhausted.

§  At the beginning of any server period, the capacity is


replenished at its full value.

27 Dr. M. Khurram Bhatti Embedded Systems, Spring’19, ITU, Lahore

Real-time Embedded Systems


§  Fixed Priority Servers
§  Hybrid Task Systems
§  Deferrable Servers (DS) –Example-1 (RM Schedule)

28 Dr. M. Khurram Bhatti Embedded Systems, Spring’19, ITU, Lahore

14
Real-time Embedded Systems
§  Fixed Priority Servers
§  Hybrid Task Systems
§  Deferrable Servers (DS) –Example-1
§  At time t = 1, when T1 is completed, no Aperiodic requests are pending. Hence, the processor
is assigned to task T2.

§  However, the DS capacity is not used for periodic tasks, but it is preserved for future Aperiodic
arrivals.

§  Thus, when the first Aperiodic request arrives at time t = 2, it receives immediate service.

§  Since the capacity of the server is exhausted at time t = 4, no other requests can be serviced
before the next period.

§  At time t = 5, Cs is replenished at its full value and preserved until the next arrival.

§  The second request arrives at time t = 8, but it is not served immediately because T1 is active
and has a higher priority.

29 Dr. M. Khurram Bhatti Embedded Systems, Spring’19, ITU, Lahore

Real-time Embedded Systems


§  Fixed Priority Servers
§  Hybrid Task Systems
§  Deferrable Servers (DS) –Exercise (RM schedule)

3
1 5
8
4 12

1 2 3
1 7 10

30 Dr. M. Khurram Bhatti Embedded Systems, Spring’19, ITU, Lahore

15
Real-time Embedded Systems
§  Fixed Priority Servers
§  Hybrid Task Systems
§  Deferrable Servers (DS) –Exercise (RM schedule)

2
2 5
8
3 10

3 3 1
2 7 11

31 Dr. M. Khurram Bhatti Embedded Systems, Spring’19, ITU, Lahore

Real-time Embedded Systems


§  Fixed Priority Servers
§  Hybrid Task Systems
§  Deferrable Servers (DS)
§  DS provides much better Aperiodic responsiveness than
polling server since it preserves the capacity until it is needed.

§  Shorter response times can be achieved by creating a


Deferrable Server having the highest priority among the
periodic tasks.

32 Dr. M. Khurram Bhatti Embedded Systems, Spring’19, ITU, Lahore

16

Das könnte Ihnen auch gefallen