Non-Blocking Data Sharing in Multiprocessor Real-Time Systems*
Total Page:16
File Type:pdf, Size:1020Kb
Non-blo cking Data Sharing in Multipro cessor Real-Time Systems Philippas Tsigas and Yi Zhang Department of Computing Science Chalmers University of Technology S-412 96 Göteb org, Sweden <tsigas,yzhang>@cs.chalmers.se iii) have to b e ecient in time and in space since they Abstract must p erform under tight time and space constraints. A nice description of the ne challenges that inter-task A non-blocking protocol that al lows real-time tasks communication proto cols for real-time systems haveto to share data in a multiprocessor system is presented address can b e found in [11]. in this paper. The protocol gives the means to concur- The classical, well-known and most simple solution rent real-time tasks to read and write shared data; the protocol al lows multiple write and multiple read opera- enforces mutual exclusion. Mutual exclusion protects the consistency of the shared data by allowing only tions to beexecutedconcurrently. Our protocol extends one pro cess at time to access the data. Mutual ex- previous results and is optimal with respect to space requirements. Together with the protocol, its schedula- clusion i) causes large p erformance degradation esp e- cially in multipro cessor systems [12]; ii) leads to com- bility analysis and a set of schedulability tests for a set plex scheduling analysis since tasks can b e delayed b e- of random task sets are presented. Both the schedula- bility analysis and the schedulability experiments show cause they were either preempted by other more urgent tasks, or b ecause they are blo cked b efore a critical sec- that the algorithm presentedinthispaper exhibits less overhead than the lock basedprotocols. tion by another pro cess that can in turn b e preempted by another more urgent task and so on. (this is also called as the convoy eect) [2]; and iii) leads to priority inversion in which a high priority task can b e blo cked 1. Intro duction for an unb ounded time bya lower priority task [4]. Sev- eral synchronisation proto cols havebeenintro duced to In anymultipro cessing system co op erating pro cesses solve the priorityinversion problem for unipro cessor [4] share data via shared data ob jects. In this pap er we and multipro cessor [3] systems. The solution presented are interested in designing shared data ob jects for co- in [4] solves the problem for the unipro cessor case with op erative tasks in real-time multipro cessor systems. the cost of limiting the schedulability of task sets and The challenges that have to b e faced in the design of also making the scheduling analysis of real-time sys- inter-task communication proto cols for multipro cessor tems hard. The situation is muchworse in a multipro- systems b ecome more delicate when these systems have cessor real-time system, where a task maybeblocked to supp ort real-time computing. In real-time multipro- by another task running on a dierent pro cessor [3]. cessor systems inter-task communication proto cols i) Non-blo cking implementation of shared data ob jects have to supp ort sharing of data b etween dierenttasks is a new alternative approach for the problem of inter- e.g. on an op erational ight program (OFP), tasks task communication. Non-blo cking mechanisms allow like navigation, maintaining of pilot displays, control multiple tasks to access a shared ob ject at the same of and communication with a variety of sp ecial pur- time, but without enforcing mutual exclusion to ac- pose hardware, weap on delivery, and so on; ii) must complish this. Non-blo cking inter-task communication meet strict time constraints, the HRT deadlines; and do es not allow one task to blo ck another task gives sig- nicantadvantages over lo ck-based schemes b ecause: Partially supp orted byARTES, a national Swedish strategic research initiative in Real-Time Systems and TFR the Swedish 1. it do es not give priorityinversion, avoids lo ckcon- Research Council for Engineering Sciences. Local Memory Local Memory Local Memory voys that makescheduling analysis hard and de- lays longer. Processor 1 Processor 2 Processor n 2. it provides high fault tolerance (pro cessor failures will never corrupt shared data ob jects) and elim- k scenarios from twoormoretasks inates deadlo c Real-Time Interconnection Network b oth waiting for lo cks held by the other. I/O Shared Memory 3. and more signicantly it completely eliminates the interference between pro cess schedule and syn- Figure 1. Shared Memory Multiprocessor Sys- chronisation. tem Structure Non-blo cking proto cols on the other hand havetouse more delicate strategies to guarantee data consistency than the simple enforcement of mutual exclusion be- istics of a multipro cessor architecture and describ e the tween the readers and the writers of the data ob ject. formal requirements that any solution to the synchroni- These new strategies on the other hand, in order to b e sation problem that we are addressing must guarantee. useful for real-time systems, should b e ecient in time Section 3 presents our proto col. In Section 4, wegive and space in order to perform under the tight space the pro of of correctness of the proto col. Section 5 is de- and time constraints that real-time systems demand. voted to the schedulability analysis and schedulability In this pap er, we present an ecient non-blo cking exp eriments that compare our non-blo cking proto col solution to the general readers/writers inter-task com- with the lo ck-based one. The pap er concludes with munication problem; our solution allows any arbitrary Section 6. numb er of readers and writers to p erform their resp ec- tive op erations. With a simple and ecient mem- 2. Problem Statement ory management scheme in it, our proto col needs n + m +1 memory slots (buers) for n readers and writers and is optimal with resp ect to space re- m 2.1. Real-time Multiprocessor System Configura- ts. Sorencen and Hemacher in [8] haveproven quiremen tion that n + m +1 memory slots (buers) are necessary. Together with the proto col its schedulability analysis Atypical abstraction of a shared memory multipro- and a set schedulability tests for a set of random task cessor real-time system conguration is depicted in Fig- sets are presented. Both the schedulability analysis ure 1. Each no de of the system contains a pro cessor and the schedulability exp eriments show that the al- together with its lo cal memory. All no des are con- gorithm presented in this pap er exhibits less overhead nected to the shared memory via an interconnection than the lo ck based proto col. Our proto col extends network. A set of co op erating tasks (pro cesses) with previous results by allowing any arbitrary number of timing constraints is running on the system p erform- tasks to p erform read or write op erations concurrently ing their resp ective op erations. Each task is sequen- without trading eciency. In previous work, Simpson tially executed on one of the pro cessors, while each [6], presented a non-blo cking asynchronous proto col pro cessor can serve (run) many tasks at a time. The for task communication b etween 1 writer and 1 reader co op erating tasks now, p ossibly running on dierent which needs 4 buers. Chen and Burns [7] presented a pro cesses, use shared data ob jects build in the shared non-blo cking synchronous proto col for n readers and 1 1 memory to co ordinate and communicate. Every task writer that needs n+1+1 buers. Kop etz and Reisinger has a maximum computing time and has to be com- [2] also presented a non-blo cking synchronous proto col pleted by a time sp ecied by a deadline. Tasks synchro- for n readers and 1 writer that contains a mechanism to nise their op erations through read/write op erations to congure the numb er of buers to the application re- shared memory. quirements, trading memory space for execution time. e also b elieve that the memory managementscheme W 2.2. General Reader/Writer Problem that we intro duce in this pap er and use in our pro- to col is of interest and can b e used as an indep endent In this pap er we are interested in the general comp onent with other non-blo cking shared data ob ject read/write buer problem where several reader-tasks implementations. 1 The rest of this pap er is organised as follows. In throughout the pap er the terms process and tasks are used Section 2 wegive a description of the basic character- interchangably (the readers) access a buer maintained by several Compare_and_Swap(int *mem, register old, new) writer-tasks (the writers). There is no limit on the { length of the buer that can b e increased by the writers temp = *mem; on-line dep ending on the length of the data that they if (temp == old) want to write in one atomic op eration. This shared { data ob ject can b e used to increase the word length of *mem = new; the system. new = old; The accessing of the shared ob ject is mo delled by } a history h. A history h is a nite (or not) sequence else of op eration invo cation and resp onse events. Anyre- new = *mem sp onse event is preceded by the corresp onding invo ca- } tion event. For our case there are two dierent op era- tions that can b e invoked, a read op eration or a write are_and_Swap Figure 2.