• Home
  • Textbooks
  • Real-Time Systems and Programming Languages: Ada, Real-Time Java and C/Real-Time POSIX
  • Scheduling real-time systems

Real-Time Systems and Programming Languages: Ada, Real-Time Java and C/Real-Time POSIX

Alan Burns, Andy Wellings

Chapter 11

Scheduling real-time systems - all with Video Answers

Educators


Chapter Questions

Problem 1

Three logical tasks $P, Q$ and $S$ have the following characteristics. $P$ : period 3, required execution time $1 ; Q$ : period 6, required execution time $2 ; S$ : period 18 , required execution time 5 .
Show how these tasks can be scheduled using the rate monotonic scheduling algorithm.
Show how a cyclic executive could be constructed to implement the three logical tasks.

Check back soon!

Problem 2

Consider three tasks $P, Q$ and $S . P$ has a period of $100 \mathrm{~ms}$ in which it requires $30 \mathrm{~ms}$ of tasking. The corresponding values for $Q$ and $S$ are $(5,1)$ and $(25,5)$ respectively. Assume that $P$ is the most important task in the system, followed by $S$ and then $Q$.
(1) What is the behaviour of the scheduler if priority is based on importance?
(2) What is the processor utilization of $P, Q$ and $S$ ?
(3) How should the tasks be scheduled so that all deadlines are met?
(4) Illustrate one of the schemes that allows these tasks to be scheduled.

Check back soon!

Problem 3

To the above task set is added a fourth task $(R)$. Failure of this task will not lead to safety being undermined. $R$ has a period of $50 \mathrm{~ms}$, but has a processing requirement that is data dependent and varies from 5 to $25 \mathrm{~ms}$. Discuss how this task should be integrated with $P, Q$ and $S$.

Check back soon!
02:04

Problem 4

Figure 11.13 illustrates the behaviour of four periodic tasks $w, x, y$ and $z$. These tasks have priorities determined by the rate monotonic scheme, with the result that $\operatorname{priority}(w)>\operatorname{priority}(x)>\operatorname{priority}(y)>\operatorname{priority}(z)$.
Each task's period starts at time $S$ and terminates at $T$. The four tasks share two resources that are protected by binary semaphores $A$ and $B$. On the diagram the $\operatorname{tag} A$ (and $B$ ) implies 'do a wait operation on the semaphore'; the tag $A^{\prime}$ (and $B^{\prime}$ ) implies 'do a signal operation on the semaphore'. Table 11.23 summarizes the task's requirements.
The figure shows the execution histories of the four tasks using static priorities. For example, $x$ starts at time 2, executes a successful wait operation on $B$ at time 3 but unsuccessfully waits on $A$ at time 4 ( $z$ has already locked $A$ ). At time 13 it executes again (that is, it now has lock on $A$ ), it releases $A$ at time 14 and $B$ at time 15 . It is now preempted by $w$, but executes again at time 16 . Finally it terminates at time 17.
Redraw Figure 11.13 to illustrate the behaviour of these tasks if priority inheritance is employed.
GRAPH CAN'T COPY.

$$
\begin{array}{ccccc}
\hline \text { Task } & \text { Priority } & \text { Start time } & \text { Required processor time } & \text { Semaphores used } \\
\hline w & 10 & 7 & 4 & A, B \\
x & 8 & 2 & 5 & A, B \\
y & 6 & 5 & 4 & - \\
z & 4 & 0 & 5 & A \\
\hline
\end{array}
$$

Samriddhi Singh
Samriddhi Singh
Numerade Educator

Problem 5

Redraw the figure given in Exercise 11.4 to illustrate the behaviour of these tasks if immediate priority ceiling inheritance is employed.

Check back soon!

Problem 6

With the priority ceiling protocol, it is possible to calculate the maximum time any task can be blocked by the operation of a lower-priority task. What is the rule for calculating this blocking? Illustrate the answer by calculating the maximum blocking time for each task in the following example. A program consists of five tasks, $a, b, c, d, e$ (these are listed in priority order with $a$ having the highest priority), and six resources $R 1, \ldots, R 6$ (protected by semaphores implementing the priority ceiling protocol). The resource accesses have worst case execution times given in Table 11.24.
$$
\begin{array}{cccccc}
\hline \boldsymbol{R 1} & \boldsymbol{R 2} & \boldsymbol{R 3} & \boldsymbol{R} \mathbf{4} & \boldsymbol{R 5} & \boldsymbol{R} \mathbf{6} \\
\hline 50 \mathrm{~ms} & 150 \mathrm{~ms} & 75 \mathrm{~ms} & 300 \mathrm{~ms} & 250 \mathrm{~ms} & 175 \mathrm{~ms} \\
\hline
\end{array}
$$
Resources are used by the tasks according to Table 11.25.
$$
\begin{array}{cc}
\hline \text { Task } & \text { Uses } \\
\hline a & R 3 \\
b & R 1, R 2 \\
c & R 3, R 4, R 5 \\
d & R 1, R 5, R 6 \\
e & R 2, R 6 \\
\hline
\end{array}
$$

Check back soon!

Problem 7

Is the task set shown in Table 11.26 schedulable using the simple utilizationbased test given in Equation (11.1)? Is the task set schedulable using the response time analysis?
$$
\begin{array}{ccc}
\hline \text { Task } & \text { Period } & \text { Execution time } \\
\hline a & 50 & 10 \\
b & 40 & 10 \\
c & 30 & 9 \\
\hline
\end{array}
$$

Check back soon!

Problem 8

The task set shown in Table 11.27 is not schedulable using Equation (11.1) because $a$ must be given the top priority due to its criticality. How can the task set be transformed so that it is schedulable? Note that the computations represented by $a$ must still be given top priority.
$$
\begin{array}{cccc}
\hline \text { Task } & \text { Period } & \text { Execution time } & \text { Criticality } \\
\hline a & 60 & 10 & \text { HIGH } \\
b & 10 & 3 & \text { LOW } \\
c & 8 & 2 & \text { LOW } \\
\hline
\end{array}
$$

Check back soon!

Problem 9

The task set given in Table 11.28 is not schedulable using Equation (11.1), but does meet all deadlines when scheduled using fixed priorities. Explain why.
$$
\begin{array}{ccc}
\hline \text { Task } & \text { Period } & \text { Execution time } \\
\hline a & 75 & 35 \\
b & 40 & 10 \\
c & 20 & 5 \\
\hline
\end{array}
$$

Check back soon!

Problem 10

In Section 11.6, a sporadic task was defined as having a minimum inter-arrival time. Often sporadic tasks come in bursts. Update Equation (11.4) to cope with a burst of sporadic activities such that $N$ invocations can appear arbitrarily close together in a period of $T$.

Check back soon!
01:58

Problem 11

Extend the answer given above to cope with sporadic activity which arrives in bursts, where there may be $N$ invocations in a period of $T$ and each invocation must be separated by at least $M$ time units.

Suman Saurav Thakur
Suman Saurav Thakur
Numerade Educator
01:51

Problem 12

To what extent can the response time equations given in this chapter be applied to resources other than the CPU? For example, can the equations be used to schedule access to a disk?

Nick Johnson
Nick Johnson
Numerade Educator

Problem 13

In a safety-critical real-time system, a collection of tasks can be used to monitor key environmental events. Typically, there will be a deadline defined between the event occurring and some output (which is in response to the event) being produced. Describe how periodic tasks can be used to monitor such events.

Check back soon!
07:06

Problem 14

Consider the list of events (shown in Table 11.29) together with the computation costs of responding to each event. If a separate task is used for each event (and these tasks are implemented by preemptive priority-based scheduling) describe how Rate Monotonic Analysis can be applied to make sure all deadlines are met.
TABLE CAN'T COPY.

David Morabito
David Morabito
Numerade Educator

Problem 15

How can the task set shown in Table 11.30 be optimally scheduled (using fixedpriority scheduling)? Is this task set schedulable?
$$
\begin{array}{crrrr}
\hline \text { Task } & \boldsymbol{T} & \boldsymbol{C} & \boldsymbol{B} & \boldsymbol{D} \\
\hline a & 8 & 4 & 2 & 8 \\
b & 10 & 2 & 2 & 5 \\
c & 30 & 5 & 2 & 30 \\
\hline
\end{array}
$$

Check back soon!

Problem 16

Develop a model of clock handling which incorporates the three parameters $C T^c, C T^s$ and $C T^m$ (see Section 11.16.3).

Check back soon!

Problem 17

Rather than using a clock interrupt to schedule periodic tasks, what would be the ramifications of only having access to a real-time clock?

Check back soon!
01:31

Problem 18

A periodic task of period $40 \mathrm{~ms}$ is controlled by a clock interrupt that has a granularity of $30 \mathrm{~ms}$. How can the worst-case response time of this task be calculated?

James Kiss
James Kiss
Numerade Educator