Let's begin with queue-handling 101.  A queue is a FIFO list.  One
adds elements to the rear of a queue and removes them from the front.

Tony Harminc's implicit point, that these two operations can be
serialized and done unproblematically, is correct beyond argument.
There is never a requirement to use fallible, probabilistic methods to
do so.

This said, it is all but certain that Jon Perryman is trying to
address OTHER problems too.  It is clear from what he has said that he
must sometimes find and remove an element that is not necessarily at
the front of his queue.

How is such an element identified?  By address?  By key?   By a
sequence number of timestamp?

What other kinds of processing does he need to do?  Does he, for
example, sometimes need to insert an element at some position other
than the rear of this queue?  [Moving elements in the queue is
equivalent to deleting them from one position and reinserting them
elsewhere.]

Once his functional requirements are understood control blocks and
non-probabilistic code to meet them will be easy enough to devise.

The appropriate use of pointers to pointers, for example, greatly
simplifies many queue-management problems, making it unnecessary to
distinguish removal operations positionally.  One need not care
whether one is removing an element at the front, rear, or in some
intermediate position in a queue.  Moreover, one should not.  In
addition to being inelegant/messy special casing is error-prone.

We thus need more information if we are to be helpful.

John Gilmore, Ashland, MA 01721 - USA

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to