-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PIEO Queues – Overview & Analysis #12
Comments
Super cool, thanks for this research!
|
Also: a big use of the eligibility check in PIEOs is probably non work-conserving algorithms, sometimes also known as shaping algorithms. From Formal Abstractions:
To achieve this using a PIFO is tricky and requires various tricks. With a PIEO, I can imagine carefully crafting the time-aware eligibility check |
Replying to the earlier thread:
The policy I believe here is to return whichever copy was inserted first.
Unfortunately my interpretation seems to have been wrong – the papers were both a little bit vague on how the eligibility predicate is actually defined. My interpretation was that it would be nice to have a one-for-all predicate given a PIEO that could operate on all incoming packets. Your suggestion makes a lot more sense though – popping then kind of integrates the |
Updates on using PIEOs for this project: I definitely believe that implementing these would be a worthwhile task. They provide a fairly significant advantage over PIFOs, and we can rely on existing implementations already. @polybeandip and I were discussing potential implementations. I think we might try to begin with the binary heap structure, which should already support enqueueing in the way we desire. We can then add functionality specific for dequeueing specific elements. |
Note on predicates: Fortunately, for most packet scheduling algorithms, the predicate usually takes the form ( |
Just to summarize, I think we have agreed that the eligibility predicate is neither as baked-in as was originally suggested, not as free-wheeling as I then proposed. It will be relatively baked in, but will crucially have some kind of |
This PR introduces Python test oracles for Push-In-Extract-Out (PIEO) Queues and Programmable Calendar Queues (PCQs). It also generalizes parts of the oracle generation framework to account for parameters like time and rank being passed in directly. For further info on these structures, please consult the notes that I and @anshumanmohan's have put together on [PIEOs](cucapra/packet-scheduling#12), [PCQs](cucapra/packet-scheduling#15) and [PIEO Trees](cucapra/packet-scheduling#16) which also discuss the PIEO-PCQ implementation I have gone for here.
PIEO Queues – Overview & Analysis
This issue discuss the implementation of the PIEO (Push-In-Extract-Out) Queue, its relevance against PIFOs and potential drawbacks. See #9 for details on the task!
Papers
Summary
Fundamentally, a PIEO (Push-In Extract Out) Queue is a generalization of the PIFO (Push-In First Out) Queue which we have already studied. The main difference lies in how a queue is queried.
Functionality and Relevant Operations
PIFOs contain two key functions –
enqueue(f)
anddequeue(f)
(or,push
andpop
), alongside the query methodpeek
. These requiref
to be some element containing a value and a rank.With PIFOs, enqueueing pushes a new packet
p
into a queue such that the rank ordering is preserved. Dequeueing pops the head of the queue.PIEOs embody all of this functionality, but with an added eligibility predicate. This takes on the form of a partial function mapping PIEO nodes to true or false. (See McLaughlin).
enqueue
functions the same way. Thedequeue
function can take in an optional parameterp
representing a specific packet to be dequeued.If such a parameter is provided and and
p
occurs within PIEO, then the packetp
is dequeued and returned, regardless of rank and eligibility. Otherwise,None
is returned.Notably, in the case that one wishes to update the value or rank of a packet
p
, this can be performed by dequeueingp
, updating it, and then enqueueing it again.If no parameter is provided, then the PIEO filters all packets such that the eligibility predicate returns true. It the returns the element with the lowest rank. In the case of a tie, the earliest element to be enqueued is returned.
A Side Note/Question On Peeking
While both papers have only explicitly discussed the
enqueue
anddequeue
functions (with no mention of peeking), our PIFOs account for peeking as well.I propose that for PIEOs, we generalize the function
peek
in the same way we willpop
– that is to say, we rundequeue
with optional parameterp
, but do not modify the PIEO in question.Pros and Cons of PIEOs (Against PIFOs)
There are a few drawbacks of using a PIFO for packets, which PIEO queues can address (See in particular Section 2E of Elbediwy et al.)
Inability to Re-Rank Enqueued Packets
dequeueing
a specific packetp
, modifying it as desired and thenenqueueing
it again, we're able to bypass this issue.Scalability
A Potential Downside – Speed
A Visual OCaml Representation
For the sake of argument and a visual aid, I've explored a functional PIEO module type implementation in OCaml:
In which
eligible
maps any element to true or false,enqueue
takes in a PIEO, element and rank and returns a PIEO, and bothdequeue
andpeek
take in a PIEO and an optional element, and either return the element (if found) and a PIEO queue.The text was updated successfully, but these errors were encountered: