On 12 Oct 2015, at 14:47, Cl��ment Bera <bera.clement@gmail.com> wrote:

Hello,

If the operator is atomic that means if another thread (I am talking about native threads) interacts with the same portion of memory than the active thread its operation will be done after of before. This is a step toward a multithreaded VM with lock free algorithms and is different from just having a user interrupt or a process switch. #become: or the multiple assignments you showed are done in several cpu instructions hence another thread can manipulate the same memory while the operation is performed, which is not atomic.

Hence, the way I understand it is that the operation :=: is done in 1 cpu instruction. Sebasti��n has to change the bytecode compiler, the JIT and the interpreter to support that. That cannot be done with any variable, but it may be possible to implement :=: for at least 2 temporaries using the cpu swap.

There is still a long way to go to have a multithreaded VM with lock-free algorithms, but one has to start somewhere I guess. I am not expert in concurrent programming but atomic swap or test and set operations are probably the way to go.

I see. That does make sense. Thanks Clement.


Cheers,

Clement



2015-10-12 14:12 GMT+02:00 Max Leske <maxleske@gmail.com>:

On 12 Oct 2015, at 13:53, Sebasti��n Krynski <skrynski@gmail.com> wrote:

Hello my name is Sebasti��n Krynski from Buenos Aires, Argentina.

Hi Sebasti��n, welcome!

Just writing to let you know that I'm starting to work on adding an atomic swap operator in Pharo , guaranteed not to be interrupted by the VM. The operator will be used this way:

a :=: b

meaning 'swap variable a with variable b'.
In order to do this I will be modifying the VM and the Compiler .

Sound cool! But isn���t that the same as

a become: b

? I even think that

tmp := a.
a := b.
b := tmp

is equivalent, since the VM only interrupts message sends, and in this case only byte code would be generated?

That���s not my area of expertise, so please correct me.

Cheers,
Max


I'm working under the direction of INRIA and Gabriela Ar��valo.