**4.1 Resource reservation in multimedia systems**

Let us consider a multimedia device, like a cell phone, in which a phone call, a video player, and a web browser can be concurrently executed, so that a user can simultaneously make a phone call while watching a video and downloading a file from the web. These applications are characterized by a highly variable computational demand and share common resources (e.g., processor, memory, touch screen, audio codec, and graphic display). They are briefly described below.


Note that, each of the considered applications is typically implemented as a set of tasks with different priorities. Hence, when they are concurrently executed on the same processor,

in Real-Time Systems 21

Handling Overload Conditions in Real-Time Systems 169

Let us consider a mobile robot system whose goal is to explore an unknown environment to localize given targets through a dedicated sensor, while avoiding obstacles along the path using proximity sensing. Note that, by equipping the robot with suitable sensors, the system could be used for very different applications; for instance, to discover electrical sockets in a room, using a video camera, or to localize unexploded mines in a field, using a georadar. For the purpose of this chapter, we consider a robot equipped with two motors to move in two directions on a flat surface, two encoders to measure the angular rotation of the wheels and reconstruct the traveled path, a sensor to detect the target (target sensor), a proximity sensor (e.g., based on ultrasound transducers) to detect the distance from possible obstacles along

the path, and an electronic compass to orient the trajectory in desired directions.

From the software point of view, the application consists of the following periodic tasks:

• **Motor Control Task** (MCT or *τ*1): it performs the low-level motor control loop to drive the

• **Obstacle Detection Task** (ODT or *τ*2): it reads the proximity sensor to detect a possible

• **Target Detection Task** (TDT or *τ*3): it reads the target sensor and stores the target location

• **Exploration Task** (EXT or *τ*4): it generates the proper set points (exploring direction and

• **Obstacle Avoidance Task** (OAT or *τ*5): it is activated when an obstacle is detected and computes a sequence of set points to be followed to avoid the obstacle and return to the

To illustrate the use of an overload management technique, we assume that in normal operating conditions (i.e., in the absence of obstacles) the first four tasks (*τ*1,..., *τ*4) generate a load equal to *Unorm* = 0.9, while the fifth task has a utilization *U*<sup>5</sup> = 0.3. Hence, when *τ*<sup>5</sup> is activated together with the other tasks, the total system utilization becomes *Umax* = 1.2. In this example, the elastic approach is applied to bring the load back to a desired value *Ud* = 0.9

The tasks are organized as shown in Figure 13, where hardware components are represented

and an elastic coefficient *Ei*. Task parameters are reported in Table 1 and are expressed in milliseconds. Note that, when the OAT task is not active, the utilization of the task set is Task name Task ID *Ci Tmin*

> MCT *τ*<sup>1</sup> 3 10 10 0 ODT *τ*<sup>2</sup> 6 20 30 1 TDT *τ*<sup>3</sup> 20 100 200 2 EXT *τ*<sup>4</sup> 20 200 500 1 OAT *τ*<sup>5</sup> 6 20 40 2

*<sup>i</sup> <sup>T</sup>max <sup>i</sup> Ei* *<sup>i</sup>* , *<sup>T</sup>max <sup>i</sup>* ]

To apply the elastic method, each task *τ<sup>i</sup>* must specify a range of valid periods [*Tmin*

by rounded boxes, tasks by circles, and shared buffers by rectangles.

**4.2 Overload handing in robot control systems**

robot in a desired direction (*θ*) at a given speed (*v*);

obstacle along the path;

planned path.

in a buffer when it is detected;

(equal to the normal load condition).

Table 1. Task parameters of the robot application.

speed) for the Motor Control Task;

Fig. 12. Distribution of frame decoding times for an MPEG video player.

tasks are subject to reciprocal interference and can experience long blocking delays and jerky behavior. As a consequence, the user could experience a temporary motion stop on the movie, or perceive an annoying jitter in the sound. Although these applications are not safety critical, the unpleasant effects of such interferences on the user perception are taken in a serious consideration by the developers, since they can make a difference with another device produced by a competitor.

Resource reservation can be effectively used in this system to isolate the temporal behavior of the applications and limit their reciprocal interference (Bini et al., 2011). To do that, the processor should be partitioned into three reservations, with bandwidth *Us*<sup>1</sup> , *Us*<sup>2</sup> , and *Us*<sup>3</sup> , each behaving as a slower processor running at speed *Usi* . The advantage of this approach is that an overrun occurring in an application does not affect the other applications, but has only the effect of postponing the execution of those tasks in which the overrun is generated. Moreover, an application can be designed and analyzed independently of the others, because its execution behavior only depends on its own computational demand and the allocated bandwidth.

In our system, allocating each bandwidth for satisfying the worst-case processing demand of the application would waste resources and would lead to an infeasible schedule. For instance, the maximum bandwidth requirements of the first two applications already exceed the full processor capacity. To achieve a feasible schedule, the bandwidth can be reserved to satisfy a processing demand slightly higher than the average value, handling sporadic overruns through resource reservation. In the considered example, 40% of the processor can be reserved to the phone call, 50% to the video player, and, the remaining 10% to the web browser, which has less stringent timing constraints.

When the amount of allocated bandwidth results to be quite different from the real application needs, adaptive approaches based on feedback mechanisms can be applied at runtime to adjust the allocated bandwidth to the real resource needs (Abeni & Buttazzo, 1999; Bini et al., 2011).

20 Will-be-set-by-IN-TECH

0 5 10 15 20 25 30 35

Execution Time (ms)

tasks are subject to reciprocal interference and can experience long blocking delays and jerky behavior. As a consequence, the user could experience a temporary motion stop on the movie, or perceive an annoying jitter in the sound. Although these applications are not safety critical, the unpleasant effects of such interferences on the user perception are taken in a serious consideration by the developers, since they can make a difference with another

Resource reservation can be effectively used in this system to isolate the temporal behavior of the applications and limit their reciprocal interference (Bini et al., 2011). To do that, the processor should be partitioned into three reservations, with bandwidth *Us*<sup>1</sup> , *Us*<sup>2</sup> , and *Us*<sup>3</sup> ,

is that an overrun occurring in an application does not affect the other applications, but has only the effect of postponing the execution of those tasks in which the overrun is generated. Moreover, an application can be designed and analyzed independently of the others, because its execution behavior only depends on its own computational demand and the allocated

In our system, allocating each bandwidth for satisfying the worst-case processing demand of the application would waste resources and would lead to an infeasible schedule. For instance, the maximum bandwidth requirements of the first two applications already exceed the full processor capacity. To achieve a feasible schedule, the bandwidth can be reserved to satisfy a processing demand slightly higher than the average value, handling sporadic overruns through resource reservation. In the considered example, 40% of the processor can be reserved to the phone call, 50% to the video player, and, the remaining 10% to the web browser, which

When the amount of allocated bandwidth results to be quite different from the real application needs, adaptive approaches based on feedback mechanisms can be applied at runtime to adjust the allocated bandwidth to the real resource needs (Abeni & Buttazzo, 1999; Bini et al.,

. The advantage of this approach

Fig. 12. Distribution of frame decoding times for an MPEG video player.

each behaving as a slower processor running at speed *Usi*

0

device produced by a competitor.

has less stringent timing constraints.

bandwidth.

2011).

0.01

0.02

0.03

0.04

Probability

0.05

0.06

0.07

### **4.2 Overload handing in robot control systems**

Let us consider a mobile robot system whose goal is to explore an unknown environment to localize given targets through a dedicated sensor, while avoiding obstacles along the path using proximity sensing. Note that, by equipping the robot with suitable sensors, the system could be used for very different applications; for instance, to discover electrical sockets in a room, using a video camera, or to localize unexploded mines in a field, using a georadar. For the purpose of this chapter, we consider a robot equipped with two motors to move in two directions on a flat surface, two encoders to measure the angular rotation of the wheels and reconstruct the traveled path, a sensor to detect the target (target sensor), a proximity sensor (e.g., based on ultrasound transducers) to detect the distance from possible obstacles along the path, and an electronic compass to orient the trajectory in desired directions.

From the software point of view, the application consists of the following periodic tasks:


To illustrate the use of an overload management technique, we assume that in normal operating conditions (i.e., in the absence of obstacles) the first four tasks (*τ*1,..., *τ*4) generate a load equal to *Unorm* = 0.9, while the fifth task has a utilization *U*<sup>5</sup> = 0.3. Hence, when *τ*<sup>5</sup> is activated together with the other tasks, the total system utilization becomes *Umax* = 1.2. In this example, the elastic approach is applied to bring the load back to a desired value *Ud* = 0.9 (equal to the normal load condition).

The tasks are organized as shown in Figure 13, where hardware components are represented by rounded boxes, tasks by circles, and shared buffers by rectangles.

To apply the elastic method, each task *τ<sup>i</sup>* must specify a range of valid periods [*Tmin <sup>i</sup>* , *<sup>T</sup>max <sup>i</sup>* ] and an elastic coefficient *Ei*. Task parameters are reported in Table 1 and are expressed in milliseconds. Note that, when the OAT task is not active, the utilization of the task set is


Table 1. Task parameters of the robot application.

in Real-Time Systems 23

Handling Overload Conditions in Real-Time Systems 171

Abeni, L. & Buttazzo, G. (2000). Support for dynamic qos in the hartik kernel, *IEEE Proceedings*

Abeni, L. & Buttazzo, G. (2004). Resource reservations in dynamic real-time systems, *Real-Time*

Abeni, L. & Buttazzo, G. (May 30 - June 1, 2001). Hierarchical qos management for time

Aydin, H., Melhem, R., Mossé, D. & Alvarez, P. M. (2001). Optimal reward-based scheduling for periodic real-time tasks, *IEEE Transactions on Computers* 50(2): 111–130. Baruah, S., Rosier, L. & Howell, R. (1990). Algorithms and complexity concerning the

Bernat, G., Broster, I. & Burns, A. (December 5-8, 2004). Rewriting history to exploit gain time,

Bernat, G. & Burns, A. (2002). Multiple servers and capacity sharing for implementing flexible

Bertogna, M., Fisher, N. & Baruah, S. (2009). Resource-sharing servers for open environments,

Bini, E., Buttazzo, G., Eker, J., Schorr, S., Guerra, R., Fohler, G., Arzen, K.-E., Segovia, V. R.

Bini, E., Buttazzo, G. & Lipari, G. (2009). Minimizing cpu energy in real-time systems

Buttazzo, G. (2011). *Hard Real-Time Computing Systems and Applications - Third Edition*, Springer,

Buttazzo, G., Abeni, L. & Lipari, G. (1998). Elastic task model for adaptive rate control, *IEEE*

Buttazzo, G., Lipari, G., Caccamo, M. & Abeni, L. (2002). Elastic scheduling for flexible workload management, *IEEE Transactions on Computers* 51(3): 289–302. Buttazzo, G. & Stankovic, J. (1995). Adding robustness in dynamic preemptive scheduling, *in*

Caccamo, M. & Buttazzo, G. (1997). Exploiting skips in periodic tasks for enhancing aperiodic

Caccamo, M., Buttazzo, G. & Sha, L. (2000). Capacity sharing for overrun control, *Proceedings*

Caccamo, M., Buttazzo, G. & Thomas, D. (2005). Efficient reclaiming in reservation-based

Easwaran, A., Anand, M. & Lee, I. (2007). Compositional analysis framework using

Feng, X. & Mok, A. K. (2002). A model of hierarchical real-time virtual resources, *Proceedings of the* 23*rd IEEE Real-Time Systems Symposium*, Austin, TX, USA, pp. 26–35. Guangming, Q. (2009). An earlier time for inserting and/or accelerating tasks, *Real-Time*

*of the IEEE Real-Time Systems Symposium*, Orlando, Florida, USA.

*(RTCSA'00)*, Cheju Island, South Korea.

*Symposium (RTAS'01)*, Taipei, Taiwan.

scheduling, *Real-Time Systems* 22: 49–75.

approach, *IEEE Micro* 31(3): 72–81.

*Real Time System Symposium*, Madrid, Spain.

*Real-Time Systems*, Kluwer Academic Publishers.

*Symposium*, Tucson, AZ, USA, pp. 129–138.

*IEEE Transactions on Industrial Informatics* 5(3): 202–220.

*Systems* 27(2): 123–165.

*Real-Time Systems* 2.

8(4): 31:1–31:23.

pp. 287–292.

pp. 330–339.

54(2): 198–213.

*Systems* 41(3): 181–194.

*of the 7th International Conference on Real-Time Computing Systems and Applications*

sensitive applications, *Proceedings of the IEEE Real-Time Technology and Applications*

preemptive scheduling of periodic, real-time tasks on one processor, *Journal of*

*Proceedings of the 25th IEEE Real-Time Systems Symposium (RTSS'04)*, Lisbon, Portugal.

& Scordino, C. (2011). Resource management on multicore systems: The ACTORS

with discrete speed management, *ACM Transactions on Embedded Computing Systems*

D. Fussel & M. Malek (eds), *Responsive Computer Systems: Steps Toward Fault-Tolerant*

responsiveness, *IEEE Real-Time Systems Symposium*, San Francisco, California, USA,

real-time systems with variable execution times, *IEEE Transactions on Computers*

EDP resource models, *Proceedings of the* 28*th IEEE International Real-Time Systems*

Fig. 13. Task interaction in the robot application.

$$\mathcal{U}\_{norm} = \sum\_{i=1}^{4} \frac{C\_i}{T\_i} = 0.91$$

whereas, when OAT is active, the system becomes overloaded, being

$$\mathcal{U}\_{\text{max}} = \sum\_{i=1}^{5} \frac{C\_i}{T\_i} = 1.2.$$

By applying the elastic approach, with a desired utilization *Ud* = 0.9 (to keep a safety margin), tasks utilizations are compressed according to Equation (19) and then enforced by re-computing the periods as *Ti* = *Ci*/*Ui*. The new tasks utilizations and periods derived by the elastic algorithm are reported in Table 2.


Table 2. Task utilizations and periods derived by the elastic compression, with a desired utilization *Ud* = 0.9.

When the obstacle is overcome, task OAT can be suspended and the remaining tasks can return to their original condition, running with their minimum periods.

#### **5. References**


22 Will-be-set-by-IN-TECH

MCT

ODT

TDT

Sensor Target

Motors

Encoders

Compass

Proximity Sensor

Obstacle Detected

OAT

Fig. 13. Task interaction in the robot application.

the elastic algorithm are reported in Table 2.

utilization *Ud* = 0.9.

**5. References**

Spain.

Target Data

*θ*, *v*

*Unorm* =

*Umax* =

whereas, when OAT is active, the system becomes overloaded, being

4 ∑ *i*=1

5 ∑ *i*=1

By applying the elastic approach, with a desired utilization *Ud* = 0.9 (to keep a safety margin), tasks utilizations are compressed according to Equation (19) and then enforced by re-computing the periods as *Ti* = *Ci*/*Ui*. The new tasks utilizations and periods derived by

> Task name Task ID *Ui Ti* MCT *τ*<sup>1</sup> 3/10 10 ODT *τ*<sup>2</sup> 1/4 24 TDT *τ*<sup>3</sup> 1/10 200 EXT *τ*<sup>4</sup> 1/20 400 OAT *τ*<sup>5</sup> 1/5 30

Table 2. Task utilizations and periods derived by the elastic compression, with a desired

return to their original condition, running with their minimum periods.

*Applications (RTCSA'99)*, Hong Kong, China, pp. 70–77.

When the obstacle is overcome, task OAT can be suspended and the remaining tasks can

Abeni, L. & Buttazzo, G. (1998). Integrating multimedia applications in hard real-time

Abeni, L. & Buttazzo, G. (1999). Adaptive bandwidth reservation for multimedia computing,

systems, *Proceedings of the 19th IEEE Real-Time Systems Symposium (RTSS'98)*, Madrid,

*Proceedings of the 6th IEEE International Conference on Real-Time Computing Systems and*

*Ci Ti*

*Ci Ti*

= 0.9

= 1.2.

EXT Set points


**8** 

Qilong Han

*China* 

**Real-Time Concurrency Control Protocol** 

Concurrency control is one of the main issues in the studies of real-time database systems. On the one hand, it is related closely to active real-time database and real-time application. Concurrency control algorithm seriously affect the performance of the system in real-time, may cause unpredictable consequences. On the other hand, updating data in active real-time database may trigger a new transaction and to further increase the difficulty of the concurrency control. How ensures both the consistency of the database and the finish of the transactions before deadline; it is an important problem to the concurrency control research in the active real-time database systems. In the most literature, the existing research more focuses on the transactions deadline and lack of attention the data temporal constraint. This is mainly due to the real-time data is obtained dynamically by sensors in real-time database, and the transactions of real-time databases read the sensor data only, do not write the sensor data. But the real-time data may miss deadline and become invalid before transaction which reads it committed, most concurrency control algorithms are regardless of the sensor data deadline and its invalid effect to systems. This chapter will further discuss the concurrency

Optimism concurrency control method is widely used in real-time database due to no deadlock and no-block characteristics, but delay conflicts detection brings with great restart overhead. A dynamic adjustment serialization order method is proposed to reduce unnecessary affairs restart number [Haritsa, Lindstrom], according to [Lindstrom, Wang] a method is proposed by control the reading and writing data to reduce the transaction restart number. In [Brad] discussed about the relation between real-time data and the derived data validity, and [Kuo] proposed the concept of real-time data similarity. According to [Brad, Xiong] proposed the concept of data-deadline, and the transaction scheduling strategy by using mandatory waiting method. The [Liu] also discuss on data deadline and transaction scheduling. A real-time transaction scheduling method is proposed based on the combination of [Kuo, Son] improving real-time data similarity mechanism in [Xiong]. But [Xiong, Son] only take account of single transaction scheduling the real data problems, not consider the concurrency control problem that the transactions did not arrive at deadline

and its accessed data expired, which will increase the number of transactions restart.

control method that transactions access real-time sensor data.

**1. Introduction**

**Based on Accessing Temporal Data** 

*College of Computer Science and Technology, Harbin Engineering University Harbin,* 

