mobarski / morty

Morty programming language, Morty virtual machine and MortyVM assembler
GNU General Public License v3.0
2 stars 1 forks source link

Parallelism and concurrency #2

Open dumblob opened 3 years ago

dumblob commented 3 years ago

Interesting source of inspiration for easy parallelism (os-level threads) in a concatenative language is Blacklight. It also has built-in support for queued communication between threads and overall it looks quite clean with the concept of three stacks.

Although as it's currently implemented in the VM (which is written in Go lang), each modification (rot, swap, ... incl. any value addition & removal) of either stack requires a mutex lock & unlock. This means pretty slow operation in general. But maybe the clean API can be implemented in a more efficient way (I'm thinking of thread local storage etc.).

mobarski commented 3 years ago

Before I'll approach parallel processing I want to provide solid cooperative multitasking with communication via channels. Then I plan to add os-based threads and add synchronization of channels. Each task will have its own data stack and return stack, and only communication and heap allocation will be synchronized. At least, that's how I see it now.

dumblob commented 3 years ago

Sounds solid. Thanks for the outlook!