<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#ffffff">
On 12/14/2011 05:45 AM, Glyph wrote:
<blockquote
cite="mid:F1901420-DAD9-4879-8E65-CAFC123BACA4@twistedmatrix.com"
type="cite">
<div>
<div>On Dec 13, 2011, at 2:04 PM, Andrew Francis wrote:</div>
<br class="Apple-interchange-newline">
<blockquote type="cite"><span class="Apple-style-span"
style="border-collapse: separate; font-family: Menlo;
font-style: normal; font-variant: normal; font-weight:
normal; letter-spacing: normal; line-height: normal;
orphans: 2; text-indent: 0px; text-transform: none;
white-space: normal; widows: 2; word-spacing: 0px;
font-size: medium;"><span class="Apple-style-span"
style="font-family: monospace;">Now at time T, there are
eight reindeer and two elves ready. At T+1, an additional
reindeer and elf are ready (their timestamps are the same,
timer resolution notwithstanding). However the Twisted
reactor will serialise the events and trigger the
callback. For argument, let us pretend the elvesArrive
callback is activated and that wakes Santa. Santa consults
with the elves. The problem is that all nine reindeer were
ready and the priority rule is broken. I am not sure, from
inside the callback, one could check to see if nine
reindeer were indeed ready.<br>
</span></span></blockquote>
</div>
<br>
<div>This strikes me as a problem with the way that quantum
physics works more than the way that Twisted's reactor works :).
Broadly speaking, no two events can happen at the <i>exact</i>
same time; even if they did, relativity says you wouldn't be
able to <i>tell</i> if they happened at the exact same time
unless they also happened to be exactly the same distance away
from you. (But then "you" would have to be exactly one atom
big, which is a pretty demanding size to build a sensor.)</div>
[...]
<div>Ultimately however, the order of the work <i>will</i> be
arbitrary; if it's not influenced by the vagaries of Twisted's
scheduler, it will be influenced by something in the kernel
scheduler that you don't understand or can't control, or in the
IP stack, or in a switch on your network, or in your hosting
provider's firewall configuration, or something on a client
machine that you truly have no influence over at all. Having
something give priority to an event that occurs at "the same"
time given all of these potential sources of interference is
basically pointless.</div>
<div><br>
</div>
</blockquote>
Isn't that what logical clocks, using e.g. Lamport timestamps are
for? What can be done is letting the events happen, wait for another
logical tick, possibly triggered by a timeout to prevent starvation,
looking at the events that have been collected and identified, but
not processed yet, treating a certain maximum N of logical ticks as
"simultaneous" and then decide on how to prioritize processing,
based on arbitrary rules you choose.<br>
<br>
regards,<br>
Johann<br>
</body>
</html>