Hello, As a class project, we're looking at transactional memory, and one of things we'd like to try and do is add some basic TM support to Parrot.
To start out with, we'd add three new opcodes - one to begin, end, and abort the current transaction. the BeginTX op would save a continuation, abort would just restore that continuation, and commit would throw away the old continuation and move on. Then we'd actually try and add transactional memory :) Some basic questions: is there a notion of "current time" in Parrot, like a cycle counter or anything? I don't see any instructions I could get one from inside a PASM program, and I didn't see any of the .c files keeping track of one... When we turn on transactions in any thread, any shared variable that is written to will need to have a timestamp added to it noting when the last write occurred. Threads that are in transactions will have to keep track of all the data they read, and when they goes to commit they will have to check the last-written timestamp on each of the elements in the readset. (We don't actually need timestamps, we can do something where we have a list off each shared variable and take two passes through it to prepare for and then enter the transaction. The timestamp just makes it easier) This seems sort of easy to do with PMCs, since we can just latch on to the vtable and do our bookkeeping there (but wow, that's a lot of functions that a PMC might implement). How does it work with the builtin types like int? Like most other TM systems, we're punting on I/O for now. It's also not realistic, but for now you can only be in one transaction. Google has found a couple of notes from people saying that TM is cool and Parrot should do it - but nothing much beyond that. Is there anything besides Chip Salzenberg's ticket* that we should be aware of? Thanks! -Erik *https://rt.perl.org/rt3/Ticket/Display.html?id=36250