Performance modelling of pools in soft real-time design architectures

26
Performance modelling of pools in soft real-time design architectures q Carlos Juiz * , Ramon Puigjaner Dpt. de Ci encies Matem atiques i Inform atica, Universitat de les Illes Balears, Escola Polit ecnica Superior, Ctra. de Valldemossa, km. 7.5, 07071 Palma, Spain Received 1 March 2001; received in revised form 1 October 2001 Abstract Architectures for the design of soft real-time systems typically do not facilitate the use of performance tools that will enable a designer to analyse quantitatively the system. Elementary intercommunication data areas, whose behaviours are characterised by interaction protocols, are the building blocks of many soft real-time systems. Pools are one of these blocks. Although the performance of the whole system can be also determined by simulation, in this article we propose new analytical approximations for basic and priority pools. Basic pool modelling is based on semaphore queues whereas priority pool modelling is inspired in classical non-pre- emptive priority queues. Ó 2002 Published by Elsevier Science B.V. Keywords: Soft real-time systems; Interaction protocols; Pools; Semaphore queues; Priority queues 1. Introduction Real-time systems differ from traditional systems in that they have a dual notion of logical correctness. Logical correctness of a real-time system is based on both the correctness of the output and timeliness. That is, in addition to producing the correct output, real-time systems must produce it in a timely manner. A hard real-time sys- tem is a system that satisfies explicit or bounded response-time constraints whereas a soft real-time system is not so critical to produce an output within a deadline. Thus, www.elsevier.com/locate/simpra q Partially supported by CICYT under project TIC98-1848-CE and also by EU Esprit IV project 23242. * Corresponding author. E-mail addresses: [email protected] (C. Juiz), [email protected] (R. Puigjaner). Simulation Practice and Theory 9 (2002) 215–240 0928-4869/02/$ - see front matter Ó 2002 Published by Elsevier Science B.V. PII:S0928-4869(01)00053-2

Transcript of Performance modelling of pools in soft real-time design architectures

Performance modelling of pools in softreal-time design architectures q

Carlos Juiz *, Ramon Puigjaner

Dpt. de Ci�eencies Matem�aatiques i Inform�aatica, Universitat de les Illes Balears, Escola Polit�eecnica Superior,

Ctra. de Valldemossa, km. 7.5, 07071 Palma, Spain

Received 1 March 2001; received in revised form 1 October 2001

Abstract

Architectures for the design of soft real-time systems typically do not facilitate the use of

performance tools that will enable a designer to analyse quantitatively the system. Elementary

intercommunication data areas, whose behaviours are characterised by interaction protocols,

are the building blocks of many soft real-time systems. Pools are one of these blocks. Although

the performance of the whole system can be also determined by simulation, in this article we

propose new analytical approximations for basic and priority pools. Basic pool modelling is

based on semaphore queues whereas priority pool modelling is inspired in classical non-pre-

emptive priority queues. � 2002 Published by Elsevier Science B.V.

Keywords: Soft real-time systems; Interaction protocols; Pools; Semaphore queues; Priority queues

1. Introduction

Real-time systems differ from traditional systems in that they have a dual notionof logical correctness. Logical correctness of a real-time system is based on both thecorrectness of the output and timeliness. That is, in addition to producing the correctoutput, real-time systems must produce it in a timely manner. A hard real-time sys-tem is a system that satisfies explicit or bounded response-time constraints whereas asoft real-time system is not so critical to produce an output within a deadline. Thus,

www.elsevier.com/locate/simpra

q Partially supported by CICYT under project TIC98-1848-CE and also by EU Esprit IV project 23242.* Corresponding author.

E-mail addresses: [email protected] (C. Juiz), [email protected] (R. Puigjaner).

Simulation Practice and Theory 9 (2002) 215–240

0928-4869/02/$ - see front matter � 2002 Published by Elsevier Science B.V.

PII: S0928-4869 (01 )00053-2

in soft real-time systems, significant tolerance can be permitted and the softwaretends to be large and complex in comparison with hard real-time systems [22].

A real-time network architecture models a system in terms of a set of connectedcomponents. The connections contain data, which is shared among the connectedprocesses included in the components, but which is not owned by them [24]. Oneof the most usual approaches is based on the concept of a system as a set of inter-acting components. These components are basically processes, intercommunicationdata areas and paths that make sub-systems. Thus, the processing system is com-posed by connected sub-systems [10]. In order to characterise the interaction betweenthe components it is necessary to express a protocol representing the timing con-straints on the interaction and to its support by an explicit interconnection in the im-plemented system.

A software design defines how a software system is structured into componentsand also defines the interfaces among them. The nature of each component dependson the concepts and strategies employed by a method. A software design method is asystematic approach for creating a system design. During a given design step, themethod may provide a set of structuring criteria to help the designer in decomposingthe system into its components. For the soft real-time system design, a major contri-bution came with the introduction of the MASCOT notation, which provided a sys-tematic design method [23]. MASCOT was developed at Royal Signals and RadarEstablishment and has been adopted by the UK. Ministry of Defence as standard ap-proach for the development of software systems. The accurate and timely transfer ofdata between concurrent processes is of crucial importance in the exploitation inreal-time data processing systems. Based on a data flow approach, the MASCOT no-tation formalised the way tasks communicate asynchronously with each other via in-teraction protocols, which are information hiding modules that encapsulate shareddata structures. The interaction protocols are grouped into four families, namely,pool, signal, channel and constant [25]. A pool allows reference data to be passed fromone process to another. However, software methods for designing real-time systems,e.g., MASCOT, do not usually provide any performance tools that permit the eval-uation of the system under study [11].

On the other hand, it is assumed that the main value of queueing models is usuallyas high-level models of computer system performance to get an overall view ofwhether it can meet its performance goals, but for more detailed performance anal-ysis, other modelling techniques are needed [8]. Instead of this last assumption, thispaper proposes two queueing-based models for analysing software components,known as pools in the MASCOT design terminology. As final goal, these queueingmodels can be incorporated into a performance library that will complement a soft-ware tool for designing large soft real-time systems.

Moreover, full asynchronism requires that the relative rate, time and duration ofwriting and reading operations are completely unconstrained. However, for asyn-chronous communication to be of any practical value, there are implicit qualitativerequirements concerning data and also quantitative concerning the real-time con-straints. These requirements are applicable where successive record values are setup by a producer or writer process to be accessed by a consumer or reader process.

216 C. Juiz, R. Puigjaner / Simulation Practice and Theory 9 (2002) 215–240

Both processes run freely with no knowledge of the timing communication opera-tions on the other side of the mechanism. A common operation in soft real-time sys-tems is to transfer data between tasks without any need for task synchronisation.Such data movements can be unidirectional or bi-directional, selective or non-selec-tive. This asynchronous communication has lead to the use of two different datatransfer methods: producer–consumer for selective data transfer and readers–writersfor non-selective data transfer [4].

The readers–writers structure is a data storage that can be written to or read fromby any task and at any time [6]. This is a means of sharing data among a number oftasks. Senders (writers) write information into the store and receivers (readers) readsuch entire stored information. Thus, writers and readers do not need to have anyknowledge of each other as independent processes. Despite reading has no effecton the stored data, writing is a destructive operation. Moreover, the usage of theshared data is random. This interaction protocol family is known as pool in MAS-COT terminology. In general a pool is used to hold reference data which is main-tained by one or more updating processes with minimal timing interference. Whenwriter tasks have non-pre-emptive priority over the reader tasks, the component isknown as priority pool. Considering that scheduling priority, the basic pool is definedas a pool without priority scheme. Basic pool modelling is based on semaphorequeues while the priority pool modelling is based on classical solutions for priorityqueueing systems, but both interaction protocols are analysed in this text usingthe same decomposing technique.

In Section 2 we remind the classical semaphore queue, renamed as Single-serverSemaphore queue, and a new Multi-server Semaphore queue is also introduced. Basicand priority pools are going to be developed in Sections 3 and 4. Section 5 is devotedto numerical examples. Finally, the conclusions and open problems are given inSection 6.

2. Semaphore queues

The channel and the basic pool modelling is based on the semaphore queue para-digm. Channel models are analysed in [13–16] based on the algorithm presented in[7]. This section describes the classical semaphore queue, that we renamed as Single-server Semaphore queue (SsSq) to be distinguished from the Multi-server Semaphorequeue (MsSq) proposed in [17]. Both queueing models are used to build a basic pool.

The queueing network shown in Fig. 1 can model a classical semaphore queue. Thequeueing network consists of the service sub-network, which will be referred to as theinner system, and a semaphore station. The semaphore station S consists of an inputqueue f ðSÞ, referred to as the customer queue, and a token queue eðSÞ, referred to asthe resource queue. Customers arrive at the system in a Poisson fashion at the rate ofk. An arriving customer joins the input queue if it finds other customers waiting inthe queue. If it finds the queue empty, then it requests a token from the token queue.If there is a token available in queue eðSÞ, the customer takes a token and then itmoves into the inner system. However, if the token queue is empty, the customer

C. Juiz, R. Puigjaner / Simulation Practice and Theory 9 (2002) 215–240 217

waits in the input queue f ðSÞ until a token becomes available. Thus, the customer isblocked before its service [21]. A customer that enters the inner system joins the ser-vice sub-network. After receiving service, the customer departs from the queueingnetwork and its token joins the token queue. Since a customer cannot enter the innersystem without a token, the total number of customers in the inner system may notexceed C, the maximum number of tokens. If there are tokens in eðSÞ, then thatmeans that there are no customers in the input queue. On the other hand, if thereare customers in the input queue, then eðSÞ is empty.

In Fig. 1, symbols commonly used in Petri nets are introduced in order to depictthe fork and join operations. In particular, the join symbol of Fig. 2 depicts the fol-lowing operation: at the instant that queues f ðSÞ and eðSÞ contain a customer, bothinstantaneously depart from their respective queues and merge into a single cus-tomer. The fork symbol (Fig. 3) depicts the following operation. A customer arrivingat this point is split into two siblings. Fork and join symbols are only used for de-scriptive convenience.

An exact analysis of the queueing system depicted in Fig. 1 is rather difficult.Therefore, it is proposed to analyse it using the decomposition and aggregation ap-proximation [5]. The basic modelling strategy consists of decomposing the queueingnetwork model into an aggregated or flow-equivalent sub-network and the designatedor complement sub-network. Then, the original queueing network (Fig. 1) is short-circuited to make a shorted closed queueing sub-network of the inner system and

Fig. 2. The input queue and the token queue belonging to a semaphore.

Fig. 3. The fork operation: a customer arriving at the transition is split into two siblings.

Fig. 1. The Single-server Semaphore queue (SsSq) model.

218 C. Juiz, R. Puigjaner / Simulation Practice and Theory 9 (2002) 215–240

the remaining semaphore sub-network of Fig. 2. By this way, the flow-equivalent sub-network of the inner system is analysed in isolation to obtain the throughput acrossfor various customer populations (decomposition step). Finally, a load dependent ser-ver can replace the flow-equivalent sub-network in the original queueing network toform an equivalent queueing network. For any given number of customers, the ser-vice rate of the load dependent server is assumed to be equal to the throughput of theflow-equivalent sub-network (aggregation step). In particular, the system shown inFig. 2, the complement sub-network, is analysed assuming that the arrival processat queue eðSÞ is described by a state-dependent arrival rate cðkÞ obtained from theisolated analysis of the flow-equivalent sub-network of the inner system.

This queueing system depicts the semaphore operation described above. The ar-rival process at queue f ðSÞ is assumed to be Poisson distributed and there are C to-kens. It is also assumed that the inter-arrival times available at queue eðSÞ areexponentially distributed with a rate cðkÞ, where k is the number of outstanding to-kens, i.e., C � k is the number of tokens in queue eðSÞ. The state of the system inequilibrium can be described by the tuple ði; jÞ, where i is the number of customersin queue f ðSÞ and j is the number of tokens in queue eðSÞ. The rate diagram associ-ated with this system is shown in Fig. 4, and corresponds to a Single-server Sema-phore queue (SsSq).

As it is shown in the flow rate diagram, the SsSq can be viewed as an extension ofa classical M=M=1 queue. The states ði; 0Þ for i > 0 are similar to the equivalent di-agram of an M=M=1. Let us define these states as infinite states because the inputqueue has unlimited capacity. On the other hand, let us call extended states to thosestates ð0; jÞ for j > 0, corresponding to the inner system description. Finally, let uscall aggregation state to the corresponding borderline between the infinite and the ex-tended states, i.e., the state ð0; 0Þ.

It is noticeable that the SsSq system studied by means of the proposed approxi-mation becomes a birth-and-death process with an arrival rate k and a state-depen-dent service rate cðnÞ if n6C, and cðCÞ, if n > C, where n is the number ofcustomers in this queue. The random variables, i and j, are related to n as follows:i ¼ maxð0; n� CÞ and j ¼ maxð0;C � nÞ, which are essentially equivalent to thenumber of customers waiting in the queue and to the number of customers in thebuffer, respectively. The solution of this system is obtained by a direct applicationof classical birth-and-death process results. Thus,

pði; 0Þ ¼ qipð0; 0Þ; ð1Þ

pð0; jÞ ¼ PðjÞkj pð0; 0Þ; ð2Þ

Fig. 4. Flow rate diagram of a Single-server Semaphore queue (SsSq) with k arrival rate and cðkÞ state-de-

pendent service rate, respectively.

C. Juiz, R. Puigjaner / Simulation Practice and Theory 9 (2002) 215–240 219

where q ¼ k=cðCÞ and

PðjÞ ¼Qj�1

k¼0 cðC � kÞ; j > 0;

1; j ¼ 0:

(ð3Þ

The probability of the aggregation state, pð0; 0Þ, is chosen so that the equilibriumstate probabilities add up to 1:

pð0; 0Þ�1 ¼ 1

1 � qþXCj¼1

PðjÞkj : ð4Þ

However, all these expressions have been obtained assuming that cðkÞ is known. Thiscan be approximately obtained by studying the closed flow-equivalent sub-network ofthe inner system. The analysis of this queueing network can be easily carried outsince it has been assumed that this sub-network is of the BCMP type. Therefore, thethroughput of this network can be computed for different values of k, the number ofcustomers, where k ¼ 1; 2; . . . ;C. Finally, this throughput is set equal to the arrivalrate cðkÞ of tokens at the token queue eðSÞ. The solution existence condition isk < cðCÞ, where cðCÞ is the maximum throughput and q < 1 [18].

On the other hand, a Multi-server Semaphore queue (MsSq) S is identically con-stituted by its input queue f ðSÞ and its token queue eðSÞ, where there are C tokensavailable. A customer that enters the inner system, receives the required service.Nevertheless, the service rate obtained depends on the number of the customers in-side the inner system. In fact, the main difference between a classical Single-serverSemaphore and a Multi-server one is the concurrent service of the customers whenthey are in the inner system. After service completion the token joins the tokenqueue and the customer departs from the queue. Since a customer cannot enterthe inner system without a token, the total number of customers obtaining the re-quired service simultaneously may not exceed C, the maximum number of tokens.The arrival process at queue f ðSÞ is assumed to be Poisson distributed and thereare C tokens. It is also assumed that the inter-arrival times, available at queueeðSÞ, are exponentially distributed with the rate eðkÞ ¼ kcðkÞ. The state of the sys-tem in equilibrium can be described by the tuple ði; jÞ, where i is the number of cus-tomers in queue f ðSÞ and j is the number of tokens in queue eðSÞ. The rate diagramassociated with the Multi-server Semaphore queue (MsSq) is shown in Fig. 5. Now,it is possible to realise the similitude between the diagrams of Figs. 4 and 5 as ex-tensions of a M=M=1 and a M=M=C, respectively. Thus, in order to consider sys-tems in which a number of active servers depend on the number of the customerspresent, the state-dependent service rate of the inner system, cðkÞ is weighted by thenumber of servers available in parallel. These weights are necessary since cðkÞ iscomputed taking k customers and only one server inside the inner system. There-fore eðkÞ corresponds to the state-dependent service rate for k simultaneous busyservers.

The solution existence conditions is expressed as k < eðCÞ ¼ CcðCÞ, the corre-sponding maximum throughput of S. Under these assumptions, it can be computedthe following steady-state probabilities from the global balance equations:

220 C. Juiz, R. Puigjaner / Simulation Practice and Theory 9 (2002) 215–240

pði; 0Þ ¼ ðCqÞi

Cipð0; 0Þ ¼ qipð0; 0Þ 8i; 06 i6C; ð5Þ

pði; 0Þ ¼ CCqi

CCpð0; 0Þ ¼ qipð0; 0Þ 8iPC; ð6Þ

pð0; jÞ ¼ PðjÞkj pð0; 0Þ; ð7Þ

where

q ¼ k=eðCÞ ¼ k=½CcðCÞ�and

PðjÞ ¼Qj�1

k¼0 eðC � kÞ; j > 0;

1; j ¼ 0:

(ð8Þ

Consequently, the probability of the aggregation state, pð0; 0Þ, is given by the nor-malisation equation as follows:

pð0; 0Þ�1 ¼ qC

1 � qþXC�1

j¼0

ðCqÞj

CjþXCj¼1

PðjÞkj : ð9Þ

As it can be observed, the calculation of the marginal probabilities of the infinitestates, from i ¼ 0 to C � 1 and beyond, are equivalent (Eqs. (5) and (6)). In fact, thefirst two summands of (9) can be joined into only one. However, whereas the SsSq isan extension of the M=M=1, the MsSq is an extension of the M=M=C and that is thereason to distinguish the first C terms of the infinite part in the queue (central sectionin Fig. 5). Thus, the calculation of some performance measure, e.g. the mean queuelength of a MsSq, have to take into account the shift of size C expressed in Eq. (5).This shift of the infinite series computation for the infinite states, in comparison with

Fig. 5. Flow rate diagram of a Multi-server Semaphore queue (MsSq) with k arrival rate and eðkÞ ¼ kcðkÞstate-dependent service rate, respectively.

C. Juiz, R. Puigjaner / Simulation Practice and Theory 9 (2002) 215–240 221

the M=M=C, is produced due to the existence of the extended states and conse-quently, the corresponding weight of every marginal state probability, from i ¼ 0 toC � 1.

Nevertheless, all these expressions have been calculated assuming that cðkÞ isknown. This can be approximately obtained by studying the closed flow-equivalentsub-network as a BCMP type service queueing network. Therefore cðkÞ, the through-put of this network, can be computed for different values of the number of custom-ers, where k ¼ 1; 2; . . . ;C. As we remarked above, the corresponding rates eðkÞ aregiven by

eðkÞ ¼ kcðkÞ: ð10ÞIn Section 3 we are going to describe a new approximate analytical model of pool bythe application of the SsSq and MsSq paradigms.

3. Basic pool

There are several variants of the readers–writers problem, but the basic structureis the same. Tasks are of two types: reader tasks and writer tasks. All tasks share acommon variable or data object. Reader tasks never modify the object, while writertasks do modify it. Thus writer tasks must mutually exclude all other reader and wri-ter tasks, but multiple reader tasks can access the shared data simultaneously. Once awriter enters in the pool, readers remain blocked outside whereas once any number ofreaders are in the pool (up to C readers) writers remain blocked outside. Then C is themaximum number (capacity) of readers inside the pool.

In Fig. 6, we remind the classical untimed Petri net representing the readers–writ-ers problem [20].

Consider a system where several tasks are writing or reading a common resource.A possible Petri net model of this system is one of Fig. 6, where the places Readers

Fig. 6. Classical untimed Petri Net modelling the synchronisation of the readers–writers problem.

222 C. Juiz, R. Puigjaner / Simulation Practice and Theory 9 (2002) 215–240

(p2) and Reading (p4) specify the number of readers currently not reading and actu-ally reading, respectively. The places Writers (p1) and Writing (p3) have a similarfunction for modelling the state of the writers. The central place Mutex (p5) repre-sents a semaphore, lets us call S, initialised with C for the internal counter, i.e., C to-kens. Therefore, when tokens arrive to place Readers from the outside means thatthere are reader tasks trying to access to the common resource. If there are any tokenavailable in S, the corresponding immediate transition, t2, fires. So, the semaphorecounter decrements in one unit and the Reading place is marked with one more to-ken. If there are no tokens available in S then the reader tasks wait in the place Read-ers. On the other hand, when tokens arrive to place Writers from the outside meansthat there are writer tasks trying to access to the common resource. If there are all thetokens available in S, the corresponding immediate transition, t1, fires. So, the sema-phore counter decrements in C units (empty place) and the Writing place is markedwith only one token. Once a reader or writer task ends the access to the common re-source the corresponding immediate transition fires, t4 or t3, turning back the tokensto the semaphore, i.e., the task exits from the critical section. In terms of the readers–writers system this functionality means:

If a reader is reading, no writer is writing because there are less than C tokensavailable in S (no tokens in place p3).

If a writer is writing, no reader is reading because there are no tokens availablein S (no tokens in place p4).

At most one writer is writing because once a writer takes all the tokens thereare no other for any task (see the multiplicity of the arcs).

In fact these last properties can be shown when the number of reader and writer tasksare bounded by means of solving the P-invariants of the Petri net [2].

This Petri net with immediate transitions does not reflect any delay due to thereading and writing processes or any inter-arrival time between tasks. Let us trans-form the untimed Petri net (or place-transition net) of Fig. 6 into a Generalised Sto-chastic Petri net (GSPN) [1,27] by changing some immediate transitions for timedtransitions in order to depict the arrival and the departure frequency of the readerand writer tasks. Stochastic Petri nets (SPNs) are, like queueing networks, agraph-based modelling formalism allowing for the easy specification of finite-statemachine models. Assume that all the timed transitions are exponential, i.e., the firingtime is exponentially distributed. Tasks arrive at the basic pool in Poisson fashion atrates kw and kr, where kw is the arrival rate for writers and kr the arrival rate for read-ers. Service rate for writers is lw and klr is the service rate for the kth reader at theinput queue. Due to the limited simultaneous service for the readers at pool, their ser-vice rate is proportional to their number, i.e., from lr in the case of one reader, toClr, in the case of C readers (this is known also as marking dependable service rate).In Fig. 7, a timed Petri net is proposed to incorporate these delays. The service ratedependent of the marking in the place Reading is reflected by the expression inf-serv,meaning infinite servers available but there are only up to C servers for the maximumnumber of readers (see the initial marking in p5). This descriptive expression can befound in DSPNexpress [19] a software package for the specification and solving of avariety of deterministic and SPN models.

C. Juiz, R. Puigjaner / Simulation Practice and Theory 9 (2002) 215–240 223

The unforgettable advantage of the timed Petri nets is that under suitableassumptions regarding the involved stochastic timing, SPN models can be mappedautomatically to an underlying Continuous Time Markov Chain (CTMC) with thefinite state space. This holds even in the case of GSPNs where there are exponen-tial and immediate transitions. Such a CTMC can then be analysed numerically,thus yielding performance information about the SPN. A problem occurs, how-ever, if the number of readers and the number of writers are unbounded as inthe basic pool. In Fig. 7, places Readers (p1) and Writers (p2) may have infinitemarking since the respective sources (exponential transitions k1 and k2) can gener-ate any number of readers or writers. Various solutions have been proposed forthis problem, e.g., the use of state space truncation techniques or lumping tech-niques. In all these cases the solution lies in circumventing the generation of thelarge overall state space.

On the other hand, the analysis of the queueing models with an unboundedstate space is often simpler than analysing similar models on a finite space. Thissuggests the idea of studying SPNs that have an unbounded state space. Insteadof generating and solving a very large but finite SPN, we solve infinitely largeCTMCs derived from special SPNs (more precisely GSPNs). These GSPNs withunbounded state space are also known as one-place unbounded SPNs or infinite-state SPNs, abbreviated as iSPNs [9]. However, this class of SPNs only may con-tain one place with infinite number of tokens. This is not the case of the basic poolwhere we should need two places with infinite number of reader and writer tokens,respectively. We are going to refer to this model’s drawback as the infinitenessproblem.

But the infiniteness is not the unique problem that appears in the model of Fig. 7(and also in Fig. 6). There is a conflict between the immediate transitions, t1 and t2,i.e., both transitions are enabled since there are C tokens available in the place Mu-tex. This conflict occurs because both transitions are activated and the firing of one

Fig. 7. Timed Petri Net proposed in order to incorporate the arrival and departures rate of the readers–

writers problem.

224 C. Juiz, R. Puigjaner / Simulation Practice and Theory 9 (2002) 215–240

results in the deactivation of the other. The conflict itself is not the problem, in fact,it is part of the readers–writers behaviour due to the task competition for the re-source. Moreover, putting different weights, x1 and x2, to these immediate transi-tions, the conflict could be solved. Since weights express a switching probability,the probability of firing ti is xi=ðx1 þ x2Þ where i ¼ 1; 2. Therefore a key issue arisesfrom these statements, while timed transitions fire after a random exponentiallydistributed enabling time, immediate transitions fire in zero time. That is, if bothtimed and immediate transitions are enabled, then by definition of the GSPNs, onlythe immediate transitions are actually enabled. Thus, in Fig. 7, firing of t1 or t2 haspriority over the firing of l1 or l2. More precisely, no reader can be serviced whilethere are readers are waiting outside and enough capacity in the critical section.So, readers would have priority over the writers to access to the critical section,but there is no priority in a basic pool. We are going to refer to this model’s drawbackas the switching probability problem.

The inescapable conclusion which emerges from what it has explained about theGSPN of Fig. 7 is that its behaviour does not reflect the aim of the readers–writersproblem. But paradoxical though it may seem, its model provides us a basis where toarrive to an approximate solution for the infiniteness problem by applying the sema-phore queue paradigm and the analysis of the resulting model provide us also theway to solve the switching probability problem. Let us begin with the modellingand performance analysis proposed for the basic pool.

We have to remind that decomposition and aggregation is the method used to solvea semaphore queue. So, we can separate the infinite input, for the arrival of writersand readers, from the inner critical section. Ideally, the infinite input can be modelledas a queue and the critical section as a SPN (in general sense). This approximationhas a major advantage that is taken in a natural form from two stochastic formal-isms: it will be possible to model the arrival of writer or reader tasks as unboundedand independent queues meanwhile their respective mutually exclusive services willbe modelled with the powerful of a SPN.

However the decomposition and aggregation is almost never a cost-free method.In order to solve a semaphore queue, it is indispensable the knowledge (a priori)of the departure throughputs for all customer classes. But these throughputs aredepending not only of the resolution of the inner system, but also depending ofthe type of semaphore queue. Since writers obtain a mutually exclusive service in-side their class and readers permit some sharing, we cannot easily model bothclasses in the same queue. That is, we cannot mix a SsSq and a MsSq scheme intothe same queue because the state diagrams are different. So, we separate both cus-tomer classes into two different input queues sharing a mutually exclusive service.This separation of the input queues into the writers input queue and the readersinput queue provokes the loss of the order between writers and readers. Thus,when a writer arrives to the head of its input queue and finds the pool with somenumber readers (or another writer) inside, the incoming writer must remainblocked until the service of all the readers (or the other writer) is finished. Thenthe incoming writer will enter into the pool even other readers have arrived after-wards. This situation is similar when a reader arrives to the head of its input

C. Juiz, R. Puigjaner / Simulation Practice and Theory 9 (2002) 215–240 225

queue, but in this case a writer (or C readers) is being serviced in the pool. Then,the apparent disadvantage of separating the input queues turns into an advantagebecause the FIFO order inside each class avoids to calculate the blocking (fullcondition) shift in the infinite-state series calculation (see the previous section).Moreover, both task classes can be generated by independent sources. However,the price to be paid for this approximation is seeking not only two different valuesof state-dependent service rates for writers and readers (departure throughputs),but also two different kind of state-dependent service rates, as we are going to de-velop in this section. These requirements lead to characterise by parts the criticalsection (inner system) and the unbounded and independent arrival of readers andwriters (input queues).

In Fig. 8, two semaphore queues are used to model a pool, a SsSq for the writersand a MsSq for the readers. As in the development of the semaphore queue para-digm, the join and fork transitions are only used for descriptive convenience (see pre-vious section) and this feature turns us back to the switching probability problem.The join transitions of the semaphore queues have the same meaning of the transi-tions t1 and t2 of Fig. 7, but in semaphore queues have only the similitude of the bor-derline between the input and token queues and the inner system. These borderlinesare only for descriptive convenience but a mechanism to disable the conflict betweenwriters and readers in the critical section, when there are enough tokens available,must be implemented. Let us remind that if the critical section is modelled with t1

and t2 as immediate transitions, the firing race, among timed and zero timed transi-tions, has no sense because immediate transitions will always fire first. So, we canmodel the critical section as a SPN, where all the transitions are exponentially dis-tributed. By this way, we do not need to concern ourselves with the priority of thetransitions since there are no firings in zero time and the inner system will describea continuous-time Markov process instead of describing an indirect underling Mar-kov process (including vanishing markings) of a GSPN. By this way it is possible toexpress the switching probability, i.e., the mutually exclusive service inside the criticalsection. The solution consists on relating the relative utilisation of each customer

Fig. 8. Writer and reader semaphore queues representing a pool.

226 C. Juiz, R. Puigjaner / Simulation Practice and Theory 9 (2002) 215–240

class into the model of the critical section and then trying to find the departurethroughputs of the tokens flowing to the respective token queues outside the innersystem (see Fig. 8).

Assume that the maximum number of accepted readers in the pool is set equal to alimited number of available tokens of the semaphore S. Therefore, the system in equi-librium can be described by ði; j; kÞ; where i is the number writers, j is the number oftokens available and k is the number of readers in the critical section. Since readersand writers are waiting in their respective input queue, outside the inner system, theassociated rate diagram of the extended states in the pool inner system is the classicalCTMC of Fig. 9.

This CTMC is isomorphic to the correspondent reachability graph of the writing/reading critical section in the Petri Net (PN) of Fig. 6, once it is limited and trans-formed in the corresponding SPN including timed transitions in arrivals and depar-tures and also the reader’s capacity expressed above. This new SPN is shown inFig. 10.

To recap, we avoid the joint use of timed and immediate transitions, and then afinite or infinite (one-place) GSPN for the readers–writers modelling that would notimpede the infiniteness and the switching probability problems. Also, the service(and indirectly the blocking before service) of the tasks in the critical section canbe depicted with lower level of detail with an underlying CTMC than it wouldbe modelled with a closed form solution queues. And finally, although the arrivalamong writers or readers are not a priori ordered, there is FIFO order inside bothclasses of customers, therefore it is possible model the arrival input with two dif-ferent FIFO queues.

Under these conditions, this simple CTMC is easily computed and the probabilityof the initial state Pð0;C; 0Þ solved. This initial state corresponds to the one when notask is in service, i.e., there are C tokens available. Therefore

Fig. 9. Continuous Time Markov Chain representing the flow rate diagram in the pool critical section.

Fig. 10. SPN modelling of the critical section with exponential transitions.

C. Juiz, R. Puigjaner / Simulation Practice and Theory 9 (2002) 215–240 227

P ð0;C; 0Þ ¼ 1 1

(,þ Xw þ

Xn

j¼1

Xjr

j!

); ð11Þ

where the nominal utilisation per class, Xw and Xr, are defined as

Xw ¼ kw

lw

; ð12Þ

Xr ¼kr

lr

: ð13Þ

Consequently, the steady-state probabilities of the CTMC are obtained from theinitial state and the global balance equations:

P ð1; 0; 0Þ ¼ XwP ð0;C; 0Þ; ð14Þ

P ð0;C � k; kÞ ¼ Xkr

k!P ð0;C; 0Þ: ð15Þ

Then, the probability distribution of tokens is known. This probability distributioncontains C þ 2 states: P ð0;C; 0Þ is the marginal probability of empty pool; P ð1; 0; 0Þis the marginal probability of the pool being accessed by the exclusive writer; andfinally, C states, where Pð0;C � k; kÞ is the probability of the pool being accessed by ksimultaneous readers.

Since the state probabilities at the critical section are computed including the ar-rival rates of the customers at the pool (either one writer or up to C readers), in orderto avoid the switching probability problem, we shall have to consider this inclusion indeparture token rates calculation.

However, the number of reader and writer tasks is not bounded, and they are in-dependent arrival processes. When the pool is fully accessed, other writer and readertasks have to wait in FIFO scheduling discipline but there is no knowledge about thecustomer class order in the waiting queue. On the other hand, while the writers arealways mutually exclusive, up to C readers may share the pool. Then, as we explainabove, we propose the use of two different semaphore queues to model basic pool, aSingle-server Semaphore queue (SsSq) for the writer tasks modelling and a Multi-ser-ver Semaphore queue (MsSq) for the reader tasks modelling, respectively. The use oftwo semaphore queues prevents the infiniteness problem and also guarantees theblocking-before-service at the input queues when critical section is full according tothe readers–writers paradigm.

In consequence, the writers queue is a Single-server Semaphore queue W consti-tuted by its input queue f ðW Þ and its token queue eðW Þ, where there is only a tokenavailable. An arriving customer, a writer task, joins the input queue if it finds othercustomers waiting in this queue. If it finds the queue empty, then it requests the un-ique token from the token queue. If the token is available in queue eðW Þ, the cus-tomer takes the token and then it moves into its critical section. However, if thetoken queue is empty, the customer waits in the input queue f ðW Þ until the tokenbecomes available.

228 C. Juiz, R. Puigjaner / Simulation Practice and Theory 9 (2002) 215–240

A writer task that enters the inner pool, receives the required service. However,the service rate obtained is less than the nominal rate due to the readers utilisation.After service completion the token joins the token queue and customer departsfrom the semaphore queue. Since a customer cannot enter the inner pool withoutthe token, the total number of writers in its critical section may not exceed 1. Ifthere is the token in eðW Þ, then that means that there are no customers in the inputqueue. On the other hand, if there are customers in the input queue, then eðW Þ isempty.

On the other hand, the readers queue is a Multi-server Semaphore queue R consti-tuted by its input queue f ðRÞ and its token queue eðRÞ, where there are C tokensavailable. An arriving customer, a reader task, joins the input queue if it finds othercustomers waiting in this queue. If it finds the queue empty, then it requests a tokenfrom the token queue. If there is at least a token available in queue eðRÞ, the cus-tomer takes the token and then it moves into its critical section. However, if the to-ken queue is empty, the customer waits in the input queue f ðRÞ until a tokenbecomes available.

A reader task that enters the inner pool, receives the required service. Neverthe-less, the service rate obtained depends on the number of the readers inside the pooland it is less than the nominal service rate due to the writer exclusive utilisation. Af-ter service completion the token joins the token queue and the customer departsfrom the Multi-server Semaphore queue. Since a customer cannot enter the inner poolwithout a token, the total number of readers in its critical section may not exceed C,the maximum number of tokens. If there are tokens in eðRÞ, then that means thatthere are no customers in the input queue. On the other hand, if there are customersin the input queue, then eðRÞ is empty.

Writer and reader tasks cannot be served concurrently, that is, both task classesare delaying the service to each other. In fact, they are mutually exclusive and thentheir critical section never is executed in parallel. Therefore, writer and reader sema-phore queues are sharing a mutually exclusive server with their respective class de-pendent service rate.

Although arrivals to f ðW Þ and f ðRÞ are independent, the arrival of tokens atqueues eðW Þ and eðRÞ are described by two different state-dependent rates, x forthe writer token and eðkÞ for the reader tokens. The semaphore queues are solvedby decomposition and aggregation as we explained in previous section, taking into ac-count that W only has one extended state, while R has C different extended states.Therefore, these queueing systems depict the semaphore operations described above.

The arrival process at queue f ðW Þ is assumed to be Poisson distributed. It isalso assumed that the inter-arrival times available at queue eðW Þ are exponentiallydistributed with rate x. The state of the system in equilibrium can be described bythe tuple ði; jÞ, where i is the number of customers in queue f ðW Þ and j is the num-ber of tokens in queue eðW Þ. The rate diagram associated with this system isshown in Fig. 11. This semaphore queue is similar to the one described in the pre-vious section.

The arrival process at queue f ðRÞ is assumed to be Poisson distributed and thereare C tokens. It is also assumed that the inter-arrival times at eðRÞ are exponentially

C. Juiz, R. Puigjaner / Simulation Practice and Theory 9 (2002) 215–240 229

distributed with the rate eðkÞ. The state of the system in equilibrium can be describedby the tuple ði; jÞ, where i is the number of customers in queue f ðRÞ and j is the num-ber of tokens in queue eðRÞ. The rate diagram associated with the MsSq is shownagain in Fig. 12 and it is equivalent to Fig. 5.

The solution existence conditions are expressed as kw < x and kr < eðCÞ, the cor-responding maximum throughputs of W and R, respectively. Under these assump-tions, it can be computed the steady-state probabilities from the global balanceequations for the writers semaphore queue and also for the readers semaphore queueusing (1)–(10).

Nevertheless, these calculations are obtained assuming that the service rates(departure rates) of the semaphore queues, x and the vector eðkÞ, are known.The use of two different semaphore queues guarantees the customer blocking be-fore its service and the finiteness of the resource. On the other hand, to guaran-tee the mutual exclusion between writer and reader tasks into the inner system ofthe pool, i.e., inside the critical section, it would be equivalent to take the uniquewriter token at queue eðW Þ than to take the C readers tokens at queue eðRÞ, atthe same instant. When there is a writer task inside the critical section of thepool, there are no tokens available, i.e., neither writer tokens nor reader tokens.When there are k reader tasks in the inner system of the pool, there are onlyC � k reader tokens available but they are not available for writers. These fea-tures may not avoid the state space explosion for the computation of theCTMC, however only the smaller capacities are of interest as we overview inthe numerical examples.

Thus, the departure rates of x and eðkÞ are given by:

x ¼ ½1 � P ð0;C � 1; 1Þ�lw; ð16Þ

eðkÞ ¼k½ð1 � XwÞ�lr; Xw 6Xr;

k½P ð0;C; 0Þ�lr; Xw > Xr:

�ð17Þ

These throughput values are not surprising. The rate at which the writer tokenreturns to the token queue x (departure flow rate in Fig. 11) is equal to thenominal service rate reduced by the some interaction of the readers in the criticalsection. That is, the nominal service rate, lw, would only guarantee the exclusive

Fig. 12. Flow rate diagram of the readers semaphore queue.

Fig. 11. Flow rate diagram of the writers semaphore queue.

230 C. Juiz, R. Puigjaner / Simulation Practice and Theory 9 (2002) 215–240

service of one writer in competence with other writers queued behind it (waitingin the input queue, outside the critical section), but the value of x must alsodepend on the interaction with the readers. Since the probability of starting asimultaneous service for the readers is P ð0;C � 1; 1Þ, the return flow rate of theunique writer token to eðW Þ is equal to the nominal service rate, lw, reduced bythe probability of the opposite event of P ð0;C � 1; 1Þ, i.e., the probability of noarrival of the first reader, initiating a readers service. When the readers’ service isinitiated, the MsSq that represents the readers takes control. Let us remind thatwe have added the arrival rates to the pool in the CMTC computation to avoidthe switching probability problem but these arrival rate is already included inboth semaphore queue models. From all of this it follows that the value ofP ð0;C � 1; 1Þ corresponds exactly to the calculated values of the markingprobability of being either C � 1 tokens in p2 (Mutex) or one token in p3

(Reading) in the steady-state solution of the SPN shown in Fig. 10. The com-putation of this equilibrium situation requires the numerical solution of a linearsystem of equations that was computed through the direct sparse LU decompo-sition method with dropping, an implementation of the Gaussian eliminationmethod [26].

On the other hand, the vector values eðkÞ are the state-dependent (marking de-pendent) departure rates for k readers, i.e., the rate at which the kth reader tokenreturns to eðRÞ. These rates depend on either the probability of non-utilisation ofthe critical section by the writers, when there should be more writers than readers inthe pool, or the probability of the empty pool, when there should be more readersthan writers in the pool. The probability of non-utilisation of the critical section isthe opposite event of Pð1; 0; 0Þ=P ð0;C; 0Þ, that is, the probability of marking prob-ability of being one token in p1 (Writing) divided by the probability of being C to-kens in p2 (Mutex) in the steady-state solution of the SPN shown in Fig. 10. Thislast probability corresponds to the probability of the empty pool, P ð0;C; 0Þ that isequal to the marking probability of being no token neither in p1 (Writing) nor inp3 (Reading) in the same SPN. Thus, given a number of simultaneous servers andtheir utilisation constant for the reader tasks, if this utilisation is greater or equalto the utilisation of the unique server for the writer tasks then the rate at whichreader tokens return to eðRÞ is reduced by the utilisation writers’ server. But oncethis last utilisation is greater than the nominal utilisation of the readers, the rate atwhich reader tokens return to eðRÞ depends on the probability of a totally freepool. This behaviour can be explained as follows. While the interaction with thewriters is low the service rate for readers is only reduced by their interaction (writerutilisation of the pool). But if this interaction increases even there are enough serv-ers available for the readers, the queue is usually blocked for a writer and then theservice rate has to be penalised, i.e., the mean queue length for the readers at inputqueue increases.

Using these normalisation equations it is possible to compute the probabilities forevery state in W and R, the utilisation of writers and readers and all of the opera-tional characteristics of the pool. In particular, the mean queue lengths per classwould be the sum of the finite and infinite part for each type of task

C. Juiz, R. Puigjaner / Simulation Practice and Theory 9 (2002) 215–240 231

NS ¼XCc¼0

cpSð0;C � cÞ þX1c¼Cþ1

cpSðc� C; 0Þ ¼ NSC þ NS1 8S 2 fW ;Rg: ð18Þ

Both mean queue lengths at finite part, i.e. NC, are finite additions, but due to thedifferent modelling of the semaphore queues, the mean number of writer taskswaiting in its input queue (infinite part) is given by [12]

Nw1 ¼X1c¼2

cpwð0; 0Þqc�1w ¼ pwð0; 0Þ

qw

1 � qw

1

1 � qw

�þ 1

�; ð19Þ

whereas the mean number of reader tasks waiting outside the pool (infinite part) isgiven by

Nr1 ¼X1

c¼2Cþ1

cprð0; 0ÞCCqc�2C

r

CCþ

X2Cc¼Cþ1

cprð0; 0ÞðCqrÞ

c�C

Cc�C; ð20Þ

and then

Nr1 ¼ prð0; 0Þ q2Cr

qr

1 � qr

1

1 � qr

�þ 2C

�þ D

; ð21Þ

where

D ¼PC

j¼1ðC þ jÞ ðCqrÞjCj ¼

PCj¼1ðC þ jÞqj

r 8C > 0;

0; C ¼ 0:

(ð22Þ

Formulae (19) and (20) permit to compute with a good level of accuracy the ap-proximate mean queue lengths of writers and readers at infinite part taking intoaccount the mutual exclusive service of both customer classes. This new blocking-before-service scheme in the basic pool modelling is another contribution of thesemaphore queue applications.

4. Priority pool

The priority pool is also a data storage similar to the basic pool, but writer taskshave non-pre-emptive priority over the reader tasks. Therefore, reader tasks are over-taken by writer tasks, when they are waiting for the pool service. However, if a num-ber of readers are already in service, any arriving writer that always holds higherpriority does not pre-empt them. Inside the reader and the writer classes the queueingdiscipline is FIFO.

This priority scheme simplifies the model at infinite part because the tasks are per-class ordered and then only an input queue is needed. This is because writers (if any)are always first waiting in the head of the input queue. But due to the remaining timeof the customer in service (if any) the approximation becomes more difficult. In con-sequence, the priority pool is a non-pre-emptive priority queue with two classes ofcustomers, the writers or customers of high priority and the readers or customers

232 C. Juiz, R. Puigjaner / Simulation Practice and Theory 9 (2002) 215–240

of low priority. The service is exclusive for writers whereas there are up to C simul-taneous servers available for the readers.

An arriving writer task joins the input queue if it finds writers waiting in thisqueue (because readers are overtaken at input queue). If it finds the queue empty,then it requests the service, i.e., all the tokens. If all the tokens are available thewriter task takes them and then it moves into the critical section. However, if sometokens are not available, i.e., either another writer or some readers are being in ser-vice, the incoming writer waits in the input queue until all the tokens become avail-able, i.e., the customers, that are being serviced, leave the pool. A writer task thatenters the pool receives the required service. After service completion all the tokensjoin the token queue and customer departs from the priority pool. Since a writercannot enter the pool without the C tokens, the total number of writers in the crit-ical section cannot exceed 1.

Otherwise, an arriving reader task joins the input queue if it finds other customerswaiting in this queue. If it finds the queue empty, then it requests a token. If there isat least one token available, the customer takes one token and then it moves into thecritical section. Until C readers can be receiving service simultaneously. However, ifthe token queue is empty, i.e., either a writer or C readers are being in service, thereader waits in the input queue until a token becomes available. Any number of ar-riving writers will overtake any number of readers that are waiting in the inputqueue, before getting their service. A reader task that enters the pool, receives the re-quired service. After service completion the token joins the token queue and the cus-tomer departs from the priority pool. Since a reader cannot enter the inner poolwithout a token, the total number of simultaneous readers in the critical sectionmay not exceed C, the maximum number of tokens. As the service is identical to abasic pool, let us solve again the CTMC of the inner pool of Fig. 10 and as resultwe stated from (11) to (15).

In classical formulae [3] for non-pre-emptive (head-of-line) priority queues withtwo classes of customers, the mean queue length for high priority class customers(writers in our case) is equal to

Nw ¼ kw Sw

þ W0w

ð1 � XwÞ

: ð23Þ

where Sw ¼ 1=lw, is the mean writer’s service time, W0w is the mean remaining serviceand Xw was defined in (12). This remaining service time corresponds to either an-other writer or some readers inside the critical section.

Since the conservation law is not applicable because the server is exclusive forwriters and shared of capacity C for readers, we propose this approximation ofthe mean remaining service time for the writer tasks

W0w ¼ P½ðSwXwÞ þ ðSrXrÞ�; ð24Þwhere Sr ¼ 1=lr, is the mean reader’s service time, Xr was defined in (13) and P isequal to

P ¼ ½Pð0;C; 0Þ þ P ð1; 0; 0Þ þ P ð0;C � 1; 1Þ�: ð25Þ

C. Juiz, R. Puigjaner / Simulation Practice and Theory 9 (2002) 215–240 233

This value corresponds to addition of the probability of the empty pool, P ð0;C; 0Þ,the probability of the pool serving a writer task, P ð0; 0; 1Þ, and finally, the prob-ability of the pool serving the first reader, Pð1;C � 1; 0Þ. In other words, P is thesum of the marking probabilities of having C tokens in p2 (Mutex), one token in p1

(Writing) and another token in p3 (Reading) in the steady-state solution of the SPNof Fig. 10. Since both classes of customers are queuing in the same station, theservice between classes is exclusive, i.e., the station is utilised by either a writer or anumber of simultaneous readers (or even idle, of course). Let us take C ¼ 1, in thiscase P ¼ 1 (total probability) because the server is utilised by either one writer orone reader and therefore W0w is exactly the value calculated with classical formulasfor non-pre-emptive priority queues. But the service of a given reader can beshared with other readers, so if C > 1 then remaining service time is reduced in (24)as many simultaneous readers can be in service. This is the meaning of the pro-posed value of P, it corresponds to the probability of reducing the remainingservice time for the writers due to the simultaneity of the service of the readers.That is, as in classical multi-server queues, given an utilisation constant, the meanqueue length of the waiting line decreases with the increment of the availableservers. So, in priority pools, the mean remaining service time for the writers isreduced and also their mean queue length, depending on the number of possiblesimultaneous readers.

On the other hand, in Cobham formulas, the mean queue length for low priorityclass customers (reader tasks) is as follows:

Nr ¼ kr Sr

þ W0r

ð1 � XwÞð1 � Xw � Xr=CÞ

; ð26Þ

where W0r is the mean remaining service of either a writer or up to C readers in thepool, and also depends on the sum of probabilities P as

W0r ¼PðSwXwÞ þ ½1 � Pð0;C; 0Þ�ðSrXrÞ; Xw 6Xr;½P � P ð0;C � 1; 1Þ�ðSwXwÞ þ ½1 � Pð1; 0; 0Þ�ðSrXrÞ; Xw > Xr:

�ð27Þ

As in the basic pool the mean queue length for the readers depends on the rela-tionship between the values expressed in (12) and (13).

On the other hand the proposed mean remaining service times for the customersin the critical section is not equivalent for the writers and the readers. Let us take adetailed reading of (27). The remaining service time for the readers has two differentcases, each of them with different weights for the average service times per class. Ifthe nominal utilisation of writers is less or equal to the nominal utilisation of readersthen the weight of the average service time for the writer class is reduced by the nom-inal utilisation (12) of writers multiplied by the probability P. In this case, the weightof the average service time for the reader class is reduced by the nominal utilisation(13) of readers multiplied by the probability of a busy pool. On the other hand, oncethe nominal utilisation for writers is increasing until its value is greater than the nom-inal utilisation of readers, the corresponding weights have to be balanced as follows.The probability of an empty pool plus the probability of a writer being at pool reducethe weight of the average service time for the writers. In this last case, the weight of

234 C. Juiz, R. Puigjaner / Simulation Practice and Theory 9 (2002) 215–240

the average service time for the readers is reduced by the probability of no writer be-ing at pool.

By this way the mean remaining service time for the writers is always less than theequivalent value in a non-pre-emptive priority M=M=1 queue with two customerclasses due to the simultaneous service of the readers and the blocking that this pro-duces to the writers. Moreover, the mean remaining service time for the readers isalways much longer than the equivalent value in a non-pre-emptive priorityM=M=C queue due to the exclusive service of the writers and the blocking that thisproduces to the readers.

5. Numerical examples

The different examples have been simulated in such a way to obtain a confidenceinterval of at least 5% of the considered mean queue lengths. All examples take kw,the arrival rate for writers, equal to kr, the arrival rate for readers and the servicetime for writers and readers as the unit. By this way, it is easier to compare the resultsbetween the application of the Single-server Semaphore queue of the writers and theapplication of the Multi-server Semaphore queue of the readers. (See Figs. 13–16 andTables 1, and 2).

In these numerical examples, and others not included in the text, the difference be-tween the simulation and the analytical approximation values for the performancemeasurements, is less than 5%. Only when the overall pool utilisation is more than80% this difference reaches to more than 10%. As in the classical Single-server Sema-

Fig. 13. Mean queue lengths of the writer and reader tasks as function of the same mean inter-arrival

period at basic pool.

C. Juiz, R. Puigjaner / Simulation Practice and Theory 9 (2002) 215–240 235

phore queue (SsSq) approximation, the major differences appeared in the Multi-ser-ver Semaphore queue (MsSq) when the pool utilisation is close to the server collapse.

6. Conclusions and open problems

This article has proven the possibility of building approximated analytic modelsof soft real-time interaction protocols such as the basic pool and the priority pool.

Fig. 15. Mean queue lengths of the writer and reader tasks as function of the same inter-arrival time at

priority pool.

Fig. 14. Mean queue lengths of the writer and reader tasks as function of the maximum number of readers

(capacity) at basic pool.

236 C. Juiz, R. Puigjaner / Simulation Practice and Theory 9 (2002) 215–240

Table 1

Mean response times computed with simulation and the semaphore queue approximations for writer and

reader tasks in the basic pool modelling ðl�1w ¼ Cl�1

r Þ

Inter-arrival

time

Max. num.

readers

Writers

simulation

Writers

approx.

Readers

simulation

Readers

approx.

3 2 2.1243 2.1135 1.5630 1.5765

4 2 1.6948 1.7044 1.3740 1.3668

5 2 1.5065 1.5170 1.2830 1.2685

10 2 1.2240 1.2240 1.1190 1.1150

3 5 2.0913 2.1102 1.5051 1.5000

4 5 1.6752 1.7036 1.3440 1.3333

5 5 1.5500 1.5170 1.2635 1.2500

10 5 1.2230 1.2240 1.1190 1.1110

Fig. 16. Mean queue lengths of writer and reader tasks as function of the maximum number of readers

(capacity) at priority pool.

Table 2

Mean response times computed with simulation and the semaphore queue approximations for writer and

reader tasks in the basic pool modelling ðl�1w ¼ Cl�1

r Þ

Inter-arrival

time

Max. num.

readers

Writers

simulation

Writers

approx.

Readers

simulation

Readers

approx.

3 2 1.9482 1.9977 2.3220 2.3871

4 2 1.6452 1.6532 1.6708 1.7076

5 2 1.4875 1.4930 1.4420 1.4575

10 2 1.2200 1.2210 1.1470 1.1520

3 5 1.9395 1.9641 2.1012 2.1546

4 5 1.6404 1.6520 1.6100 1.6312

5 5 1.4840 1.4925 1.4105 1.4215

10 5 1.2160 1.2210 1.1460 1.1470

C. Juiz, R. Puigjaner / Simulation Practice and Theory 9 (2002) 215–240 237

These protocols are typical members of the pool family in soft real-time architec-tures. The advantages of such types of performance models are the saving of hu-man debugging and computational times compared to the correspondingsimulation models.

By the use of the decomposition and aggregation method, the proposed approxi-mate analytical models avoid the need of using a simulation with a reasonable degreeof accuracy.

In soft real-time systems, several tasks, with or without any priority scheduling,attempting to access a common resource may be excluded while one task has posses-sion. This policy can be achieved with such primitives as locks. This effect is generallygiven as example of what queueing networks cannot model well. However, a newMulti-server Semaphore queue (MsSq) combined with a classical Single-server Sema-phore queue (SsSq) were used to solve this apparent problem in the basic poolmodelling. Also, an approximated analytical solution based on the classical non-pre-emptive priority single queues has proposed to model a priority pool. In thiscomponent, reader tasks are overtaken by writer tasks when they are waiting inthe input queue.

Both approximate analytical solutions exploit the advantages of the ContinuousTime Markov Chains for a detailed modelling of resource possession and the advan-tages of the queueing networks for a high-level modelling of resource contention,task ordering and infiniteness.

The basic pool, the priority pool and other elementary interaction protocols can beincluded in performance libraries by software developers to complement system de-sign methodologies as MASCOT. These performance libraries would be includingalso simulated basic models to implement a mixed performance model of the systemwith the corresponding performance tool. Therefore, queueing performance modelsof soft real-time components could complement the whole design of a large softreal-time system.

The application of the decomposing technique combined with some of iterativenature will increase the number of modelled elements as available building blocksfor developing a new performance-modelling tool for soft real-time systems.

This paper should be extended in order to combine the application of SsSq andMsSq with other approximations for new individual components belonging toother interaction protocol families, and integrate them into the correspondingmodel architecture to increment the approach alternatives to the soft real-time sys-tem design.

Acknowledgements

The authors gratefully acknowledge Javier Campos from Universidad deZaragoza, who provided some valuable comments about the Petri net modellingincluded in this article, and Juan-Luis Anciano from Universidad Sim�oon Bol�iivarfor his help during the hard-work of converting this paper from Microsoft Wordto LaTeX.

238 C. Juiz, R. Puigjaner / Simulation Practice and Theory 9 (2002) 215–240

References

[1] M. Ajmone Marsan, G. Balbo, G. Conte, S. Donatelli, G. Franceschinis, Modelling with Generalized

Stochastic Petri Nets, Wiley Series in Parallel Computing, Wiley, Chichester, UK, 1995.

[2] F. Bause, P.S. Kritzinger, Stochastic Petri Nets. An Introduction to the Theory, Advances in

Computer Science, Verlag Vieweg, Wiesbaden, Germany, 1996.

[3] A. Cobham, Priority assigment in waiting line problems, Operations Res. 2 (1954) 70–76.

[4] J.E. Cooling, Real-Time Software Systems. An Introduction to Structured and Object-Oriented

Design, International Thomson Computer Press, 1997.

[5] A.E. Conway, N.D. Georganas, in: H. Schwetman (Ed.), Queueing Networks-Exact Computational

Algorithms. A Unified Theory Based on Decomposition and Aggregation, Computer Systems, MIT

Press, Cambridge, MA, 1989.

[6] P.J. Courtois, F. Heymans, D.L. Parnas, Concurrent control with readers and writers, Commun.

ACM 14 (10) (1971) 667–668.

[7] S. Fdida, H.G. Perros, A. Wilk, Semaphore queues: modeling multilayered window flow control

mechanisms, IEEE Trans. Commun. 38 (3) (1990) 309–317.

[8] H. Gooma, in: N. Habermann (Ed.), Software Design Methods for Concurrent and Real-time

Systems, The SEI Series in Software Engineering, Addison-Wesley, Reading, MA, 1993.

[9] B.R. Haverkort, Performance of Computer Communication Systems. A Model-Based Approach,

Wiley, Chichester, UK, 1998.

[10] K. Jackson, Language design for modular software construction, in: IFIP’77 Congress Proceedings,

1977, pp. 577–581.

[11] K. Jackson, A. Llamos�ıı, R. Puigjaner, A comparison between two methods for large real-time systems

design, Complement Project Document UIB67-1.0, November 1993.

[12] C. Juiz, R. Puigjaner, Approximate performance models of real-time software systems, in: P. Dowd,

E. Gelenbe (Eds.), Proceedings of the 3rd International Workshop on Modeling, Analysis, and

Simulation of Computer and Telecommunication Systems, IEEE, Durham, NC, 1995, pp. 163–167.

[13] C. Juiz, R. Puigjaner, Composition of real-time software elements: the communications channel, in:

L. Ni, F.Z. Taieb (Eds.), Proceedings of the Conference on Communication Networks and

Distributed Systems Modeling and Simulation, SCS, Phoenix, AZ, 1997, pp. 131–136.

[14] C. Juiz, R. Puigjaner, Performance modeling of data transfer channels in soft real-time systems, in:

L. Ni, F.Z. Taieb (Eds.), Proceedings of the Conference on Communication Networks and

Distributed Systems Modeling and Simulation, SCS, San Diego, CA, 1998, pp. 101–106.

[15] C. Juiz, R. Puigjaner, K. Jackson, Performance evaluation of channels for large real-time software

systems, in: Proceedings of the International Conference and Workshop on Engineering of Computer

Based Systems, IEEE, Jerusalem, Israel, 1998, pp. 69–76.

[16] C. Juiz, R. Puigjaner, H.G. Perros, in: E. Gelenbe (Ed.), Performance Analysis of Multi-Class Data

Transfer Elements in Soft Real-Time Systems using Semaphore Queues, System Performance

Evaluation: Methodologies and Applications, CRC Press, Boca Raton, FL, 2000, pp. 275–289.

[17] C. Juiz, R. Puigjaner, Queueing analysis of pools in soft real-time systems, in: B.R. Haverkort, et al.

(Eds.), TOOLS 2000, Lecture Notes in Computer Science, vol. 1786, Springer, Heidelberg, 2000,

pp. 56–70.

[18] S. Lavenberg, Stability and maximum departure rate of certain open queueing networks having

capacity constraints, RAIRO Informat./Comput. Sci. 12 (1978) 353–378.

[19] C. Lindemann, Performance Modelling with Deterministic and Stochastic Petri Nets, Wiley,

Chichester, UK, 1998.

[20] J.L. Peterson, Petri Net Theory and the Modeling of Systems, Prentice-Hall, Englewood Cliffs, NJ,

1981.

[21] H.G. Perros, Queueing Networks with Blocking, Oxford University Press, New York, 1994.

[22] I. Pyle, P. Hruschka, M. Lissandre, K. Jackson, in: C. Tully, I. Pyle (Eds.), Real-Time Systems,

Investigating Industrial Practice, Wiley Series in Software Based Systems, Wiley, Chichester, UK,

1993.

[23] H.R. Simpson, The Mascot method, Software Eng. J. (1986) 103–120.

C. Juiz, R. Puigjaner / Simulation Practice and Theory 9 (2002) 215–240 239

[24] H.R. Simpson, Real time networks in configurable distributed systems, in: Proceedings International

Workshop on Configurable Distributed Systems, London, UK, 1992.

[25] H.R. Simpson, Protocols for Process Interaction. Part 1- Rationale and Specification. Matra BAe

Dynamics document DR20197 Issue 1, 2000, 15 December.

[26] W.J. Stewart, Introduction to the Numerical Solution of Markov Chains, Princeton University Press,

New Jersey, 1994.

[27] J. Wang, Timed Petri Nets. Theory and Application, The Kluwer International Series on Discrete

Event Dynamic Systems, Kluwer Academic, Norwell, MA, 1998.

240 C. Juiz, R. Puigjaner / Simulation Practice and Theory 9 (2002) 215–240