Elsevier

Journal of Systems and Software

Volume 58, Issue 3, 15 September 2001, Pages 247-260
Journal of Systems and Software

Joint scheduling of garbage collector and hard real-time tasks for embedded applications

https://doi.org/10.1016/S0164-1212(01)00042-5Get rights and content

Abstract

Programs with complex data structures often require dynamic memory management based on automatic memory reclamation (garbage collection). A major problem in adopting garbage collection for embedded real-time systems is that it often causes unpredictable pauses and that, as a result of such delays, hard real-time tasks may miss their deadlines. In this paper, we propose a new real-time garbage collection technique for embedded applications. In our approach, the system jointly schedules garbage collector and hard real-time tasks using one of the aperiodic server approaches. Our study focuses on reducing memory requirements while guaranteeing the deadlines of hard real-time tasks. To achieve this objective, we model garbage collection requests as aperiodic hard real-time tasks, and schedule them using the sporadic server (SS). We also present an effective live-memory analysis to bound the worst-case garbage collection time. Performance analysis shows that the proposed approach considerably reduces the worst-case memory reservation compared with a background policy. The analytic results are verified by simulation based on trace-driven data.

Introduction

As information technology permeates into every aspect of our society and industry, distributed real-time computing systems have been implemented in many forms, such as component-based software, software agents and Java virtual machines with applets. These techniques are characterized by objects, mobility, autonomy and dynamic behavior. Execution of programs with complex data structures often requires dynamic memory management of a heap to utilize memory efficiently by reclaiming unused space. We usually hold the system, not the programmer, responsible for the memory management so as to achieve improved productivity, robustness and program integrity. Central to this automatic memory reclamation is the garbage collection process. A garbage collector identifies the data items that will never be used again and then recycles their space for reuse at the system level. In spite of its advantages, garbage collection has not been widely used in embedded real-time applications. For example, few embedded real-time systems have been written in Java™ language, even though it has been popular for years. This is partly because garbage collection may cause the response time of an application to become unpredictable.

For predictable execution of a real-time application, the garbage collector itself must run in real-time mode. We summarize and extend the requirements for a real-time garbage collector that were presented by Wilson (1994):

  • Concurrent or incremental execution. In order to avoid intolerable pauses incurred by stop-and-go reclamation, a real-time garbage collector often interleaves its execution with the execution of an application. Depending on the implementation, the garbage collector runs either concurrently with mutators1 or incrementally in the context of mutator execution. The system needs to remain consistent or safe while the garbage collector identifies all the live objects and processes them. To preserve the consistency of a heap, a real-time collector must have mutators report on any changes that they have made to the liveness of heap objects.

  • Bounded interference with mutator execution. Garbage collector must not interfere with the schedulability of hard real-time mutators. For this purpose, we need to keep the basic memory operations, such as memory allocation and pointer modification, short and bounded. We must also aim to minimize the synchronization overhead between garbage collector and mutators.

  • Bounded execution time. In real-time systems, the worst-case behavior of the garbage collector should also be predictable. Real-time systems with garbage collection must meet the deadlines of hard real-time mutators while preventing the application from running out of memory. Unbounded garbage collection times may cause either the deadlines of hard real-time mutators to be missed or memory shortage.

Considering these properties, we develop a new approach for real-time garbage collection. Our approach integrates garbage collection with task scheduling. For hard real-time periodic tasks, the objective of our approach is to guarantee that deadlines are always met. Another objective is to reduce the memory requirement since heap memory is usually a scarce resource in embedded systems.

To achieve these objectives, our approach first models garbage collection requests as hard real-time aperiodic tasks. The sporadic server (SS) (Sprunt et al., 1989) schedules them with a preset capacity. Our approach determines the server capacity using the worst-case response time analysis for the SS (Ghazalie and Baker, 1995, Bernat and Burns, 1999). In this way, we can guarantee the schedulability of hard real-time mutators. We also provide a worst-case live-memory analysis to bound the worst-case garbage collection time. Live-memory analysis provides a safe and effective bound of live memory. The worst-case response time of the garbage collector and the worst-case live memory requirement are the dominant factors in determining the total memory requirement, which is minimized by our approach. We choose a semi-space copying collector (Baker, 1978, Brooks, 1984, Kim et al., 2000) for the discussion in this paper because it automatically compacts the live-object area, and thus simplifies the estimation of garbage collection time. From now on, the term garbage collector will indicate a real-time copying garbage collector unless specified otherwise.

The rest of this paper is organized as follows. In Section 2, we review related work on real-time garbage collection. Section 3 formulates the problem addressed in this paper. The scheduling algorithm for real-time garbage collection is introduced in Section 4; this section also presents the live-memory analysis based on the scheduling approach. We evaluate the effectiveness of the proposed approach in Section 5. Section 6 briefly discusses the design consideration for embedded real-time systems with garbage collection. Section 7 concludes this paper.

Section snippets

Related work

Since basic garbage collection inherently works in a stop-and-go fashion, the pauses that it introduces may become intolerable for applications that require a bounded response time. Incremental and concurrent garbage collection algorithms (Baker, 1978, Brooks, 1984, Yuasa, 1990) have been proposed to distribute and hide the garbage collection pause time throughout the execution of mutators. Although they can reduce intermediate pause delays, few of them bound the worst-case garbage collection

System model and assumptions

We consider a real-time system with a set of n periodic priority-ordered mutator tasks, M={M1,…,Mn} where Mn is the lowest-priority task. All the tasks follow a fixed-priority scheduling such as rate monotonic scheduling (Liu and Layland, 1973). Our task model includes an additional property, the memory allocation requirement of Mi. A mutator Mi is characterized by a tuple Mi=(Ci,Ti,Di,Ai) (see Table 1 for notations). Further discussion will be based on the following assumptions.

  • Assumption 1.

Scheduling garbage collection and mutators

We will now describe the scheduling of Gk in the context of traditional task scheduling. The main objective of our algorithm is to minimize the memory requirement while meeting the hard deadlines of mutators. We consider the real-time copying collector presented in (Kim et al., 2000) to estimate the worst-case garbage collection time.

Performance evaluation

In this section, we evaluate the efficiency of our approach. First, we confirm the effectiveness of the live-memory analysis by comparing the results of our analysis with the simulation results and the trivial upper bound. Second, we compare the worst-case memory reservation of our approach with the traditional background policy. Third, we conduct a series of simulations to compare the memory requirement of various scheduling policies.

We wrote five application programs in Java for these

Design considerations

The drawback of our approach is that aperiodic tasks cannot use the capacity of the SS when the garbage collection is not in progress. Because it is too tight a constraint, we have attempted to find a smaller Cs, while minimizing the memory requirement. Table 7 shows the memory requirement of TS1 for various values of Cs. The results show that although a smaller Cs may produce lower Lk,local, it may not reduce the total memory requirement accordingly. This is because a smaller Cs results in a

Conclusions and future work

This paper has focused on the integration of garbage collection with task scheduling to guarantee the schedulability of hard real-time tasks while minimizing memory requirement. Because the worst-case live memory is an essential metric for scheduling-integrated garbage collection, we have developed an effective live-memory analysis based on the states of periodic tasks. By scheduling garbage collection requests using the SS, our approach can considerably reduce the memory requirement compared

Acknowledgements

The authors would like to thank the anonymous referees for their valuable comments and suggestions. The authors also wish to thank Namyun Kim and Taewoong Kim for the useful discussions about the scheduling approach. This work was supported in part by S.N.U Research Fund under Grant 982110, in part by ITEP GITP under Grant B32-979-3305-03-1-3, and in part by the Brain Korea 21 project.

Taehyoun Kim received the B.S. and M.S. and Ph.D. degrees in computer engineering from Seoul National University, Korea, in 1994, 1996, and 2001, respectively. He is currently a senior engineer in NeoMicros, Inc. His research interests include embedded real-time systems, real-time Java, real-time garbage collection, and wireless communications.

References (24)

  • A.W. Appel

    Garbage collection can be faster than stack allocation

    Information Processing Letters

    (1987)
  • H.G. Baker

    List processing in real time on a serial computer

    Communications of the ACM

    (1978)
  • Barrett, D.A., Zorn, B.G., 1993. Using lifetime predictors to improve memory allocation performance. In: Proceedings of...
  • Bernat, G., Burns, A., 1999. New results on fixed priority aperiodic servers. In: Proceedings of Real-Time Systems...
  • Brooks, R.A., 1984. Trading data space for reduced time and code space in real-time collection on stock hardware. In:...
  • Dieckmann, S., Hölzle, U., 1999. A study of the allocation behavior of the specjvm98 java benchmarks. In: Proceedings...
  • E.W. Dijkstra et al.

    On-the-fly garbage collection: an exercise in cooperation

    Communications of the ACM

    (1978)
  • P.M. Embree

    C Algorithms for Real-Time DSP

    (1995)
  • Gerber, R., Hong, S., Saksena, M., 1994. Guaranteeing end-to-end timing constraints by calibrating intermediate...
  • T.M. Ghazalie et al.

    Aperiodic servers in a deadline scheduling environment

    Journal of Real-Time Systems

    (1995)
  • Henriksson, R., 1998. Scheduling Garbage Collection in Embedded Systems. Ph.D. Thesis. Lund University,...
  • Java Virtual Machine Profiler Interface (JVMPI)., 1999. http://java.sun.com/products/jdk/1.2/docs/guide/jvmpi/...
  • Cited by (16)

    View all citing articles on Scopus

    Taehyoun Kim received the B.S. and M.S. and Ph.D. degrees in computer engineering from Seoul National University, Korea, in 1994, 1996, and 2001, respectively. He is currently a senior engineer in NeoMicros, Inc. His research interests include embedded real-time systems, real-time Java, real-time garbage collection, and wireless communications.

    Naehyuck Chang received the B.S. and M.S. and Ph.D degrees in control and instrumentation engineering from Seoul National University, Korea, in 1989, 1992, and 1996, respectively. He is currently an assistant professor of School of Computer Science and Engineering at Seoul National University. His research interests include low-power systems, digital systems design, real-time embedded systems, real-time Java.

    Heonshik Shin received the B.S. degree in applied physics from Seoul National University, Korea, in 1973 and Ph.D degree in computer engineering from the University of Texas at Austin in 1985. He is currently a professor of School of Computer Science and Engineering at Seoul National University. His research interests include real-time computing, distributed systems, and I/O processing.

    View full text