<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Dec 18, 2009, at 4:32 AM, Stephen Pair wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div class="gmail_quote">On Fri, Dec 18, 2009 at 4:01 AM, Josh Gargus <span dir="ltr">&lt;<a href="mailto:josh@schwa.ca">josh@schwa.ca</a>&gt;</span> wrote:<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">


However, even if we were to use a single scheduler process, there is still some ambiguity about what should be the execution order of #future: messages. &nbsp;For example:<br>
<br>
(self future: 2000) foo.<br>
(self future: 1999) bar.<br>
<br>
Which should execute first? &nbsp;If a high-priority process interrupts, then the second line might not run for another 4ms. &nbsp;Croquet ensures a deterministic order by not advancing the clock while executing queued messages in an island, and by making it illegal to send #future: messages from outside of the island (only #future messages are allowed).<br>

</blockquote><div><br></div><div>Here are my thoughts on this.</div><div><br></div><div>I think the important thing here is to clearly define the semantics before lots of code gets written that uses this...so, I would say that #future messages should be the equivalent of "future: 0" </div></div></blockquote><div><br></div><div><br></div>They are.</div><div><br></div><div><br></div><div><blockquote type="cite"><div class="gmail_quote"><div>messages and that any #future: messages sent with the same delay should be queued in the order they are sent. </div></div></blockquote><br><div><br></div>Without question. &nbsp;This is a limitation of the current implementation.</div><div><br></div><div><br></div><div><blockquote type="cite"><div class="gmail_quote"><div>&nbsp;Any message sent with a smaller delay should be queued before messages sent with a larger delay. &nbsp;</div></div></blockquote><br><div><br></div><div>That's my point above. &nbsp;Should #bar be scheduled before #foo? &nbsp;What about if there is a statement inserted between the two lines? &nbsp;What if there are 10 statements? &nbsp;What if one of the statements is waiting on a semaphore?</div><div><br></div><div>Within a Croquet island, it is guaranteed that clock-time would not advance while processing the statements, so it is guaranteed that #bar would be scheduled for execution before #foo. &nbsp;If we're using "Time millisecondClockValue", then we have no such guarantee.</div><div><br></div><br><blockquote type="cite"><div class="gmail_quote"><div>These semantics would apply for messages sent from within the same process (which is what I believe we consider the unit in squeak that maps to Miller's VAT). &nbsp;Messages being queued from different originating processes would have no guaranteed ordering (but, if we were to introduce Croquet style replication of processes (within or between squeak images), once an ordering is established, it would be maintained for all replicas...also I think that would necessitate introducing a psuedo-time like TeaTime). &nbsp;As I mentioned, I think a squeak Process should be the unit where these queues are maintained and be the squeak equivalent of a VAT </div></div></blockquote><br><div><br></div><div>Agreed...</div><div><br></div><div><br></div><blockquote type="cite"><div class="gmail_quote"><div>(though, not necessarily all Processes should be made into such a "light VAT"). &nbsp;</div></div></blockquote><div><br></div><div><br></div>Agreed...</div><div><br></div><div><br><blockquote type="cite"><div class="gmail_quote"><div>And, large subsystems (like a Morphic project) where things should logically be contained within a single VAT should be refactored as necessary and over time to fit in that model (i.e. anything running outside the Morphic project's VAT should updated to communicate with morphic using only future sends). &nbsp;</div></div></blockquote><div><br></div><div><br></div>And agreed!</div><div><br></div><div><br><blockquote type="cite"><div class="gmail_quote"><div>Of course, these "light-VATs" won't do anything to help with the shared state concurrency issues that can (and will) arise...the burden of dealing with that will have to be on the person writing the code (for now).</div>

<div><br></div><div>So, what about deadlines? &nbsp;Is there a way to set a deadline for a future send to be executed (after which your promise would yield some kind of timeout exception)? &nbsp;</div></div></blockquote><div><br></div><div><br></div>Not currently. &nbsp;Instead, you can use #waitTimeoutMSecs: to wait on a promise until it has resolved, or until the time-limit is exceeded.</div><div><br></div><div><br><blockquote type="cite"><div class="gmail_quote"><div>And, related to that, what about some provisions for rejecting messages (i.e. if a message queue has reached some maximum capacity or it is falling behing? &nbsp;How does Croquet handle such things (especially when it would have to be handled is such a way that guarantees identical results across replicated islands running on hardware with potentially very different characteristics)?</div>

<div><br></div><div>- Stephen</div><div><br></div><div>P.S. I think Mark Miller's thesis is something everyone should read if they haven't already: <a href="http://www.erights.org/talks/thesis/">http://www.erights.org/talks/thesis/</a>&nbsp;...I believe it is essential reading for anyone trying to think about how this stuff should work in squeak.</div>

</div><br></blockquote><div><br></div><div><br></div>+1 &nbsp;Mark's thesis is a great read.</div><div><br></div><div>Cheers,</div><div>Josh</div><div><br></div><div><br></div><div><br><blockquote type="cite"><div><br></div>
<br></blockquote></div><br></body></html>