<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div style="RIGHT: auto"><SPAN style="RIGHT: auto">Hi Armin:<BR style="RIGHT: auto" class=yui-cursor></SPAN></div>
<div><BR></div>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt">
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt; RIGHT: auto" dir=ltr class=ms__id1711><FONT size=2 face=Arial>
<DIV style="BORDER-BOTTOM: #ccc 1px solid; BORDER-LEFT: #ccc 1px solid; PADDING-BOTTOM: 0px; LINE-HEIGHT: 0; MARGIN: 5px 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; HEIGHT: 0px; FONT-SIZE: 0px; BORDER-TOP: #ccc 1px solid; BORDER-RIGHT: #ccc 1px solid; PADDING-TOP: 0px" class=hr contentEditable=false readonly="true"></DIV><B><SPAN style="FONT-WEIGHT: bold">From:</SPAN></B> Armin Rigo <arigo@tunes.org><BR><B><SPAN style="FONT-WEIGHT: bold">To:</SPAN></B> Andrew Francis <andrewfr_ice@yahoo.com> <BR><B><SPAN style="FONT-WEIGHT: bold">Cc:</SPAN></B> PyPy Developer Mailing List <pypy-dev@python.org>; "stackless@stackless.com" <stackless@stackless.com> <BR><B><SPAN style="FONT-WEIGHT: bold">Sent:</SPAN></B> Wednesday, April 11, 2012 8:29 AM<BR><B><SPAN style="FONT-WEIGHT: bold">Subject:</SPAN></B> Re: The Work Plan Re: [pypy-dev] STM proposal funding<BR></FONT></DIV>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt" class=ms__id1711><BR>On Sun, Apr 8, 2012 at 01:25, Andrew Francis <<A href="mailto:andrewfr_ice@yahoo.com" ymailto="mailto:andrewfr_ice@yahoo.com">andrewfr_ice@yahoo.com</A>> wrote:<BR>AF> Question: without specific transaction_start() and transaction_commit()<BR>AF> calls, how does rstm know what the start and finish of transactions are?<BR><BR>>Please take a different point of view: if the proper adaptation is<BR>>done, the users of the "stackless" module don't need any change.  </DIV>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt" class=ms__id1711> </DIV>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt" class=ms__id1711>Yes. Suggestion: perhaps in a future position paper, you can state as a design principle that the programmer</DIV>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt" class=ms__id1711>does not explicitly state a commit point?</DIV>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt" class=ms__id1711> </DIV>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt" class=ms__id1711>So returning to the example,  a programme more in the spirit of what you are doing is:</DIV>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt" class=ms__id1711> </DIV>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt" class=ms__id1711>def transferTasklet(ch)<BR>      def transfer(toAccount, fromAccount, amount):</DIV>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt" class=ms__id1711> .          fromAccount.withdraw(amount)<BR>            toAccount.deposit(amount)<BR><BR>      while someFlag:<BR style="RIGHT: auto">               toAcount, fromAccount, amount = ch.receive()<BR>               transaction.add(transfer, toAccount, fromAccount, amount)</DIV>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt" class=ms__id1711> </DIV>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt" class=ms__id1711>if __name__ == "__main__":</DIV>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt" class=ms__id1711>      ch = stackless.channel()</DIV>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt" class=ms__id1711>      task = stackless.tasklet(transferTasklet)(ch)</DIV>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt" class=ms__id1711>      transaction.add(task)</DIV>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt" class=ms__id1711>     ....</DIV>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt" class=ms__id1711>     """</DIV>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt" class=ms__id1711>     let us assume that the stackless scheduler and transaction manager are somehow integrated </DIV>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt" class=ms__id1711>     """</DIV>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt" class=ms__id1711>     stackless.run()    </DIV>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt" class=ms__id1711> </DIV>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt" class=ms__id1711> </DIV>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt" class=ms__id1711>and we assume that the underlying system "magically" takes of stuff. However the programmer does have to throw the</DIV>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt" class=ms__id1711>transaction manager a bone (hence transaction.add())</DIV>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt" class=ms__id1711> </DIV>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt" class=ms__id1711>>They will continue to work as they are, with the same semantic as today ---<BR>>with the exception of the ordering among tasklets, which will become<BR>>truly random.  </DIV>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt" class=ms__id1711> </DIV>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt" class=ms__id1711>Noted. I think issues of ordering (serialisation)  is a consequence of a correctly implemented transaction manager.</DIV>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt" class=ms__id1711> </DIV>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt" class=ms__id1711>If I understand your strategy, the approach is to give a Python developer a race free programme with minimum effort. </DIV>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt" class=ms__id1711> </DIV>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt" class=ms__id1711>However I think a major concern would be implementations that minimises conflicts/contention. As I stated</DIV>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt" class=ms__id1711>in previous posts, I believe in the case of Stackless, the message passing system is natural way to give the application</DIV>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt" class=ms__id1711>programmer more control in regard to minimising conflicts/contention (or whatever term the literature uses).</DIV>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt" class=ms__id1711> </DIV>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt" class=ms__id1711>>This can be achieved by hacking at a different level.<BR></DIV>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt" class=ms__id1711>I am interested in what this hacking looks like under the hood. Again, I am assuming as a design principle guideline</DIV>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt" class=ms__id1711>(and to focus folk's efforts), one should be providing the rstm module just enough information to work but make no</DIV>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt" class=ms__id1711>assumptions about how it works. So one ought not depend on whether  strategies like eager/lazy evaluation (right now, </DIV>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt" class=ms__id1711>I think your system depends on lazy evaluation since I see stuff like redo logs), are used. </DIV>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt" class=ms__id1711> </DIV>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt" class=ms__id1711>Still I am interested in stuff like: would rstm function correctly if  the underlying implementation tracked tasklets rather than threads?</DIV>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt" class=ms__id1711>I am looking at your implementation and the AME.c/h file in Duhton. I want to get into a position to do some hacking. So I want </DIV>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt" class=ms__id1711>to think about:</DIV>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt" class=ms__id1711> </DIV>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt" class=ms__id1711>What do we know about the relationship between transactions, tasklets and threads?</DIV>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt" class=ms__id1711> </DIV>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt" class=ms__id1711>Under what conditions in a Stackless application, would conflicts occur? What could be done by 1) The programmer 2) The STM</DIV>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt" class=ms__id1711>implemenation to avoid this?</DIV>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt" class=ms__id1711> </DIV>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt" class=ms__id1711>Some side notes: I was reading about the Haskell implementation in the "Software Transactional Memory 2nd" book (chapter</DIV>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt" class=ms__id1711>4.6.2 - conditionl synchronization). It seems that Haskell has a user space "thread" library that is somewhat integrated with the STM.</DIV>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt" class=ms__id1711>I am going to look at this more since this is something that Stackless could take advantage of. </DIV>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt" class=ms__id1711> </DIV>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt" class=ms__id1711>Salut<VAR id=yui-ie-cursor></VAR>,</DIV>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt" class=ms__id1711>Andrew</DIV>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt" class=ms__id1711> </DIV>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt" class=ms__id1711> </DIV>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt" class=ms__id1711> </DIV>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt" class=ms__id1711> </DIV></DIV></div></body></html>