A Structural Approach to Quasi-Static Schedulability Analysis of Communicating Concurrent Programs ∗ Cong Liu Department of EECS UC, Berkeley Berkeley, CA 94720 congliu@eecs.berkeley.edu Alex Kondratyev, Yosinori Watanabe Cadence Berkeley Labs Berkeley, CA 94704 {kalex, watan- abe}@cadence.com Alberto Sangiovanni-Vincentelli Department of EECS UC, Berkeley Berkeley, CA 94720 alberto@eecs.berkeley.edu ABSTRACT We describe a system as a set of communicating concurrent programs. Quasi-static scheduling compiles the concurrent programs into a sequential one. It uses a Petri net as an intermediate model of the system. However, Petri nets gen- erated from many interesting applications are not schedu- lable. In this paper, we show the underlying mechanism which causes unschedulability in terms of the structure of a Petri net. We introduce a Petri net structural property and prove unschedulability if the property holds. We propose a linear programming based algorithm to check the prop- erty, and prove the algorithm is valid. Our approach prove unschedulability typically within a second for Petri nets gen- erated from industrial JPEG and MPEG codecs, while the scheduler fails to terminate within 24 hours. Categories and Subject Descriptors C.3 [Special-Purpose and Application Based Systems]: Real-time and embedded systems; D.2.2 [Software Engi- neering]: Design Tools and Techniques —Petri nets General Terms Algorithms, Design, Theory Keywords Quasi-static scheduling, Petri nets, structural analysis 1. INTRODUCTION The complexity of embedded systems has been increasing dramatically. It forces designers to adopt formal models to describe system behaviors and hide implementation details. It is often necessary to decompose a complicated system ∗ This research was partly supported by MARCO Gigascale Systems Research Center award 2003-DT-660. Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. To copy otherwise, to republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. EMSOFT’05, September 19–22, 2005, Jersey City, New Jersey, USA. Copyright 2005 ACM 1-59593-091-4/05/0009 ...$5.00. into functional entities so that the design complexity of each entity is manageable. Concurrent models, such as dataflow networks [14], Kahn process networks (KPN) [12][13], and Communicating Sequential Processes [11], are suitable for these purposes. In a concurrent model, a system consists of a set of processes. Each is described by a sequential program. The processes communicate with the environment and other processes, and run at their own speed. However, the concurrent processes often share a physical resource, e.g. a CPU or a bus. Hence, their implementation often requires solving a fundamental scheduling problem, i.e. sequencing the operations of concurrent processes un- der certain constraints. Depending on how and when the scheduling decision are made, scheduling algorithms could be classified as: static, quasi-static, and dynamic. Dynamic scheduling makes all scheduling decisions at run-time. It in- troduces context switch overhead. Static scheduling makes all scheduling decisions at compile-time. It reduces the con- text switch overhead, because no run-time scheduling deci- sion has to be made. Due to this static scheduling is re- stricted to systems without data-dependent choices, e.g. if- then-else. Quasi-static scheduling [7] is applied to systems in which data-dependent choices occur. It performs static scheduling as much as possible while leaving data-dependent control to be resolved at run-time. The existence of a quasi-static schedule is proved to be undecidable for Boolean dataflow networks [6]. The most recent advancement [7] on quasi-static scheduling uses a Petri net [16] as an intermediate representation of the sys- tem specification. Its scheduling flow is shown in Figure 1. First, the concurrent programs are transformed into a Petri net where program statements are represented by transi- tions, and system states correspond to PN markings. Then a heuristic algorithm searches the reachability tree of the Petri net for a schedule. If it succeeds, the generated sched- ule is transformed back to a sequential program. Note that during the transformation, data-dependent choices are ab- stracted as non-deterministic free choices. Consequently, a scheduler considers all possible choice outcomes at any state. The abstraction helps to provide an efficient method to find a schedule. However, the conservative consideration makes many interesting applications unschedulable. 1.1 Motivation and Contribution The quasi-static scheduler searches for a schedule in a typically infinite space bounded by some heuristic. Thus, if a Petri net is unschedulable, the scheduler has to com-