This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-06-23
Channels
- # beginners (93)
- # boot (3)
- # cljs-dev (5)
- # clojure (49)
- # clojure-india (8)
- # clojure-russia (1)
- # clojure-spec (4)
- # clojure-uk (37)
- # clojurescript (33)
- # cursive (4)
- # datomic (4)
- # fulcro (11)
- # graphql (1)
- # lumo (16)
- # mount (1)
- # off-topic (21)
- # onyx (2)
- # portkey (4)
- # shadow-cljs (3)
- # spacemacs (4)
- # sql (1)
- # vim (1)
Guys, that’s so special about actor model? It’s just a function called on a queue, whereby the messages are inserted and popped synchronously. But since messages are executed sequentially, it’s not really concurrent. So what’s so cool about it? It’s like instead of acquiring the lock on the data you are working with, you acquire lock around the function which is called. Is it really SO SPECIAL?
The cool thing about the actor model is supervision
A single actor is not concurrent, but many actors working together are. The "official" view of the actor is that you need 3 things: 1) A way to send a message to an actor 2) A way to create an actor from a running actor 3) A way to specify how the next message given to the actor should be processed
So at a really low level, that's it. What Erlang and Akka have done is extended that to supervision and the like, but at the core actors are another form of programming paradigm that has its own tradeoffs.
Message passing systems are becoming more and more important as we reach many core CPUs. The new Threadripper 2 from AMD is a rather horrific design for shared memory systems. As time goes on we'll probably see more issues in that area.
@alexmiller so supervision is something that actor has, but CSP doesn’t? Other that that, replace messagebox with channel and you get something really similar to CSP? Or not so simple, since channels are 1:1, message-boxes are 1:N?
They're really different. Actor systems don't guarantee delivery or even message ordering. CSP guarantees both.
But on the other hand it's pretty much impossible to extend a CSP channel over a network. And since it requires about 2-3 locks, performance will degrade the more cores are involved.
Somewhat like TCP, but it's even worse. since when you do (chan) you create a channel that's a handoff. Your write won't complete until the other end has taken the message. That's really hard (impossible I think) to do across a network
So yeah, actors are a bit more like UDP in that way, and then systems like Erlang and Akka add automatic retries, supervision, etc.
I really recommend this btw: https://www.youtube.com/watch?v=7erJ1DV_Tlo
@tbaldridge but in TCP you also send ACK messages, to confirm the receiving of the message
(Hewitt invented the actor model)
I’ve started to watch that video, but it was kinda dry, or maybe I wasn’t really concentrated I’ve been watching this right now: https://www.youtube.com/watch?v=lPTqcecwkJg
BTW, something I do when I'm bored is go here: https://en.wikipedia.org/wiki/Programming_paradigm and pick a link from the right-hand side and start reading up on it. There's a lot more out there than FP/OOP
https://cs.brown.edu/~sk/Publications/Papers/Published/kf-prog-paradigms-and-beyond/paper.pdf was just posted which might have good references
https://cs.brown.edu/~sk/Publications/Papers/Published/kf-prog-paradigms-and-beyond/paper.pdf was just posted which might have good references