You are on page 1of 20

Tutorial I: Fundamental GPSS Tutorial

Chairman: Thomas J. Schriber, U n i v e r s i t y of Michigan

Approach to modeling in GPSS. Fundamental GPSS blocks, including GENERATE, TERMINATE, SIEZE
and RELEASE, ADVANCE, and QUEUE and DEPART. A GPSS "case study" model for a one-line, one-
server queuing system. Internal logic of the GPSS processor, including the c ur r ent and future
events chains, and a numeric example e x p l a i n i n g how the processor simulates with the one-line,
one-server model.

Tutorial I Continued: Intermediate GPSS Tutorial


Chairman: Thomas J. Schriber, University of Michigan

Continuation of Wednesday afternoon's fundamental GPSS tutorial. Descritpion of unconditional-mode


TRANSFER block, CLEAR card, the ENTER and LEAVE blocks, the RESET card, and the statistical-
mode TRANSFER block, with 5 "case studies" illustrating their applications. Consideration of 2
"advanced" GPSS case studies, with rapid overview of the GPSS capabilities they use.

The last 40 minutes of this session will be devoted to presentation of the proceedings paper en-
titled "One the Application of User Chains in GPSS". This paper is intended for active users of
the language, and should also be of value to those whose knowledge of GPSS is limited to that
gained in the two tutorials.

139
ON THE APPLICATION OF USER CHAINS IN GPSS

THOMAS J0 SCHRIBER
GRADUATE SCHOOL OF BUSINESS
THE UNIVERSITY OF MICHIGAN
ANN ARBOR, MICHIGAN

ABSTRACT

The GPSSProcessor uses a Current Events Chain, Future Events Chain, Inter-
rupt Chains, and Matching Chains to support the logic of a GPSSsimulation.
These chains, which are an implicit part of the language, are automatically
maintained and manipulated by the Processor as a simulation proceeds. At
the analyst's option, one or more additional chains of a type known as User
Chains can be e x p l i c i t l y incorporated into a GPSSmodel. Theseuser-defin-
ed chains can be introduced for either one of two quite distinct reasons:
(1) to decrease the execution time requirements of a given model, and (2)
to implement queue disciplines other than first-come, first-served, within
Priority Class. Despitetheir application scope, however, there are several
subtleties associated with User Chain use. These subtleties arise princi-
pally because the GPSSProcessor is inherently sequential in nature. This
paper, presented in the s p i r i t of a t u t o r i a l , explores User Chain applica-
tions and identifies someof the subtleties associated with their use.

I. Introduction
Those to whomthis paper is addressed are assumed treatment of User Chains anywhere in the l i t -
(a) to be active GPSSmodel-builders, thoroughly erature on GPSS. Theyare introduced, yes, and
conversant with the operation of the Current and the mechanics of using the two GPSS "Blocks"
Future Events Chains in the language, but (b) associated with them are spelled out, but there
without prior knowledgeof the GPSSUser Chain are few examplesgiven for them. I t is not un-
entity. The f i r s t assumption makes i t possible usual to see only one or two examples showing
to avoid starting the paper at too elementary a how User Chains can be applied when a con-
level. The second assumption provides an excuse strained resource is being simulated with a
to include here the fundamental User Chain single GPSSFacility. But this is the simplest,
groundwork needed to support some of the points most straightforward application of User Chains.
to be made. Apart from these conveniences, are As such, i t gives no hint of the subtle "simul-
the assumptions realistic? The evidence sug- taneity of events" complications which are
gests that they are. In much GPSSmodeling, i t associated with modestly more imaginative User
is not necessar~ to apply User Chains (even Chain use.
though their application might be of advantage
in decreasing the CPU time required for a simu- There seems to be a need, then, for a more com-
lation). Furthermore, the topic of User Chains plete treatment of the GPSSUser Chain entity.
is an "advanced" one in GPSS. The self-taught An attempt is made here to provide that treat-
GPSSmodel-builder, then, can conveniently avoid ment. In t o t a l , 7 different Block Diagrams, or
getting into the User Chain concept. And the Block Diagram segments, are presented and dis-
person who has "gone through a course" on GPSS cussed to i l l u s t r a t e User Chain use in various
may not have been told much, i f anything, about ways [a]. Particular emphasis is given to the
User Chains, unless the course was either "long" "simultaneity of events" problems that can oc-
or "advanced". Finally, there is no definitive cur in conjunction with User Chains. After the
[a] Portions of this material are taken from the manuscript for a book being written by Thomas J.
Schriber (see reference I l l ) . As part of the manuscript, these portions have been copyrighted
by Professor Schriber, and are reproduced here with his permission.

140
examples presented here have been studied, the The time required to simulate with a model can
GPSS model-builder should be able to apply User conceivably be decreased; and a r b i t r a r i l y -
Chains creatively, and properly, in whatever defined queue disciplines can be implemented.
contexts might be encountered in practice.
For the reasons cited, an entity known as "User
2. The Concept and U t i l i t y of User Chains Chains" has been made a part of the GPSS lan-
Whenever a Transaction encounters a blocking con- guage. User Chains are a "someplace else" where
dition during a simulation, i t is l e f t , by de- Transactions can be when they are in a model,
f a u l t , on the Current Events Chain by the GPSS but are not on the Current Events Chain or one
Processor. There are two disadvantages asso- of the other "implicit" chains. Like the Cur-
ciated with this default Processor behavior. rent and Future Events Chains, User Chains have
(1) The CPU time required to simulate with a "front" and a "back". But here the similarity
the model may be larger than necessary. This is stops. In the case of the Current and Future
true even though the Processor makes a distinc- Events Chains, the GPSS Processor automatically
tion between "unique", and "non-unique", blocking moves Transactions to and from them, and main-
conditions in a model. The distinction is made tains a pre-defined ordering property for Trans-
because certain CPU time economies can be real~ actions on them. In the case of User Chains,
ized through the "Scan Indicator" concept when- Transactions are hooked onto them only accord-
ever a blocking condition is unique. Transac- ing to logic e x p l i c i t l y provided by the analyst.
tions experiencing unique blocking are "scan-in- Furthermore, the analyst can choose from several
active" [b]. Even scan-inactive Transactions are available alternatives to determine the position
processed at least one time, however, at each a Transaction is to occupy on a User Chain when
reading of the simulation clock. I t is true that i t is placed there. In like fashion, Transac-
the only CPU time used to process scan-inactive tions are unlinked from User Chains and brought
Transactions is that required to test their Scan back into active status only according to the
Indicators. In the long run, however, even this analyst's explicitly-provided logic. The ana-
CPU time can be significant. Furthermore, when lyst can also choose from a series of options in
blocked Transactions are scan-active, the Pro- selecting the one or more Transactions which are
cessor attempts to move them into their next to be unhooked from a User Chain and put back
Block each time they are encountered in the scan, onto the Current Events Chain.
even though the logic of a given situation may
make i t evident (to the analyst, not to the Pro- This overall logic of User Chain use is shown
cessor) that a blocking condition is s t i l l in schematically in Figure I. Blocks in the figure
effect. I t should be clear, then, that i f have been labeled A, B, C, D, E, and F. Blocks
blocked Transactions could be made t o t a l l y in- C, D, and E suggest the basic sequence followed
active in a model by removing them from the Cur- to simulate use of a limited resource, such as
rent Events Chain, execution time economies could that modeled with a Facility or Storage. C, D,
result. and E might be a SEIZE-ADVANCE-RELEASEcombina-
(2) The second potential disadvantage concerns tion, or an ENTER-ADVANCE-LEAVEsequence. Block
queue discipline. The ordering of blocked Trans- A represents the "look-ahead" feature of User-
actions on the Current Events Chain is determined Chain logic, and block B indicates the conse-
solely by their Priority Level, and the chrono- quence which follows when the look-ahead reveals
logical sequence in which they were hooked onto that a blocking condition exists. Block F sug-
that chain. This is why the default queue disci- gests how an active Transaction which has just
pline in GPSS is "first-come, first-served, with- removed a blocking condition causes a Transac-
in Priority Class". I f some other queue disci- tion to be unlinked from a User Chain and
pline were to be implemented, these steps would brought back to the Current Events Chain,
have to be performed. scheduled to make use of the now-available re-
(a) Instead of leaving waiting Transactions on source.
the Current Events Chain, they would have to be
removed from that chain and put "someplace else". As might be expected, a pair of complementary
(b) Then, when the time came for one of them GPSS Blocks is used to accomplish the User-Chain
to move forward in the model (to capture a now- logic shown in Figure I. One of these Blocks
available server, for example), the Transaction corresponds to the "linking logic" shown at A
brought from that "someplace else" and put back and B in the figure. The other performs the "un-
on the Current Events Chain could be selected by linking logic" shown at F. I t is essentially the
some criterion other than "first-come, f i r s t - use of these two Blocks which will be described
served, within Priority Class". in this paper.

In summary, there are two possible benefits to User Chains have many of the same features as
be realized i f blocked Transactions can be re- other GPSS entities. There can be many different
moved temporarily from the Current Events Chain. User Chains in a model. Each chain can be named

[b] Familiarity with unique and non-unique blocking conditions and the Scan Indicator is assumed. For
an explanation of these concepts, see sections 7.2 and 7.3 in reference [ l ] .

141
TRANSACTION ARRIvEs
AT MODELSEGMENT
I WHEREBLOCKAGEMAY
I EXIST

A) (B)
/ nn~ ~ LE~E CURRENT ]
/ A RI~NG Y~EVENTS CHAIN; [PATH OF
"'C_nN~InN / ~]GO_ONTOA I~TRANSACTI
ON
~HAIN _~ ~ N G LINKED

LNO PATHOF TRANSACTIONBEING UNLINKED~ -

FRONT OF CHAIN
OF CHAIN
OF DENYINGENTRY

(D) TRANSACTIONS ON THE


APPLICABLE USERCHAIN
BLOCKS SIMULATING
USE OF LIMITED
RESOURCE

BLOCKWHOSE
(E) //
EXECUTION REMOVES
THE BLOCKING
CONDITION p.S,
(F)
UNLINK A TRANSACTION
FROMTHE USERCHAIN;
SENDIT TO USE THE
RESOURCE

I TRANSACTIONWHICHTRIGGERED
THE UNLINKINGGOESON ITS
WAY IN THE MODEL

Figure 1 A Schematic Representation of the Logic of User Chain Use


either numerically, or symbolically, according to bers, respectively, of the User Chains which are
the usual rules. The number of different User to be printed out. The Field C mnemonic is CHA.
Chains permissible depends on the amount of com- When a Transaction moves into the Block "PRINT
puter memory available to the Processor. Like 2,5,CHA", then~ User Chains 2 through 5 are
Facilities, Storages, Queues, Tables, Blocks, printed out as a result.
etc., User Chains have a set of Standard Numeri- 3. Transaction Movement to and from
cal Attributes associated with them. Furthermore, User Chains: The LINK Block and
a set of User Chain statistics much like those the UNLINK Block
for Queues appears as part of the standard out-
put produced at the end of a simulation. The a b i l i t y to put a Transaction onto a User
Chain is provided with the LINK Block. The LINK
Like the Current and FutureEvents Chains, non- Block can be used in either one of two modes:
empty User Chains are printed out by the Pro- conditional mode, or unconditional mode. A con-
cessor at the end of a simulation only i f " l " is ditional-mode LINK Block plays the roles of
used as the D Operand on the START Card. The blocks A and B in Figure l ; that is, i t embodies
PRINT Block can also be used to print out User a certain--nTook-ahead" feature, as suggested by
Chains. For this purpose, the Block's A and B block A in Figure l , and i t has the capability
Operands indicate the smallest and largest num- of either sending a Transaction to capture an

142
available server, or of putting a Transaction of increasing Pj value [c]. Each incoming
onto a User Chain i f there is no available Transaction is placed ahead of those chain resi-
server. In contrast, an unconditional-mode LINK dents which have a higher Pj value, but behind
Block has no effective look-ahead capability; i t those which have a lower Pj value. In case of
therefore plays only the role of block B in Fig- ties, the incoming Transaction goes behind other
ure I. Transactions which enter an uncondition- residents having the same Pj value. For example,
al-mode LINK Block are always put onto a User suppose that Transactions A, B, and C have P3
Chain as a consequence. values of -4, 21, and 32, respectively, and they
enter the Block "LINK HOLD,P3". Then, after the
Because use of the LINK Block in unconditional linking, Transaction A is at the front of the
mode is the easiest to understand, this usage User Chain HOLD, B is behind i t , and C is at the
mode will be discussed f i r s t . Consider Figure back of the chain. I f Transaction D now enters
2, which spells out the specific details asso- the LINK Block and has a P3 value of 21, i t is
ciated with the LINK Block. As indicated in placed between Transactions B and C on the User
that figure, when no C Operand is supplied for Chain.
the LINK Block, the Block is being used in un-
conditional-linkage mode. (In fact, i f the C Linking is conditional when the LINK Block's C
Operand were eliminated from the LINK Block in Operand is used. A Transaction moving into a
Figure 2, the path leading from the LINK Block conditional-mode LINK Block will either be placed
would be eliminated, too.) When a Transaction on the User Chain, or will be routed to the "C
moves into such a LINK Block, i t is placed on Block", i . e . , the Block in the Location whose
the User Chain whose name is supplied by the name is supplied by the C Operand. In practice,
Block's A Operand. The position an incoming the "C Block" often turns out to be the Block
Transaction takes on the User Chain is gov- which is sequential to the LINK Block in the
erned by the LINK Block's B Operand. The four- model. But even when this is the case, the ana-
character B Operands FIFO ( F i r s t - l n , First-Out) lyst must use the C Operand on the conditional-
and LIFO (Last-In, First-Out) cause the Trans- mode LINK Block, and must attach the correspond-
action to be placed on the back or front of the ing Location Name to the sequential Block. There
chain, respectively. I f the B Operand is Pj, is no requirement, however, that the % Block" be
where j is some integer from l to lO0, Trans- sequential to the LINK Block. This explains why
actions are arranged on the User Chain in order there is a horizontal path leading from the Fig-

~(C) I LINK

Default Value
Operand Significance or Result
A Name (numeric or symbolic) of a User Chain Error
B Specifies where the Transaction is to be placed on
the User Chain; there are three possibilities. Error
B Operand Indication
FIFO Go on the back of the chain
LIFO Go on the front of the chain
Pj Merge into the chain immediately ahead
of the Transaction with the next higher
value of Parameter j
Optional Operand; Block Location to which the Trans- Transaction is
action moves i f i t is not linked onto the User Chain linked unconditiona-
a l l y onto the User
Chain

Figure 2 The LINK Block and Its A, B~ and C Operands


[c] Some caution is required here. When the LINK Block's B Operand is Pj, the "P" simply signals to
the Processor that the linking criterion is "ordered according to the value of a Parameter". The
number of the Parameter is directly specified, and is j i t s e l f . I f a given LINK Block has PlO as
its B Operand, then, the linking criterion is "ordered according to the value of Parameter lO", not
"ordered according to the Parameter whose number can be found in Parameter lO".

143
ure 2 LINK Block, instead of a vertical path. ahead reveals that a blocking condition exists.
Nothing has been said yet about what determines The Block complementary to the LINK is the UN-
whether a Transaction entering a conditional-mode LINK. I t is the UNLINK Block which is used at
LINK Block takes the C-Block e x i t , or is linked position F in Figure I. The purpose of the UN-
onto the referenced User Chain. To choose be- LINK Block, of course, is to remove one or more
tween these two possibilities, the GPSS Processor Transactions from a User Chain and put them back
tests the setting of the referenced User Chain's on the Current Events Chain, so that the Pro-
Link Indicator. Each User Chain has its own Link cessor can subsequently move them forward again
Indicator. The indicator is either "on" ("Set"), in the model. By using appropriate UNLINK Block
or "off" ("Reset"). I f the Link Indicator is Operands, the analyst can specify which Trans-
"off" when a Transaction moves into a conditional action(s) on the User Chain q u a l i f ~ u n l i n k -
mode LINK Block, the Processor does two things. ing~ .There are two broad possibilities here.
(1) I t turns the Link Indicator "on". (1) Transactions can be removed from the front
(2) I t does not link the Transaction onto the or from the back of the User Chain. In this case,
User Chain; instead, i t routes the Transactions "qualify" for unlinking simply by
Transaction to the "C Block". virtue of the position they occupy on the User
On the other hand, i f the Link Indicator already Chain.
is "on" when a Transaction enters a conditional- (2) Transactions can be removed from anywhere
mode LINK Block, the Processor puts the Transac- on the User Chain, providing that their proper-
tion onto the User Chain, and leaves the Link ties satisfy analyst-specified conditions.
Indicator "on". Only the possibilities indicated in (1) above
will be described in this section. The possi-
As indicated e a r l i e r , the unconditional-mode LINK b i l i t i e s indicated in (2) will be taken up in
Block corresponds precisely to block B in Figure Section 7.
2. In this unconditional mode, the referenced
User Chain's Link Indicator has no useful purpose. The UNLINK Block is shown with i t s various Oper-
In contrast, the conditional-mode LINKBlock takes ands in Figure 3. In considering the Block, i t
on the roles played by blocks A and B in Figure is important to distinguish between the Unlinker-
I. The referenced User Chain's ~ k Indicator Transaction ( i . e . , the Transaction which moves
embodies the "look-ahead" feature, and can be into the UNLINK Block, thereby i n i t i a t i n g the un-
thought of much in the sense of a green-red t r a f - linking operation), and the Unlinkee-Transaction
f i c l i g h t . When the Link Indicator is " o f f " , the ( i . e . , the Transactions being unlinked). When a
t r a f f i c l i g h t is green. When a Transaction en- Transaction enters the UNLINK Block, the Proces-
ters a conditional-mode LINK Block and finds that sor removes from the referenced User Chain the
the t r a f f i c l i g h t is green, i t interprets this as number of Transactions specified via the C Oper-
a "no blockage" signal. The Transaction moves and (assuming this many are on the User Chain to
ahead in the model, but before doing so, i t begin with, and that they satisfy the unlinking
switches the t r a f f i c l i g h t to red (Link Indicator conditions). The C Operand, which can be a con-
"on") as a signal for later arrivals to the LINK stant, a Standard Numerical Attribute, or ALL, is
Block. Conversely, i f a Transaction arrives at termed the "Unlink Count". I f the C Operand is
the LINK Block and finds the t r a f f i c l i g h t is red ALL, then a l l q u a l i f y i n g Transactions on the re-
(Link Indicator "on"), i t interprets this to mean ferenced User Chain w i l l be unlinked. The UNLINK
that blockage exists, and consequently goes onto Block's B Operand indicates the Eocation of the
the User Chain instead of moving ahead in the Block to which each of the Unlinked Transactions
model. is to be routed. The D and E Operands are used
in combination to indicate from which end of the
The Link Indicator's look-ahead role cannot be User Chain the Unlinked Transactions are to be
f u l l y appreciated until the Block complementary taken. When neither Operand is used, Transac-
to the LINK Block has been described, and i t s tions are unlinked from the f r o n t of the User
effect on the Link Indicator's setting has been Chain. When BACK is used as the D Operand, and
indicated. I t might be mentioned now, however, the E Operand is not used, Transactions are un-
that use of the Link Indicator for look-ahead linked from the back of the User Chain.
purposes is extremely restricted. In fact, i t
is really useful as a b u i l t - i n look-ahead device The UNLINK Block's F Operand is optional. I f i t
only when the limited resource which might offer is not used, the Unlinker moves unconditionally
blockage is simulated with a Facility. Most of from the UNLINK Block to the sequential Block.
t h e time, the analyst supplies his own look- I f used, the F Operand supplies the name of the
ahead logic with a TEST or GATE Block at posi- non-sequential Location to which the Unlinker
tion A in Figure l , and sends Transactions into moves next i f no Transactions were unlinked in
an unconditional-mode LINK Block when the look- the attempted u--nlink operation [ d ] .

[d] For the two UNLINK Block D-E combinations in Figure 3, the condition "no Transactions were u n l i n k -
ed can arise i f and only i f the referenced User Chain is empty p r i o r to--the attempted unlinking.
For the other UNLINK Block D-E Operand combinations to be discussed in section 7, the "no Trans-
actions were unlinked" condition can occur even when there are Transactions on the User Chain at
the time of the attempted unlinking.

144
Now consider the effect of the UNLINK Block on turn on the Current Events Chain as the last
the referenced User Chain's Link Indicator. When member in i t s Priority Class. The Processor
the User Chain is empty at the time a Transaction works from the front of the User Chain toward the
moves into the UNLINK Block, the Processor back, unless the D-E Operand combination is
switches that User Chain's Link Indicator " o f f " . "BACK; not used", in which case i t works from the
Using the t r a f f i c e l i g h t analogy, this is equiva- back toward the front. Execution of the UNLINK
lent to switching the t r a f f i c l i g h t from red to Block causes the Status Change Flag to be turned
green. I t is logical for the Unlinker to do this '"on" i f at least one Transaction is thereby un-
when i t has just ceased to cause blockage at a linke~--[e]. When the UNLINK operation is com-
point, and then discovers (because of the empty plete, the Unlinker continues its forward move-
User Chain) that no other Transaction is currently ment in the model. This means that the Unlinked
waiting for the blockage to be removed. Later, Transactions, i f any, have not yet been proces-
when the next Transaction appears at the asso- sed. When the Unlinker f i n a l l y comes to rest,
ciated LINK Block, the green t r a f f i c light serves the Processor tests the Status Change Flag and,
as a signal that i t need not go on the User i f i t is "on", turns i t " o f f " , and re-starts the
Chain. Instead, the Transaction will switch the scan of the Current Events Chain. This guaran-
l i g h t to red, then move ahead in the model with- tees that, independent of their Priority Level,
out delay. any Unlinked Transactions will be processed at
the current reading of the simulation clock.
Control of a User Chain's Link Indicator can be
summarized this way. Finally, the relationship between User Chains and
(1) The Link Indicator can be turned "on" (but Block Counts should be carefully noted. When a
never turned " o f f " ) at the LINK Block. Transaction is on a User Chain, i t is not "in"
(2) The Link Indicator can be turned "off" any Block in the model. In particular, i t is not
(but never turned "on") at the UNLINK Block. "in" the LINK Block via which i t was put onto the
User Chain. Transactions on User Chains do not
Consider next a chain-oriented interpretation of reflect themselves, then, in any fashion through
the way the UNLINK Block works. When a Transac- Current Counts at Blocks. When a Transaction has
tion enters the UNLINK Block, the Processor re- just been unlinked from a User Chain and brought
moves Transactions from the referenced User to the Current Events Chain, i t would seem that
Chain, one-by-one, placing each Transaction in i t is also not yet "in" any Block. Conceptually,

~ED UNLINIK
I

Default Value
Operand Significance or Result

A Name (numeric or symbolic) of a User Chain Error


B Block Location to which the unlinked Transaction(s) is
(are) to be routed Error
The number of Transactions to be unlinked (the Unlink
Count); can be a constant, a Standard Numerical
Attribute, or ALL Error
D and E Specify which end of the User Chain Transactions are
to be taken from, per this scheme: Transactions are
unlinked from the
D Operand E Operand End Indicated front of the
Not Used Not Used Front End User Chain
BACK Not Used Back End
Optional Operand; Block Location to which the Unlinker- Unlinker-Trans-
Transaction moves next i f no Transactions are unlinked action uncondi-
tionally moves to
the sequential
Block in the model

Figure 3 The UNLINK Block and Its Operands


[e] Familiarity with the concept of the Status Change Flag is assumed. For an explanation, see
sections 7.2 and 7.3 in reference [ l ] .

145
GENERATE CUSTOMERS GENERATE TIMER ARRIVES
i ARRIVE ~4 | I AT TIME 480
~IR,6 I 80

QUEUE ENTER THE TERMINATE SHUT OFF


LINE THE RUN

4, Chain. This fact is sometimes of importance when


Current Block Counts are being interpreted. It

o[
LINK CAPTURE IMMEDIATELY also explains why the UNLINK Block's B 0perand
IF POSSIBLE; OTHER- (i.e., the "Next Block Attempted" for unlinked
WISE, GO ONTO BACK
OF USER CHAIN Transactions) appears in Figure 3 on a path lead-
ing from the UNLINK Block. The idea here is to
provide a graphic indication of the fact that un-
linked Transactions do move from the User Chain
(GETEM) ~/ via the UNLINK Block into their "Next Block At-
SEIZE CAPTURE THE
tempted". I n contrast, the other two paths lead-
BARBER ing from the Figure 3 UNLINK Block apply to the
Unlinker-Transaction. One path leads to the se-
quential Block; the other leads to the non-
sequential Block which is implied if the optional
F Operand is used.
DEPART LEAVE THE 4. Basic User Chain Use with
LINE Facilities and Storages
The basic use of User Chains with Facilities and
Storages is illustrated through a series of three
examples in this section. First, their use with
m
single Facilities is s~own. In this situation,

i
ADVANCE
USE THE the User Chain Link Indicator is adequate for the
BARBER required look-ahead logic. Then, their use with
16,4 Storages is illustrated. Such use requires
analyst-supplied look-ahead logic, and this in
turn requires caution in terms of a potential
simultaneity-of-events problem which can arise.
RELEASE Later, in Sections 5 and 7, additional examples

I W
FREE THE
BARBER of User Chain use will also be given.

4.1 User Chain Use with a Facility. A Block


Diagram for a one-line, one-server queuing system
is presented in Figure 4. The particular model
SEND NEXT WAITING shown is for a "one-man barber shop". Inter-
UNLINK CUSTOMER (IF ANY) arrival time for customers at the shop is 18+6
TO CAPTURE minutes; service time is 16+4 minutes. The Tm-
p l i c i t time unit in the model can consequently
be inferred from Figure 4 to be l minute. The
.1.
TERMINATE LEAVE THE
two-Block timer segment indicates that, when the
model is run, the simulation simply shuts off
after 480 minutes ( i . e . , 8 hours) of simulated
SHOP
time. No special provisions are made, then, to
provide a realistic closeup feature for the model.
Any "customers" in the model at the end of the
Figure 4 A First Example of User Chain Use 8th simulated hour are simply l e f t "as they are".
the just-unlinked Transaction has much in common The queue discipline to be practiced in the shop
with Transactions which are "on their way" into a is first-come, first-served.
model via a GENERATEBlock into which they have
not yet moved. Nevertheless, from the point of Notice that a LINK-UNLINK Block pair has been in-
view of Current Counts, the Processor treats un- corporated into the Block Diagram, implying that
linked Transactions as though they are in the customer-Transactions who are waiting their turn
UNLINK Block whose execution caused th~t---t-6-~e to get a haircut are kept in this simple model on
brought from the User Chain to the Current Events a User Chain. The LINK Block has been sandwiched

146
between the QUEUEand SEIZE Blocks; similarly, "on". In fact, i t is "on" whenever any customer
the UNLINK Block is sandwiched between the RELEASE is using the barber, whether that customer (a)
and TERMINATE Blocks. The effect of the presence found the indicator " o f f " , and moved directly to
of these two Blocks will now be explored. capture, or (b) found the indicator "on", and
spent time in residence on the User Chain before
When a customer arrives at the shop, he f i r s t up- eventually being sent to capture. The only way
dates waiting line statistics by moving into the to turn the Link Indicator "off" is for a custo-
QUEUE Block. He then moves into the conditional- mer to finish with the barber when no other cus-
mode LINK Block. I f the Link Indicator is "on" tomers are waiting (User Chain empty). Turning
( t r a f f i c light red), the customer-Transaction is the Link Indicator "off" in this circumstance
linked on the back (FIFO) of the User Chain HOLD, guarantees that when the next customer does ar-
and the Link Indicator remains "on". I f the Link rive, he will proceed to capture the barber im-
Indicator is found to be "off" ( t r a f f i c light meidately.
green), however, i t is switched "on" and the cus-
tomer-Transaction proceeds to the Block in the The punchcards for the Figure 4 model were pre-
location GETEM, i . e . , moves into the SEIZE Block. pared, and the model was run for one simulated
The DEPART-ADVANCE-RELEASEsequence then follows. day. The D Operand on the START Card was used to
After the RELEASE, the customer-Transaction at- force a chain printout at the end of the simula-
tempts to unlink l Transaction from the front of tion. Figure 5 shows a portion of the output
the User Chain HOLD (UNLINK Block D and E - - ~ r - that was thereby produced. Parts (a), (b), and
ands both blank), sending i t to the Block GETEM (c) in Figure 5 show the Current, Future, and
to capture the now-available Facility. I f the User Chains, respectively. There is a single
attempted unlinking is unsuccessful because the resident on the Current Events Chain, Transaction
User Chain is empty, the Link Indicator is 3; this Transaction is poised to release the Fa-
switched from "on" to "off" ( t r a f f i c light green) cility. [The NBA ("Next Block Attempted") column
so that the next arrival, instead of linking, in Figure 5(a) shows a value of 7. This is the
will move directly to SEIZE. Location occupied in the model by the RELEASE
Block, as "counting i t out" in Figure 4 will
Note that, when the t r a f f i c light is red at the show.] The two residents on the Future Events
LINK Block, arriving Transactions are placed on Chain are the incipient Transaction arrivals at
the back of the User Chain (go to the back of the the two GENERATEBlocks in the Model. (Their NBA
line~. Later, via action initiated by an Un- entries are l and lO, respectively, which are the
linker Transaction at the UNLINK Block, they are Locations occupied by the GENERATEBlocks in the
removed from the front of the User Chain. The model.)
resulting queue discipline is first-come, f i r s t -
served [ f ] . In Figure 5(c), the User Chain is described as
"USER CHAIN l " . The symbolic name HOLD has been
The pattern followed by the Link Indicator in the made equivalent to the number l by the Processor,
Figure 4 model reveals how i t serves as a b u i l t - and this numeric equivalent has been used to
in look-ahead device in the context of Facility label the User Chain in the printout. There is
use. I t is i n i t i a l l y "off". The f i r s t customer- one Transaction resident on the User Chain, Trans-
Transaction turns i t "on", then captures the ser- action 4. Note that the various column labels
ver. While the server is being used by this for the User Chain are identical to those for the
f i r s t customer of the day, the Link Indicator re- Current and Future Events Chains.
mains "on". Supposethe second customer-Transac-
tion arrives while the server is s t i l l in use. The Transaction on the User Chain is the next
Finding the Link Indicator "on", the second cus- customer, waiting for the barber. We know this
tomer goes onto the User Chain. When the f i r s t because of the problem context, but~he GPSS Pro-
customer finishes, he unlinks the second customer cessor does not know this. In fact, the "destin-
and sends him to capture the barber. Meantime, ation" of the Transaction on the User Chain will
because the User Chain referenced from the UNLINK not be known to the Processor until i t is un-
Block was not empty, the Link Indicator remains linked. At that time, the UNLINK Block's B Ope-
I f ] I t is sometimes mistakenly concluded that i f the B Operand at a LINK Block is FIFO (meaning that
incoming Transactions are linked onto the back of the User Chain), i t must be specified at the
associated UNLINK Block that Transactions are to be removed from the front of the User Chain; or,
that i f the B Operand at a LINK Block is LIFO (meaning that incoming Transactions are linked onto
the front of the User Chain), the associated UNLINK Block must specify that Transactions are to be
removed from the back of the pertinent User Chain. This is not the case. The LINK and UNLINK
Blocks are entirely independent of each other. I t is the analyst's responsibility to see to i t
that the linking and unlinking c r i t e r i a interact in such a way that the overall effect "makes
sense" in context. For example, the B Operand at a LINK Block can be FIFO, and the associated
UNLINK Block can specify that Transactions are to be unlinked from the back of the pertinent
User Chain. The resulting queue discipline would be "last-come, first-served".

147
h- ~,~
Z ~-
o o o LU Z
o o o 0 0 O0 O0 r~ UJ
r," ~.
-I" "d" n
n
Z
U 0
U

~E U~ UJ n~
:31-,-', -J UJ
Z m m
o O0 X ~-
o o o 0 0 0 0 0 0 Z
r,) ~Z
n ~E O
U (/)
n
~ Zr~
-lo
(u
n." I-.. e 4.J
LU ~. L~ r0

o o o -r'-
0 0 O0 O0 I--
o o o
~N
0J ~U~O t--
n n
~Z,-~ ~0
~ Z ~ (]J
L0 ~ t 0
>Z
~0 0~ i-- • t'-
U UJ ~ o ~
o o o L0
C, o o OO OO OO
I-

~- tU t--
Z ~
LO 0 en'
c-
Z I- .-, n~ ~j ~t z 4-)
ILl Z °~
Wt~ ~lJ N III 3
n~ LU
,-,..1- ryl-
,.-,@ O "O
:3Z n~
I- I ~JO
I W rU
I r~ U N
~r
<C O
0~ ~ . ~ Z t~
W n~
N ~- O
Z t-
1,1 .J O
I.- rcl (/) .~
tO U
tU X
tO UJ
~ Z ~
,~n'o 4 .J t U ~ Z
o n~ I-- •
00 Z °r-
UJ "~ ~t
Z Z
O ~= ~- 4--
~=~ ~= Z O
~J UJ
h-
tL ~=~
E
n~
n~ n LLI U) 0 i.U
n
~ Z ~
n, til• a,
UJ I- 1,1
~J U~O • Z :"
~J ~J O '¢ 0 '¢ r-
O .J LO O~
O .J m l-n, II
.J @
nn -k T_
~-Z ¢n
Z tlJ r~
Z
Of,.
T O~0 m.d- :, I- n, c-
m~. m ~J m ~ t ~" Z I- t--
-ic
~0 X I- IZl
F-
Z
m Z Z

"ii
~J
Z
m ~3

I-
.5 U
O
LU
Z U O
UJ ~ r~ ~ . ~ 0~Z
a: Z Z n, C~
A t00~ UJ
r-, tO A
~ ~.. v v v "I0
v v

148
rand will be used by the Processor to determine The phenomenon just described explains why the{e
the unlinked Transaction's "Next Block Attempted'L were 18 TOTAL ENTRIES to the User Chain in Figure
Note, then, the entry in the BLOCKcolumn in 5(d), but only 15 non-zero entries to the Queue
Figure 5(c) is "blank". The BLOCKcolumn indi- in Figure 5(e). Three of the User Chain entries
cates which Block a Transaction is currently "in'L were apparently of the "zero residence time" type.
But, as explained earlier, when a Transaction is Note that this phenomenon also makes interpreta-
on a User Chain, i t is not "in" any Block in the tion of the AVERAGETIME/TRANS s t a t i s t i c for User
model. Chains somewhat subtle. I t would be easy to draw
the false conclusion for the Figure 4 model that
The BDT ("Block Departure Time") column in Figure $AVERAGE TIME/TRANS in the Queue should equal the
5(c) shows a value of 472. Block Departure Time AVERAGE TIME/TRANS s t a t i s t i c for the User Chain.
is the time the Transaction is scheduled to try $AVERAGE TIME/TRANS measures the waiting time
to move into its "Next Block Attempted." As far only of those who had to wait, however; in con-
as its "future movement" is concerned, the BDT trast, the AVERAGETIME/TRANS value for User
entry for User Chain Transactions is meaningless. Chains can, in general, include Transactions
The BDT value shown in User Chain printout can be which did not actually have to wait. The 3 "zero
interpreted as the time the Transaction was linked residence time" entries to the User Chain ex-
onto the User Chain. plains why AVERAGETIME/TRANS is only 4.277 time
units in Figure 5(d), whereas $AVERAGETIME/TRANS
The statistics for the User Chain HOLDwhich ap- is 5.1333 time units in Figure 5(e).
pear in the standard output are shown in Figure
5(d). Figure 5(e) shows the statistics for the User Chain statistics and Queue statistics, al-
Queue JOEQ. Comparison of the two sets of sta- though similar, differ from each other, then, in
ticstics reveals that they are quite similar. these three major ways.
The Queue statistics contain somewhat more infor- (1) Zero-entry information is provided for
mation than those for the User Chain, indicating Queues.
how many zero entries there were (ZERO ENTRIES), (2) The AVERAGETIME/TRANS User Chain statis-
what percentage the zero entries were of the t i c requires careful interpretation.
total (PERCENTZEROS), and what the average Queue (3) The distribution of Queue residence time
residence time was when zero entries were in- is easily estimated with use of the QTABLE Card,
cluded (AVERAGETIME/TRANS). whereas nothing analogous to the QTABLE Card is
available for User Chains.
At f i r s t , i t might be thought that there are no
"zero entries" to User Chains because, " i f block- 4,2 More About the Link Indicator. Consider use
age does not exist, Transactions bypass the chain of the LINK-UNLINK Block pair in connection with
and move directly forward in the model." User
Chains can experience zero entries, however. That
~u Segment of a GPSSBlock Diagram. Figure 6
strates this situation where, for generality,
is, i t is possible for some Transactions to have the particular Blocks occupying the Block Diagram
zero residence time on a User Chain. This will segment in question are not shown, but for speci-
happen, for example, in the Figure 4 model when f i c i t y the LINK-UNLINK Block Operands are shown.
the following conditions are true. Assume that Transactions can gain e n t r y t o t h e
(1) The Facility is in use. segment only by moving through the conditional-
(2) No Transaction is waiting to capture the mode LINK Block in the figure, and that they can
Facility. exit the segment only by moving through the UN-
(3) There is a time-tie between the two events LINK Block. There can then never be more than
"completion of service", and "arrival of the next one Transaction in the encircled Block Diagram
customer". segment at a time.
(4) The event-sequence is "arrival", followed
by "service completion". This last statement can be made as a direct con-
In the scan of the Current Events Chain at the sequence of the properties of the User Chain's
simulated time in question, then, the arriving Link Indicator. The reasoning goes like this.
customer-Transaction is processed f i r s t , per (4) When the simulation starts, the encircled segment
above. Finding the User Chain's Link Indicator is empty. Furthermore, the Link Indicator is
"on", the Processor puts this Transaction on the "off". When the f i r s t Transaction arrives at the
User Chain. The releasing Transaction is then LINK Block, i t therefore moves immediately to the
processed. After moving through the RELEASE Block in the Location MOVIN, thereby entering the
Block, i t unlinks the just-arrived Transaction segment. (MOVINis assumed to be the Location of
from the User Chain and sends i t to capture the the " f i r s t " Block in the encircled segment.)
Facility. Hence, although the just-arrived Trans- While the f i r s t Transaction is in the segment,
action was made a User Chain resident, its resi- then, any other arrivals at the LINK Block are
dence time on the chain was zero. I t contributes put on the User Chain. When the f i r s t Transac-
then, to the User Chain TOTAL ENTRIES s t a t i s t i c . tion eventually leaves the segment via the UN-
And, from the Queue's point of view, i t contri- LINK Block, i t unhooks exactly l Transaction from
butes to the ZEROENTRIES statistic. the User Chain, routing i t into the segment.

149
LINK

F
(MOVIN)
GENERATE

1e,6 |
I Only Point of Entry to
I the Segment (Hypothesized)

J LINK
GETEM
t (GETEM)
(GETEM) ~
ADVANCE
Any Block Diagram
Segment

UNLINK
GETEM

~YDU~ Only Point of-Departure from


-- ~ I UNLINK the Segment (Hypothesized)

Figure 7 A Model Segment which Simulates a


Figure 6 Use of a User Chain with an Ar- Single Server without Using a
bitrary Block Diagram Segment SEIZE-RELEASE Block Pair
Hence, the segment-exiting Transaction "replaces more than one Transaction at a time in transit
i t s e l f " in the segment with another Transaction. between the pair of Blocks (assuming, of course,
This "replacement pattern" is in effect as long that alternative methods of "getting between"
as there is at least l Transaction on the User the pair of Blocks are not used in the model).
Chain when the UNLINK Block is executed. I f the (2) I t causes the GPSSProcessor to maintain
User Chain is em_m~_~xiwhen the UNLINK Block is exe- certain statistics about the "use" of the
cuted, the result is that the Link Indicator gets Facility.
turned "off". This means that when another Trans- But Effect (1) is precisely the effect that the
action eventually arrives at the LINK Block, i t Link Indicator has when a conditional-mode LINK
moves immediately into the segment, causing the Block is used. Consequently, i f Effect (2) is
Link Indicator to be turned back "on" in the pro- not needed, the SEIZE-RELEASE Block pair can be
cess, etc.,etc. eliminated. For example, Figure 7 repeats Fig-
ure 4, with the SEIZE-RELEASE Block pair e l i -
The ideas just expressed really only repeat what minated. The QUEUE-DEPARTBlock pair has also
was said about the Link Indicator when i t was in- been eliminated, on the hypothesis that the User
troduced in Section 3. Repeating the ideas in Chain statistics are sufficient measures of wait-
the context of Figure 6, however, leads directly ing line behavior for the application at hand.
to the two following conclusions. The Block sequence "LINK-ADVANCE-UNLINK" in Fig-
Conclusion I. When a User Chain is used in ure 7 may seem a bit strange at f i r s t , but i t
connection with a Facility, the SEIZE-RELEASE nonetheless validly simulates a single server
Block pair is not really needed, unless the ana- under the conditions stated here.
lyst requires the statistics whicFt-f~6-Facility Conclusion 2. When the User Chain's Link
entity provides. After a l l , use of a SEIZE- Indicator is relied upon to supply "look-ahead
RELEASE Block pair has two effects. logic", i t is extremely inflexible. In fact, be-
(1) I t guarantees that there will never be cause a consequence of its use is to let only

150
"one Transaction at a time" in the model segment model segment, or must be put onto the User Chain.
between the LINK and UNLINK Blocks, the Link In- The next section goes into further detail about
dicator is really only of value when the con- use of a User Chain with the Storage entity.
strained resource being simulated between the
LINK-UNLINK Blocks is a Facility (or a unit- 4.3 User Chain User with a Storage. Supposethat
capacity constraint). For example, suppose the in the Figure 4 barber shop, customer i n t e r - a r r i -
constrained resource is being simulated with a val time decreases to 6+2 minutes and, to offset
~ whose capacity is two. This means that
Transactions at a ~ e should be permit-
this heavier t r a f f i c pattern, two more barbers
are hired. Figure 8 shows the Block Diagram for
ted to be in transit between the LINK-UNLINK a model of the shop under these circumstances.
Block pair. Because this effect cannot be Discussion of the model will be broken into two
achieved with the Link Indicator, the analyst parts. First, the "GATE-ENTER-LINK" Block ar-
must supply his own look-ahead logic to determine rangement will be commented upon. Then the reason
whether an arriving Transaction can move into the for placing the PRIORITY Block between the GENE-
RATE and GATE Blocks will be explained.
GENERATE As indicated under Conclusion 2 in the preceding
sub-section, the analyst must supply his own
look-ahead logic when a User Chain is used in
conjunction with a Storage. The GATE Block in
Figure 8 provides this required look-ahead logic.
When a customer-Transaction moves into the "GATE
SNF l " Block, a test is conducted to determine
whether at least one barber is currently avail-

I.,°.,**I able, i . e . , to determine whether the Storage used


to simulate the three barbers is not f u l l .
the "Storage Not Full" condition is true, the
If

(OK~
customer-Transaction moves sequentially through
the gate and captures a barber. I f the "Storage
(FULUP) Not Full" condition is false, the customer-
Transaction exits the gate non-sequentially and

ENTER
(FULUP) ~ moves into the LINK Block. No C Operand is pro-
vided with the LINK Block, with the result that
Transactions entering i t are unconditionally
placed on the User Chain. Transactions enter the
LINK Block, however, only on the condition that
the Storage is f u l l . Via use of the GATE Block,
then, the "unconditional" linking of Transactions
is forced to be conditional after a l l .

ADVANCE

16,4
I Now consider why the "PRIORITY l " Block has been
placed between the GENERATEand GATE Blocks in
the Figure 8 model. The PRIORITY Block has been
used to defense against invalid logic which could
come about i f a certain simultaneity-of-events

LEAVE ~ situation were to arise. Supposethat the f o l -


lowing conditions are true at a given point in
simulated time.
(1) All 3 barbers are captured.
(2) At least l Transaction is waiting on the
User Chain.

I (3) One of the in-service customers is just


leaving.
(4) The next customer is just arriving.
UNLINK
(5) The leaving Transaction is ahead of the
arriving Transaction on the Current Events Chain.

When the leaving Transaction is processed, i t


f i r s t moves into the LEAVE Block, thereby chang-
ing the condition "Storage Not Full" from false
TERMINATE to true. This leaving Transaction then moves
k_2 into the UNLINK Block, causing the Transaction
at the front of the User Chain to be moved to the
Current Events Chain. Because of its earlier
Figure 8 A Second Example of User Chain Use movement through the PRIORITY Block, the unlinked

151
Transaction has a Priority Level of I. I t is i t therefore moves non-sequentially from the GATE
therefore placed on the Current Events Chain Block to the LINK Block, and is put on the User
ahead of the arriving customer-Transaction, which Chain. The previously-waiting customer has cap-
has a Priority Level of O. After the leaving tured the barber, which is as i t should be.
Transaction has terminated, the Processor re-
starts the CEC scan. I t f i r s t processes the just- I t is easy to see how the logic of the model would
unlinked customer-Transaction, moving i t into the be subverted i f the PRIORITY Block were removed
ENTER-ADVANCE sequence. Execution of the ENTER from the model, and the conditions described above
Block results in the condition "Storage Not Full" came about. The unlinked Transaction would be
being made false again. When the arriving custo- put on the current--~vents Chain behind the just-
_mer-Transaction is processed later in the scan, arriving customer-Transaction. I~'e-n-t~e
arriving Transaction reached the GATE Block, the
"Storage Not Full" condition would be true. The
"newcomer" would therefore capture t h e ~ e r .
When the just-unlinked Transaction eventually tried
(OK~ (FULUP) to move into the ENTERBlock, entry would be
denied. This previously-waiting Transaction
would have "missed its chance". Furthermore,

(FULUP) its subsequent waiting would take place on the


Current Events Chain, not on the User Chain.
ENTER LINK Whether using the PRIORITY Block in the Figure 8
model is "worth i t " can be debated. The Block
does guarantee that the logic of the model will
~a be valid. On the other hand, to include
dditional" Block increases the number of
Blocks in the model from 8 to 9. Speaking very
ADVANCE I roughly, this means that execution time for the
model is increased by about 12.5% relative to the
16,4 no-PRIORITY-Block version of the model [g].
Depending on the size of the implicit time unit
and the intensity of the t r a f f i c pattern, the
conditions leading to the "problem of simulta-
neity" may come about very infrequently. To
save execution time in modeling situations such
as this, the analyst might prefer to deliberately
exclude the PRIORITY Block, and simply "accept"
occasional i n v a l i d i t y in his models. (Note that
the potential "problem of simultaneity" did not
have to be defensed against when the Link In-
BUFFER dicator provided the look-ahead logic in Figure
4. To check your understanding of the ideas
presented so far in this paper, you should now
try to explain why this is true).

4.4 An Alternative for Handling the Simultaneity


LEAVE Problem. In the Figure 8 model, i t was
~ient" to place the PRIORITY Block between
the GENERATEand GATE Blocks. But this was
largely because the modeling context used as an
example was completely self-contained. I t is not
normally true that a Transaction "approaches" a
Storage from a GENERATEBlock. More often than
UNLINK not, the "approach" is made from some preceding
non-trivial model segment. The question then
arises, how is one to handle the problem of
simultaneity in this circumstance? The purpose
of this section is to suggest an alternative
which can be used under more complicated c i r -
Figure 9 An Alternative Method for Handling stances.
the Potential Problem of Simultaneity
in the Figure 8 Model Figure 9 shows the suggested alternative in the
[g] When the PRIORITY Block's A Operand is a constant, a minimum of l l 4 assembler instruction-execu-
tions are performed when a Transaction moves into the Block. (This count applies to GPSS/360,
Version l , Modification Level 3.)

152
form of a Block Diagram segment corresponding to preceding explanation a b i t more straightforward.
use of the Figure 8 Storage. I t is assumed that Active GPSS users will recall that when the
all Transactions move into the segment with a "buffer option" is used with the PRIORITY Block,
common Priority Level, whatever that may be. The the effect achieved is precisely identical to
"defense" against the simultaneity problem takes that of the two-Block PRIORITY-BUFFER sequence
the form of the PRIORITY-BUFFER sequence placed shown in Figure 9. That is, the single Block
between the ADVANCEand LEAVE Blocks. "PRIORITY PR,BUFFER" could be used to replace the
PRIORITY-BUFFER Block-pair. In the remaining
Consider how the PRIORITY-BUFFER combination works examples in this paper, this "buffer option" will
to eliminate the simultaneity problem. Assume b e used with the PRIORITY Block when the occasion
that the conditions required for the simultaneity arises, for the sake of "Block economy".
problem are in effect, as follows. 5. More Examples of User Chain Use
(1) All 3 barbers are captured.
(2) At least l Transaction is waiting on the Two more examples of User Chain use with Facil-
User Chain. i t i e s are given in this section. The f i r s t ex-
(3) One of the in-service customers is just ample illustrates application of User Chains
leaving. with two Facilities operating in parallel. The
(4) The next customer is just arriving. second example shows how the "shortest imminent
(5) The leaving Transaction is ahead of the operation" queue discipline is simulated with
arriving Transaction on the Current Events use of Parameter-mode linking at the LINK Block.
Chain.
Now, when the leaving Transaction is processed, i t 5.1 User Chain Use with Two Parallel Facilities.
immediately moves into the PRIORITY Block, where Suppose that two barbers work in a barber shop.
its "old" Priority Level is reassigned as its Service time for the f i r s t and second of these
"new" Priority Level. This produces no change in barbers is 13+3 and 15+4 minutes, respectively.
Priority Level, but i t does cause the Processor Customers arrTve at th~ shop every 7+3 minutes.
to re-position the Transaction on the Current Figure lO shows how a User Chain can-be incorp-
Events Chain as the last member in its "new" orated into a model of the barber shop. When a
Priority Class. This means that the leaving customer-Transaction arrives at the shop, i t
Transaction is now behind the arriving Transaction moves (through the PRIORITY Block) into the TEST
(which reverses conBiTi~n- (5) stated above). Block shown in Figure lO(a). There, i t evaluates
The leaving Transaction then moves into the BUFFER the Boolean Variable CHECK, as defined in Fig-
Block, forcing the Processor to re-start its CEC ure IO(b), to determine whether either one or
scan. As the r e - i n i t i a t e d scan proceeds, the both of the barbers are available. I f a barber
arriving Transaction is (eventually) encountered, is free, the customer-Transaction proceeds to the
finds the condition "Storage Not Full" is false TRANSFER Block in BOTHmode, from whence i t is
(the leaving Transaction has not yet executed the routed to a SEIZE Block not currently denying en-
LEAVE Block), and therefore transfers non- try. I f both barbers are busy, i t is routed from
sequentially to the User Chain. Later in the the transfer-mode TEST Block to the uncondition-
scan, the Processor resumes the forward movement al-mode LINK Block. There, i t is linked onto the
of the leaving Transaction, moving i t through the back of the User Chain LONG.
LEAVE Block to the UNLINK Block. The Transaction
at the front of the User Chain is then transferred Whenever a customer-Transaction releases a barber,
to the Current Events Chain, and enters the Storage i t causes another waiting customer to be unlinked
when the scan is re-started (execution of the from the User Chain and routed directly to the
LEAVE Block caused the Status Change Flag to be pertinent SEIZE Block. Because of the "PRIORITY l "
turned "on"; execution of the UNLINK Block then Block following the GENERATEBlock, the unlinked
caused i t to be turned on "again", redundantly). customer-Transaction is assured of being the one
to capture the just-released barber under all
I t should be clear what would happen under the circumstances.
stated conditions i f the PRIORITY-BUFFER Blocks
were not in the model. The leaving Transaction This example is one in which the execution time
would be processed f i r s t , making the condition savings resulting from User Chain use can be
"Storage Not Full" true. The unlinked Transac- substantial. In contrast with Figures 4 and 8,
tion would be put on the Current Events Chain where the potential blocking conditions are both
behind the arriving Transaction, since they are unique, the TRANSFERBlock in Figure lO offers
postulated to have the same Priority Level. The non-unique blocking. I f the User Chain were not
arriving Transaction would then enter the Storage, used, each delayed Transaction on the Current
thereby capturing the server who had been intended Events Chain would attempt to move through the
for the unlinked Transaction. By the time the un- TRANSFER Block at each CEC scan, thereby con-
linked Transaction was processed, there would be suming a telling amount of time. For the model
"no room l e f t " for i t in the Storage. In short, shown, the TRANSFERBlock is executed successfully
the logic of the model would be invalid. one time by each arriving customer who finds a
barber immediately available. No attempt is
In Figure 9, the PRIORITY and BUFFERBlocks were otherwise made to execute the Block.
shown separately, albeit in sequence, to make the

153
GENERATE

I J ~ i J I I L~_Lt L~L
I i i i i l

(b) Boolean Variable Definition


BV$CHECK
~ I (BUSY)

~L (BUSY)
LINK JLO~
(MAN1) "TRANSFEI(MAN2)
L

(MANI~ (MAN2)
-I? "'" L/~
J

L
SEIZE
½
I ADVAN]CE I ADVANCE
13,3 15,4

l RELEASE
i "L'"EW
i
v
.

UNLINK I ~ UNLiNK

TERMINATE TERMINATE
(a) Block Diagram
Figure lO A Third Example of User Chain Use

154
5.2 User Chain Use for "Shortest Imminent
Operation" Queue Discipline. Consider this
problem. At the Facility MAC, the queue dis-
cipline practiced is "shortest imminent operation".
This means that the Transaction expected to hold
the Facility the shortest length of time is the LINK
one permitted to capture i t next. In case of
ties for shortest imminent operation, the ties are
to be resolved on a first-come, first-served basis.
When a Transaction does capture the Facility, its (TIEUP)
actual holding time follows the exponential dis-
tribution. (TIEUP)~rt
Assuming that a Transaction's expected holding
I SEIZE
time at the Facility is stored in its second
Parameter, Figure II shows a Block Diagram segment
which implements this queue discipline. ( I t is
assumed that the Function symbolically named XPDIS
is the usual 24-point Function used to sample
from an exponential distribution with a mean of l . ) E ADVANCE
Transactions waiting for the Facility are put onto
the User Chain QUE, ordered according to their P2 P2,FN$XPDIIS
value. This means they are put onto the chain in
order of "shortest imminent operation", with ex-
pected operation times increasing from the front of
the User Chain toward the back. Furthermore, in
event of ties, each most-recent arrival is placed I PRIORITY
behind earlier arrivals which have the same P2
In short, linking "in Parameter mode"
BUFFER
results in direct implementation of the shortest
imminent operation queue discipline (assuming, of
course, that Transactions are later unhooked from

I
RELEASE
the front of the User Chain).
In the Figure II model segment, just before a
Transaction releases the Facility, i t moves into
a "PRIORITY PR,BUFFER"Block. The Processor
therefore re-positions the Transaction on the
}
Current Events Chain as the last member in its
UNLINK
Priority Class, and re-starts the scan. This
guarantees that, in case of a time-tie between
the events "next arrival of a job", and " r e l -
ease of the F a c i l i t y " , the arriving job-Trans-
action is hooked onto the User Chain before the
next Transaction to capture the Facility is cap-
tured. ( I t is assumed that all Transactions which Figure II A Fourth Example of User Chain Use
use the Facility have the same Priority Level.)
The result is to insure that the arriving job- moved from the model. The effect of the RESET
Transaction is included in the "competition" that Card is to set the values of CAj, CCj, and CTj to
takes place to see which waiting job has the zero. The value of CHj remains the same, and the
shortest imminent operation. I f this simul- value of CMj is set to the current value of CHj.
taneity-of-events situation arose and the Of course, any User Chain residents are l e f t un-
PRIORITY Block were not included in the Figure disturbed during the resetting operation.
II model segment, the shortest imminent opera-
tion queue discipline could be violated.
7. Conditional Unlinking of Transactions
6. User Chain Standard from User Chains
Numerical Attributes
In Section 3, use of the UNLINK Block D and E
Each User Chain has five Standard Numerical At- Operands to remove Transactions from (a) the
tributes associated with i t . The pre-defined front, or (b) the back of User Chains was intro-
names of these attributes, and the significance duced. In neither of these cases does a Transac-
of the corresponding values, are shown in Table I. tion have to meet a particular condition, other
than "relative position on the chain", to qualify
When the Processor encounters a CLEARCard, the for unlinking. There are three other D and E
values of these Standard Numerical Attributes are Operand combinations which can be used to impose
set to zero, and any User Chain residents are re- on potential Unlinkee Transactions the require-

155
Pre-defined
Value
Name [h]

CAj, or CASsn Integer portion of the average number of Transactions on the chain
CCj, or CC$sn The total number of Transactions hooked onto the chain during the
course of the simulation
CHj, or CH$sn The number of Transactions currently on the chain
CMj, or CM$sn Maximum number of Transactions simultaneously resident on the chain
during the simulation; the maximum value CHj (or CH$sn) has attained
CTj, or CTSsn Integer portion of the average Transaction residence time on the
chain
Table l UserChain Standard Numerical Attributes
Combination
Number D Operand E Operand Condition Required for Unlinkin~
Any Standard Not used Let "j" represent the value of the D Operand; the User
Numerical Chain Transaction qualifies for unlinking i f its j-th
Attribute Parameter value equals the value of the Unlinker's j - t h
Parameter
2 Any Standard Any Standard Let "j" represent the value of the D Operand; the poten-
Numerical Numerical tial Unlinkee qualifies i f its j-th Parameter value
Attribute Attribute equals the value of the E Operand
3 BVj, or Not used The potential Unlinkee qualifies i f the Boolean Variable
BV$sn numbered j (or symbolically named sn) is true when i t is
evaluated with that Transaction's PrioritT-Le-vel and Para-
meter values
Table 2 Additional D and E Combinations Possible for the UNLINK Block
ment that they satisfy a specified condition. on a User Chain?" The answer is that i f numeric
These other three combinations are shown in Table 2. data references in the Boolean Variable include
Priority Level and/or Parameter values, the User
For all three of the Table 2 combinations, the Chain Transaction currently being examined sup-
User Chain is scanned from front to back by the plies these values, not the Transaction at the
Processor until the Unlink Count has been satis- UNLINK Block.
fied, or the back of the chain has been reached,
whichever occurs f i r s t . In Combination l , the An example will now be given to show use of a
value of a specified Parameter of the potential Boolean Variable with the UNLINK Block. Consider
Unlinkee must equal the value of the same Para- the "shortest imminent operation" queue disci-
meter of the Unlinker. The UNLINK Block's D pline, as illustrated in Figure I I . A disadvan-
Operand indicates the number of the applicable tage of this queue discipline is that jobs with
Parameter; the E Operand is not used. In Com- a large imminent operation time can be delayed
bination 2, the value of a specified Parameter for very long times waiting for the Facility.
of the potential Unlinkee must equal some other This happens i f jobs with shorter operation times
arbitrarily-specified value. The UNLINK Block's keep arriving at the Facility before the bigger
D Operand again provides the number of the po- jobs can capture i t . The problem can be avoided
tential Unlinkee's applicable Parameter; the E by dividing all waiting jobs into two groups, as
Operand is the "Match Argument", i . e . , provides determined by how long they have been waiting.
the value which the Unlinkee's Parameter value Highest priority is given to those jobs that have
must equal. been waiting longer than some pre-determined time,
called the critical threshhold. Jobs in this
In Combination 3, the D Operand references a group are termed "critical". Within the set of
Boolean Variable, and the E Operand is not used. critical jobs, queue discipline is "shortest im-
For each Transaction on the User Chain, the Pro- minent operation". Queuediscipline for the non-
cessor evaluates the Boolean Variable. Only i f critical jobs is also "shortest imminent opera-
its value is true does the User Chain Transaction tion". The overall queue discipline, then, is
qualify for un-ITn-king. The question naturally "serve critical jobs f i r s t , then serve non-crlti-
arises, "how can the value of a Boolean Variable cal jobs; in each of these two categories, select
be made to depend on properties of a Transaction jobs according to shortest imminent operation."
[h] "j" is understood to be the number of the User Chain, i f i t has been named numerically; "sn"
is understood to be its symbolic name, i f i t has been named symbolically.

156
A Block Diagram for this overall queue discipline according to its imminent operation time as
is shown in Figure 12(a). When a job-Transaction carried in Parameter 2. When a job-Transaction
enters the segment, its time-of-arrival is f i r s t is finished using the Facility, i t enters an UN-
marked in Parameter 3. The Transaction then cap- LINK Block to request a Boolean-mode scan of the
tures the Facility MAC immediately i f possible, User Chain. The User Chain is scanned from
and otherwise goes onto the User Chain, ordered front-to-back in a search for the f i r s t job-
Transaction, i f any, for which the Boolean Vari-
able CRJOB [defined in Figurel2(b)] is true,
i . e . , for which residence time on the User Chain
exceeds the c r i t i c a l threshhold, as held in the
Savevalue CRTYM. I f such a Transaction is found,
MARK } --;'; SET P3 =
___.I TIME AT FACILITY
ARRIVAL
i t is unhooked and sent to capture; meantime, the
Unlinker continues to the sequential Block. I f
there are no c r i t i c a l jobs, however, the Unlinker
takes the non-sequential exit from the f i r s t UN-
LINK Block to a second UNLINK Block, where i t un-
GO CAPTURE, OR hooks the front-end Transaction from the User
LINK ACCORDING Chain and sends i t to capture.
TO SHORTEST
IMMINENT OPERATION
8. Other Sources of Examples
The various examples presented in this paper
should alert the GPSS analyst to the fact that
(TIEUP) ~J/ care must be exercised, especially with respect
t SEIZE to the "simultaneity of events" problem, when
[ ~ CAPTURE User Chains are applied in the language. Space
does not permit presentation of additional,
larger-scale examples here. Those interested
should refer to case studies 7A and 7C in refer-
ence [ l ] . Case study 7A employs User Chains in
ADVANCE comparing a one-line, multiple-server queuing
USE system to a multiple-line, multiple-server queu-
FNSHOLD ing system in a banking context. For the l a t t e r
system, Facilities are used in parallel to simu-
late the parallel servers, and a separate User
Chain is associated with each Facility. In case
study 7C, in the context of a " c i t y ' s vehicle-
GET BEHIND CURRENT
PRIORITY ARRIVAL (IF ANY) AND maintenance garage", parallel servers are also
BUFFER
RE-START THE SCAN simulated with Facilities in parallel. In this
case, pre-emptive use of Facilities is allowed.
Due emphasis is given to a simultaneity-of-events
problem which can arise when pre-emption and a
I RELEASE normal "release" of a Facility occur at the same
[ ~ RELEASE time.

There are examples in other "pedagogical" sources,


but they do not abound. In [2], examples of User
Chain use are given (a) for first-come, f i r s t -
UNLINK "| SCAN USER CHAIN
FOR CRITICAL JOB served queue discipline with a single Facility,
BV$CRJOB
U i (NONE)

(NONE)
WITH SHORTEST
IMMINENT OPERATION
I
[
(b) for random queue discipline with a single
Facility, (c) when unlinking is based on a "Para-
meter-match" between the unlinker, and the poten-
t i a l unlinkee, and (d) when a Boolean Variable
~ (TIEUP) ~ UNLINK [ NO CRITICAL JOB
FOUND; SEND
NON-CRITICAL JOB
TO CAPTURE
OCAI ION OP[ RATION i A,B,C O£ F

). RETURN TO
~4]~1 ~_ ~, ~,o;~
C,IIJ~I)
...... ~ rf,~l,~,,I,,1,gj

B~YAR~IAB,L,E,
"

I ILI 1]/ :d
|
,~l~'~........
i
~, j~T~jjT~,~o,~,

, ~%P,3,',G'pC,$~C~R,T,YM
i
i
~T~t~r~j
j ~,
, i i ,
(BAKIN) MAIN BLOCK
SEQUENCE
I I ~, ' ~* ~ ta III fJ I[l I jr I ]±±[
(a) Block Diagram (b) Boolean Variable Definition
Figure 12 A Fifth Example of User Chain Use

157
must be true before unlinking can occur. The
same examples are repeated in [3] and [4]. There I0. Biography
are no examples in these sources that consider Thomas J. Schriber is a Professor of Management
User Chain use for constrained resources simula- Science at the University of Michigan. He regu-
ted with more than a single Facility, and the larly teaches a 5-day "introductory" course and a
simultaneity-of-events problem is not mentioned. 3-day "advanced" course on GPSS in the University
In [5], a "random queue discipline" model is of Michigan's Engineering Summer Conference
shown which consumes less CPU time than the one Series. He gives GPSScourses in industry, and has
given in the above sources. Use of User Chains written two introductory books on the subject.
to implement "least job slack per remaining op-
eration" queue discipline in a job shop problem II. References
is also shown in [5]. In [6], Greenberg gives 6 [ l ] Schriber, Thomas J., A GPSSPrimer (cur-
examples of User Chain use, restricting the rently available in softbound form from
constrained resource to a single Facility. The Ulrich's Books, Inc., Ann Arbor, MI; being
purpose of having 6 examples is to explain vari- published in hardbound by John Wiley & Sons,
our LINK-UNLINK Block Operand combinations. No Inc., with publication date not yet set; t i t l e
additional applications are illustrated, and no only tentative for hardbound form)
mention is made of the simultaneity-of-events
problem. [2] GPSS/360 User's Manual (IBM; Form Number
9. Summary GH20-0326)
This paper, presented as a tutorial, elaborates [3] GPSS/360 Version 2 User's Manual (IBM; Form
on the User Chain entity in GPSS. The concept of Number SH20-O694)
User Chains is presented, the potential benefits
to be gained from their use are described, and a [4] GPSS V User's Manual (IBM; Form Number
detailed description of the two GPSSBlocks sup- SH20-0851)
porting User Chain use is provided. Examples i l -
lustrating a range of User Chain applications are [5] Schriber, Thomas J., GPSS/360: Introductory
introduced and discussed. The potential "simul- Concepts and Case Studies (Ulrich's Books,
taneity-of-events" problem that can occur even Inc., 1968; 1969; Ig71)
with only modestly imaginative User Chain use is
brought to light in several of these examples. [6] Greenberg, Stanley, GPSSPrimer (Wiley-
Reference is made to additional sources of ex- Interscience, 1972)
amples in the literature.

158

You might also like