ever a node finds the channel to be idle, it resets its virtual ... tributed hard real time systems is the multiple access net- work. .... of this, we call this protocol.
A Virtual Time CSMA
Protocol for Hard Real Time Communication 1
Wei Zhao Krithi Ramamritham Department of Computer and Information University of Massachusetts Amherst, MA 01003
Science
The most common communication network used in dis-
Abstract
tributed hard real time systems is the multiple access network. In this type of network, stations transmit messages
We study a virtual time CSMA time communication
systems
deadlines.
protocol,
clocks:
In this
a real time clock
each
node
to be equal to the real clock.
message
when
maintains
time clock.
The virtual
occurs if at any time two or more messages are transmitted
When-
clock
the time on the virtual
on the channel.
the minimum-laxity-first
No message can be received correctly in
the event of a collision.
then
clock
Only one message can be success-
fully transmitted over the channel at any time. A collision
two
Based on how the collisions are handled, multiple access
A node transmits
equal to the latest time to send the message. implements
via a shared channel.
have explicit
to be idle, it resets its virtual
runs at a higher rate than the real clock. a waiting
for hard real
where messages
and a virtual
ever a node finds the channel clock
protocol
communication protocols can be broadly divided into three
is
categories:
This protocol
transmission
policy.
1. lrzjerence
avoiding
protocols:
This category includes
We compare the performance of our protocol with two
ALOHA [1] and various CSMA protocols [9]. These
baseline protocols both of which transmit messages accord-
protocols operate without taking past history of the
ing to the minimum-laxity-first policy. While both use per-
channel into account.
fect state information about the nodes and channel, the 2. Inference
first is an idealized protocol which obtains this informa-
seeking
protocols:
Various tree, window,
and stack protocols [2,4,5,7,12,27] and Urn protocols
tion without paying any cost and the second one pays a
[10,28] belong to this category. These protocols make
reasonable price for it. The simulation study shows that
inference on the collision history, and usually solve
in most cases, our protocol performs close to the first one
collisions by partitioning some parameter space of
and better than the second one.
messages. 3. Deterministic
1
Introduction
or Collision-free
Division
Multiple-Access
Bit-Map
Protocol
with Alternative This paper concerns communication
protocols
for dis-
protocols:
Protocols
The Time
(TDMA),
the
[11], the Broadcast Recognition Priorities
Protocol
[24,3,6],
the
Multi-1evel Multi-access Protocol [23], etc. are in this
tributed hard real-time systems. Tasks performed in such
category. They work in such a way that collision
systems are time constrained. Consequently, the messages
not occur at all.
do
transmitted in the network often also have explicit time constraints such as deadlines.
and evaluate a protocol which particularly time constraints control
into account,
of communications
While we are currently developing protocols belonging to
In this paper, we propose takes messages’
and hence is suitable in distributed
all three categories for hard real-time communication,
hard
this
for the
longing
real-time
systems.
we report
to the
first
on the
performance
of a protocol
in be-
category.
In our model, each meseage has a deadline which specifies the absolute time by which the message
1This material is based upon work supported in part by the National Science Foundation under grants DCR8318776, and DCR-8500332, and by the Office of Naval Research under grant 048-716/3-22-85.
must arrive
at its destination; otherwise it is useless. The major performance metric in such a network is the ratio of message loss, i.e., the fraction of messages that do not arrive at
120 CH2351-5/86/0000/0120$ 01.00 @ 1986 IEEE
paper
their
destinations
by their
A good protocol for
deadlines.
results of simulation studies comparing the performance of
hard real-time communication should minimize this ratio.
our protocol with that of two baseline protocols.
The design objectives of multiple access protocols and
5 concludes the paper and suggests future work.
Section
scheduling algorithms are quite similar: Both are for allocation of a serially-used resource to a set of processes [13]. It is known from the tkeory of hard real-time scheduling
2
The Model
that, in the static case, i.e., when all the task characteristics are known a priori, minimum-deadline-first minimum-laxity-first
and the
In a multiple access network, a set of nodes are connected
scheduling policies are optimal in the
to one communication
sense that they can schedule a set of tasks if there is some
channel.
At any given time, only
one message can be successfully transmitted over the chan-
policy which can do so [15]. In the dynamic case, these
nel. The maximum end-t o-end delay for a bit is r.
policies also offer better performance than others [8]. Due
assume that the time axis is slotted.
to this fact, in our protocol,
We
The length of a slot
we adopt a network-wide
is defined to be one time unit. Given that the maximum
transmission policy in which the message with the mini-
end-to-end delay is r, we let the length of a slot be equal
mum laxity is transmitted first.
to r. A node can start transmitting a message only at the beginning of a slot. The length of a message is a multiple
Kurose et al. suggest a window protocol for real time communicantion [12,13], implement ing the minimum-laxity-
of the length of a slot. The
first policy. They assume that the laxities of all the mes-
defined as
sages when they arrive are constant. tion, the minimum-laxity-first first-come-first-served also studied They
the problem
assume
transmitted
policy.
that
policy is ident ical to the
the length
on the channel
transmission
where M is the mean message length.
is independent
delay
is
Previous work
shows that CSMA protocols are applicable to environments
policy.
of the i-th message
end-to-end
Q = TIM
Under this assump-
Panwar et al. [20,21] have
of optimal
normalized
where a has a small value such as 0.01.
being
Each message, M, can be characterized as follows:
of what the i-th
message is. In other words, the lengths of messages varies with the order in which they are transmitted. that if the channel is a message policy
waiting
is the best.
are removed:
In our protocol,
We allow messages
clock
and
to have arbitrary
lengths to be determined
each node maintains
a virtual
finds the channel
laxit ies, at the
Latest time to Send the message, LSM, is equal to
with the order
time
clock.
two clocks: Whenever
to be idle, it resets its virtual
to the real clock.
higher
Deadline DM. This is the time by which message M must be received by its destination;
DM – LM;
they are transmitted.
In our protocol,
equal
needed to transmit message M;
all of above assumptions
time they arrive and hence to be invariant
time
Length LM which is the total number of time uni&
prove
to be sent, the minimum-laxity-first
and also allow the message
in which
They
is not allowed to remain idle when there
The virtual
rate than the real clock.
clock
Laxity at time t,LAM(t)
a real a node
at time t.Therefore,
clock to be
then runs at a
A node transmits
is the maximum amount of
time the transmission of message M can be delayed
LAM(t)
= DM – LM – t = LSM – t.
a wait-
clock is equal to
When it is clear from the context, we may omit ar-
the latest time to send the message
which
is equal to the
gument t as well as subscript M in the above expres-
message
length.
This protocol
ing message
when the time on the virtual
deadline
implements Our protocol
cols — virtual discussion The
minus the message
the minimum-laxity-first belongs
to the newest class of CSMA
time CSMA
[18,19,14].
of the general virtual remainder
transmission
Section
2 defines the model
Section
3 introduces
in Section
is organized
we adopt
our protocol,
From these definitions, it is clear that if we transmit tasks
proto-
according to their latest start times, it is equivalent to the
We will have a brief
time CSMA
of this paper
sions.
policy.
3.
as follows:
in this study.
Section
minimum-laxity-first
While
4 presents
the
121
transmission policy.
3
A Virtual Time CSMA col: VTCSMA-L
b. Every node drops any waiting message if the LS
Proto-
of the message is less than the current time t, i.e., such a message is lost. 4. A node sends message M when VLSM
Various Carrier Sense Multiple Access (CSMA) protocols
equals the
have been proposed and evaluated [9]. Most of them may
reading of the virtual clock. Note that because the
not be suitable for hard real-time communication because
virtual clock runs faster than the real clock, the mes-
the message transmission delay cannot be bounded. Molle
sage is sent at (real) time
and Kleinrock [18,19] suggested a new class of CSMA protocols called Virtual node
Time
has two clocks.
another
One clock
gives the virtual
ning when the channel is idle.
CSMA.
time.
In this protocol,
each
gives the real time,
and
The virtual
where ~ > 1. This time is earlier than the latest time
clock stops run-
to send message M, LSM.
is busy, and runs when the channel
5. When a collision occurs during the transmission of a
When it runs, the virtual clock runs at a higher rate
than the real one if it is behind
the real clock.
time is equal to the time on
the virtual
advantages
protocol
clock.
The major
are its fairness
in transmitting
the waiting
rate, and better
[14].
we propose
real-time
run along
a virtual
communication.
Because
of this,
time
CSMA
LS such that
transmission
we call this protocol
policy
b. draws a number R randomly from the interval (t’, LSM),
protocol
We let the virtual
the axis of messages’
wide minimum-laxity-first
behavior
ability Pi; or
mes-
lower collision
Below,
a. re-transmits this message immediately with prob-
of the VTCSMA
sages (since it is based on the FCFS policy), delay-throughput
the sender node message, say at (real) time t’,
A message
is sent only when its arrival
hard
t + (VLSM – t)/~
for
VLSM
as
E R,
clock
a network-
c. then, puts this message back in the queue of mes-
is achieved.
VTCSMA-L.
and modifies VLSM
sages waiting to be transmitted.
The
following is the outline of our protocol:
The protocol above ensures that the message with the minimum VLS is transmitted first. By the definitions of
1. Each node has two clocks, one clock maintaining the
VLS, LS and LA, we notice that this policy is equivalent
real time, and another maintaining the virtual time
to that of the minimum-laxity-first.
set in a manner discussed below.
The following example helps to understand how the
2. Each message M is associated with a parameter virtual latest time to start
transmission,
VLSM.
time on the virtual clock relates to the time on the real clock (eee Figure 1).
when
a message arrives, VLSM of message M is set to be
EXAMPLE:
LSM. If the channel is idle and
found idle, every node resets its virtual clock to be t~= tl.
‘LsNew
Assume that at real time tl the channel is
Then the virtual clock runs at a rate of q > 1. Say, two
Message < – the reading of the virtual clock,
messages Ml and &fz are waiting to be sent with VLSM, =
the new message is sent immediately; otherwise it
tjand VLSM2 = tjrespectively.
waits. VLSM may be modified when the transmission
When the virtual clock
Ml is sent out. This message is transmitted equals to t;,
of this message causes a collision. We will discuss the
over the channel from the real time t2 to ts.During the
details of this modification in Step 5.
transmission of Ml, the virtual clock does not run.
3. Each node eenses the channel. Suppose that after ei-
At real time t~, because the channel is idle again, the
ther a successful message transmission or a collision,
virtual clock is set to be t~ = t3.Then it starts running at
at real time t every node finds that the channel is
rate q. When
idle:
sent out.
The channel
a. Every node resets its virtual clock to be equal to
running.
Say, at real time
the real clock.
the virtual
clock
reaches
t:, message
is busy, and the virtual
clock
&fz is stops
t5,the transmission of message
M2 finishes. Then the virtual clock is set to the value of
The virtual clock starts to run
and starts running again. the real clock (so t~= t5),
at rate ~ > 1. ~ is a parameter of this protocol.
From this example, it is clear that the virtual clock
We will discuss seIection of q later. The virtual clock will stop when the channel is busy.
does not run continuoust~.
122
At real time t3,the virtual
realizable in practice. We use it purely to give us an upper bound on performance. The second baseline protocol is based on the binary countdown protocol proposed by Mok and Ward [16]. We modify it as follows for use in hard real-time communication. 1. Let MLi
.----.,,// ,, ,, “r; /’:
‘/
‘/
. . .
to be sent, it sends out the complement
t
code of its MLi
of the binary
one bit per slot in a binary cormt-
down manner [16,26]. Briefly, the binary countdown method functions as follows: as soon as a node sees that a high-order bit position that is O in its MI/i has been overwritten with a 1 (by some other node(s)),
,,
P
..-.
/:
senses the channel to be idle, if it has any message
!,
,,
/:
.
/
be the minimum laxity (> O) of the mes-
sages waiting to be sent on node i. When each node
this node gives up and does not send any more bits.
,,
.
,’
/,6
2. After a complete
,,
(complement
code of) MLi
has
been transmitted along the channel, each node knows what the minimum laxity among all the messages waiting to be sent is. Those nodes, which have messages with this minimum laxity, then send out their identification number in the same binary countdown manner.
Figure 1: Virtual Clock vs. Real Clock clock is set to equal the real clock.
3. The node, which has the message with the minimum
It is not necessary
for the virtual clock to cover the interval (tj, t!Jbecause if
laxity and has the minir%um identification number,
t:)this message there is any message with its VLS in (tj,
starts sending out the message.
has been lost by real time ts.On the other hand, (t&,t’J is twice covered by the virtual clock.
4. Each node repeats the above procedure when the
This is necessary
channel is idle again.
because when message iW2 is being transmitted, some new messages may arrive with its VLS in that region and at
Because the “countdown”
real time ts,there is still a chance to transmit it.
is done on Iaxities of messages,
we call this baseline protocol Binary Countdown
on Lady,
abbreviated as BC-L. Note that BC-L uses
4
4.1
Performance Simulation Base-line
Centralized
[log, (Maximum Laxity)l + [log, (Maximum Node Identification Number)l time slots to decide which message is to be transmitted
Protocols
during each cycle of transmission.
We will compare the performance of VTCSMA-L baseline protocols.
by
Evaluation
with two
The first baseline protocol is called
Minimum
Lazit~
message
transmitted
4.2
Simulation
Results
First, We simulate 3 cases for a network of 10 nodes. The first
abbreviated as CMLF. In this protocol, all the transmissions of messages are assumed to be scheduled by a central-
two cases are for stochastic messages and the last one is
ized controller. This controller obtains perfect knowledge
for periodic messages.
about the nodes and the channel without any communica-
ten in Simscript, and runs in an ULTRIX environment on
tion overheads. It schedules the transmissions of messages
MicroVAX-II.
such that the message with the minimum laxity is trans-
probability of immediate re-transmission, FI, takes a value
mit ted first.
of 0.5. We will discuss extension to this in the last section.
This algorithm is hence an ideal one, not
123
The simulation program is writ-
For simplicity, in all the simulations, the
K-1
~ ~
T
vl[sHfl-
—
~
M-1
—
w
~
c
Ollf
0.80
!,!0
0,50
0.50
0.40
0.40
willl-1
0,11 0,?0
0,10 Loo~ ~ I 1 I I I t I I I I 0.00.10,7o,~’0,! 0,s0.6oil 0,80,91.01.11,1 ~
4.2.1
0.00
I
I
I 0.l !,?
I
I
I
I
I
I
I
I
Case 1: a = O.Ol, q = 27.0
Case 2: a = O.l, rl = 4.0
Figure’2: Message Loss vs. System Load
Figure 3: Message Loss vs. System Load
Stochastic
I
I
o,~0,40,50.60,10,80,91.01.11,1 ~
Messages
2. When a is small, e.g., equal to 0.01, the performance In Cases 1 and 2, messages process.
The arrival rate at each node is the same.
-lengths
are exponentially
in Case randomly 2. Recall Thus,
of VTCSMA-L
arrive at each node as a Poisson
distributed
with
1 and 10 in Case 2. The laxities
a mean
of 100
of messages
3. When a is large, e.g., equal to 0.1, the performance
are
of VTCSMA-L
chosen from [0, 600] in Case 1 and [0, 60] in Case that the end-to-end
in Case
the network
the system
L=
with system
load (L) is defined
the performance of VTCSMA-L
In
load from as
4. In any case, VTCSMA-L
Selection of q is an important issue for the application of VTCSMA-L.
number of nodes in the network. For the simulation, N = and =
10
is definitely better than
BC-L.
AR*M*N
node, M is the mean of the message length, and N is the 1,
is closer to that of
CMLF than to BC-L.
where AR is the mean of the message arrival rates at each
10, M = 100 in Case
is between that of CMLF and BC-L.
When the load is not too high, say, lower than 0.7,
delay r is the unit of time.
1, a = 0.01, and in Case 2, a = 0.1’.2
each case, we simulate 0.1 to 1.2 where
is almost identical, or very close to
that of. CMLF.
Message
For each value of CY,we test the system
performance over different values of q with three different
in Case 2. AR is adjusted
loads.
to get different values for L,
Figures 4 and 5 show the simulation results. We
see that when the system load is light (= 0.1 ),
Figures 2 and 3 show the ratios of message loss (R) vs.
is small
(= 0.01).
the system loads (L) for Cases 1 and 2 respectively. From
message
loss is very close to the minimum.
these figures, we can make the following observations:
that the system chosen
1. Message loss in CMLF and BC-L tends to grow al-
forms
most linearly with increase in system load.
[18,19],
‘We note that a = 0.01 is considered to be the typical application environment for CSMA [19].
performance
is not sensitive
performance are different.
a
This indicates to the values
This observation
with that made by Molle for the original though
or when
wide range of ~ values,
for q under these situations.
our VT CSMA-L
124
For a relatively
metrics
con-
VTCSMA
of his VTCSMA
and
Q
e
o ml ~ 0,9
0
e
B
d
b
El
0
0
1o11o ~0,5
10.!0 ‘ 0.1
!,60 0.50
A
0.s0
0.40 O,M \
0.30
0,)0
0.20
0,10
0.10I
0,!0
I
1
t
I
I
I
I
I
I
?.0 3.! ‘iiu 10,0 10,030.0 50,0 100,0 “ case 1: c1=
U.!(I 1.0
Periodic
Case 2: a =0.1
0.01
Figure 5: MessageLoss vs. q
IYlessages
Case 3 is for periodic messages.
Protocols BC-L VTCSMA-L CMLF
In hard real time sys-
tems, messages are often periodic, i.e., they arrive and request to be transmitted pertidically. be input/output
sill lit v
2,0 io S,u 10,0 20.0 N
Figure 4: MessageLoss vs. q 4.2~2
10RO :0,9 10IO ~0,5 10RO ‘ 0,1
These messages can
b= 01b=5751b 0.00 0.11