Channels, Concurrency, Cores: A New Concurrent ML Implementation (2017) [video]
youtube.com
youtube.com
It is a really nice scheme implementation and very capable. The stuff the guix people have done is amazing!
Concurrent ML is my favourite way of writing multi threaded parallel programs. It is a bliss! One can say that reagents in multidirectional ocaml is another step downwards in that it in most regards generalises CNL, but in its base form it is not as simple to work with.
Guile fibers is amazing to work with, and has good repl integration. The performance I am able to get out of it is nothing short of amazing.
Two days ago I made my own very shitty static site generator parallel using fibers.
I have a POC for a irc-like server with proof-of-work to send messages depending on current message throughput. (Not online yet)
I am not really a programmer, so I mostly do stupid things with it. I made my smart home server (written by me, using ZigBee to communicate with devices) scale to thousands of parallel authenticated connections. Just for fun (or at least to be able to say that my WiFi and ZigBee dongle gave up before my own ZigBee controller software did).
I have even used it for fully cooperative multitasking (by setting the "Hz" in guile-fibers to 0).
Reagents are more comparable to STM I would say, even though it is slightly less expressive in some areas, but on the other hand is always lock-free.
Reagents do generalise CML. The main difference is that CML only allows you to combine operations with select (op1 OR op2) while Reagents also allow you to combine operations into a transaction (op1 AND op2 for independent operations and op1 THEN op2 for dependent ones). Reagents are lightweight in that the library analyses the combined operation and then figures out an efficient CAS scheme to execute it. Reagents also include some more low level operations, such as CAS as a reagent. -- https://wingolog.org/archives/2017/06/29/a-new-concurrent-ml...
I hope that's correct...
> Reagents are more comparable to STM I would say, even though it is slightly less expressive in some areas, but on the other hand is always lock-free.
What is the difference in expressiveness between STM and Reagents? Is it that STM provides monadic bind, whereas Reagents only provide applicative, i.e. Reagents cannot dynamically decide to update different locations based on values read in the transaction?
In comparing STM and reagents I will probably just regurgitate what Aaron Turin says in his paper "Reagents: Expressing and Composing Fine-grained Concurrency" which you can find using a short Google. I only seem to be able to copy the Google link, so you will have to Google it yourself.
func fanin(out chan<- int, ins ...chan int) {
switch len(ins) {
case 0:
case 1:
for msg := range ins[0] {
out <- msg
}
case 2:
for {
var msg int
select {
case msg = <-ins[0]:
case msg = <-ins[1]:
}
out <- msg
}
default:
go fanin(out, ins[:len(ins)/2]...)
go fanin(out, ins[len(ins)/2:]...)
}
}
https://play.golang.org/p/9KNkheXHUBrYou can also use reflect: https://golang.org/pkg/reflect/#Select
Concurrent Pascal had them in 1976.
And there are plenty of other examples gaining digital dust.
Meant to write "Go allows safe concurrent access but doesn't stop unsafe concurrent access to shared data structures"
Thanks & sorry for the confusion.
Most lang/system capability models (including Go's) are open from the start -- where anyone can do anything -- and then when designing the lang/system you try to restrict access between some things at some of the time, but this gets messy fast and it's hard to get right and thus it's almost never optimal.
So rather than trying to start with an open model that's inherently flawed by definition, Pony flips the model on its head and begins from the perspective that everything is denied unless specified. You would say Pony has a deny-first capabilities model, which you can see explicitly defined here in Pony's capabilities matrix...
https://soyyomakesgames.wordpress.com/2016/10/10/ponys-capab...
And if you listen to Sylvan's talks, he is emphatic that solving the capabilities problem upfront was key that made everything else possible. All the other cool stuff you hear about in Pony like the provably correct runtime and finally achieving something approaching Hewitt's elusive Actor model that's been theoretically true for 40 years but never fully realized. Well the key to solving that mystery and unlocking the door was to take a new view on the capabilities model and building everything off that from the start.
https://github.com/ponylang/ponyc
> goroutines are a major innovation upon threads.
Not exactly, Erlang has had them for almost three decades.