[Shootout-list] Re: ring of processes
Raymond Racine
rracine@adelphia.net
Sun, 03 Oct 2004 15:16:35 -0400
On Sun, 2004-10-03 at 14:24, Aaron Denney wrote:
> On 2004-10-03, Raymond Racine <rracine@adelphia.net> wrote:
> > I am not clear on the ring of process test.
> >
> Now there's still some wiggle room there -- before resuming "hard-work",
> do I process:
> (a) at most one low-priority message, if there is one waiting.
> (b) any currently waiting low-priority messages.
> (c) exactly one low-priority message, waiting for it if necessary.
<snip>
Agreed lo pri msg handling is a bit unclear.
> Due to the structure of the test, (a) and (b) should be
> indistinguishable, and (c) very close.
Ack.. This is where I was WAY off track a bit. I was assuming that
every time the master received back a (hi or lo) msg it would fire a new
pair of high and log messages into the ring. Therefore I was assuming
lo pri messages building up and going with b) and having inbound
mailboxes to buffer more then lo pri msg until it was no longer hard
working.
I think I started to go this direction from the following:
The description reads:
"After the tenth high priority message has been received, the receiver
should handle the low priority messages." <-- plural!!!
The pseudo code says this about the master process.
"Then wait to receive high and low priority messages from the last
process. When the root process receives its message again..."
The first part implies is does nothing until both messages are
received. The next clause talks about repeating the loop when it
receives its message which implies firing a hi/lo pair into the ring.
This means there are >1 lo msgs in the ring and then the plural "handle
low priority messages" makes sense and implies b) any currently waiting
low pri msgs.
This makes sense. You would be simulating ring processing multiple lo
pri messages, and prioritizing an incoming high pri.
The a) and b) are indistinguishable only on the assumption there is at
most 1 lo pri and 1 hi pri message in the ring at any given time. If
this is the case then what is the point of utilizing sychronization of
msgs at all. It also calls into question the nature of the test itself.
I think I shall suspend further effort and await clarification.
Ray
Ray