[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Priority revisited: a new primitive
--
Dr A E Lawrence
Here is a folded example with three events a,b and c:-
PAR PRI [{a},{b},{c}]
P1
P2
..
Pn
is equivalent to (=) {modulo qualifications as before}
PRI PAR
{{{ scheduler samples for each high priority event like TIMER queue
SEQ
sampling := TRUE
WHILE sampling
PRI ALT
a
SKIP
b
SKIP
c
SKIP
done
sampling := FALSE
}}}
{{{ everything else just runs in parallel as usual
SEQ
{{{
PAR
P1
P2
...
P3
done
}}}
}}}
Notice that this 3-way synchronization is nothing new. A transputer or KROK
kernel can be described economically in a similar way. And as noted above,
the required behaviour has a lot in common with the existing TIMER queue
which implements
timer ? AFTER period
semantics.
To spell that out, probably unnecessarily for this audience, and
probably not quite accurately, the first process that engages in a
particular communication will write the details into the channel word and
deschedule itself. But that descheduling is a synchronization with the
scheduler. The scheduler will take a decision on what to do next: I can't
remember whether it explicitly checks the TIMER queue. If PAR PRI is
supported, it might have a similar sorted list of high priority *events*.
{Does a TIMER event have higher priority than a PAR PRI event? Maybe timer
events can appear in a PAR PRI, so the two queues might need to be merged,
which would seem to be A Good Thing for efficiency.}
Anyway, if the queue is empty, it behaves in the usual way.
Otherwise it schedules the "partner process" for the outstanding high
priority event.
So the implementation of
PAR
c ! grunge
c ? x
is really a 3-way event with the third partner being the hidden scheduling
mechanism.
MALT
~~~~
In passing, MALT is redundant. It is just an ALT with merged events. Let's
not add redundancy to the language unless it has clear benefits. I did say
this at the end of the paper that introduced MALT (was it at Kent two
meetings ago?) , and presented a scribbled slide about it. But I guess
that the idea of merged events was new then, and maybe people didn't
follow. Or am I wrong?
Adrian
--
Dr A E Lawrence