We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.

Siya mishra • 3 years ago

Great article!

What do you use to for the diagrams?

Li Sheng • 4 years ago

Let’s imagine we have an actor that behaves like a calculator and that its initial state is simply the number 0. When this actor receives the add(1) message, instead of mutating its original state, it designates that for the next message it receives, the state will be 1

this does not make sense to me, so does the actor change its internal state or not?

Martyn Cutcher • 4 years ago

The only identity of the Actor is the mailbox. Actors have something called a "become" statement; this defines the behaviour and state of the object behind the mailbox. So when an Actor with state 3 receives an "add(1)" message it "becomes" a new object with state 4 to process the next message. This is related to lazy-list programming in functional languages which allow state changes in languages that are immutable. The Actor model does in fact enable concurrency for non-mutable operations, where a "become" can be actioned before processing the message (to perform some computation).

Anton Bagdatyev • 5 years ago

Really interesting article! Could you elaborate this part, please?

> Let’s imagine we have an actor that behaves like a calculator and that its initial state is simply the number 0. When this actor receives the add(1) message, instead of mutating its original state, it designates that for the next message it receives, the state will be 1.

How and when does the actor mutate its internal state? Thank you!

Thiago Miranda • 5 years ago

So if I just use one queue with producers and consumers in RabbitMQ I can replicate de Actor Model in any language. We was already using this pattern and just didn't know it's name lol.

soham joshi • 5 years ago

using a rabbitmq queue does not match the actor model my friend. There is a subtle difference. Actors message each other "DIRECTLY". An actor knows the address of the actor it is messaging. This is a key element. In rabbit mq case the producer just knows about the message queue and knows nothing about who will consume.. i.e it does not know reference/address of any of the consumers.

Revisit the One ant is no ant section of the article.

Relentless • 5 years ago

How does it know the actor? Through some mailbox? If so, can't we say that 'queues' are mailboxes? Or 'dark boxes'. As the article says, you don't care where the actor lives. Perhaps you also don't have to care who the actor is?

Thiago Miranda • 5 years ago

Oh, good point, thanks for the answer. I hadn't quite understood that before. This message exchange serves to share data between processes without data races I suppose

Thomas • 6 years ago

Shouldn't it be:
"that is basically what Erlang calls its actors"
?

Garapati Anil • 6 years ago

Nice

Frank Silano • 6 years ago

Thank you for posting this.

Sai Tarak • 6 years ago

Can the programming be helpful for embedded systems

Soham Kamani • 6 years ago

Great post! Short and sweet :)

Yasser Hussain • 7 years ago

Awesome article. Looking forward for more.

Ekin Yücel • 7 years ago

it's clear and concise. thank you for your effort

David Okwii • 7 years ago

well explained. Thanks

Phanindra Moganti • 7 years ago

Edit - 'whose' only responsibility is to know what to do when this crash happens.
Nice Article BTW

Ravi Hasija • 8 years ago

Well written

Well explained.Thank you

aram yazdanpanah • 8 years ago

very gooood and useful post , thanks

Pierre-olivier Gendraud • 8 years ago

Hello

Thank you for this explication.

I have one more question. In order to model an application with actor model stackoverflow 's members have advised to use the communication diagram ( http://www.uml-diagrams.org... ).

But i don't understand how to model the creation of actor with this model.

any suggestions or links on this would be helpful.

best regards

Rob Crawford • 8 years ago

Note that a communication diagram corresponds with a sequence diagram, and a sequence diagram includes the idea of a "life line" for the participant. I use that, along with a message of "create", to represent creating a child.

Leo Karti • 8 years ago

Thank you for a compact intro in actor based languages.
I have a question can deadlock still occur in actor based languages (for example in scala or elixir).if yes how to detect and avoid them ?any suggestions or links on this would be really helpful.

Cassio • 8 years ago

very good!

Felipe Rodrigues • 8 years ago

Clear and good explanation, thanks a lot.

Harsh • 8 years ago

Well explained .. Thanks !

Paresh • 8 years ago

Concise and crisp. Great post !!

Pedro Assumpcao • 8 years ago

Really great post, direct. Thanks for video too.

Prasenjit Biswas • 8 years ago

So clearly articulated. Wish all technical articles were this. "Lagom" - just enough - no more no less.

Zeeshan • 9 years ago

You open my eyes. I was struggling to understand it for weeks.

Nathan Johnstone • 9 years ago

Good introductory post, although I think perhaps the sentence "Think about it, if an actor is just this unit of code with a mailbox and an internal state" is a bit misleading. If you have multiple instances of the same actor, i.e created via a router, and those actors have "internal state" then it really depends on the actor implementation as to whether you really care about which instance you are talking to.

Actors that are designed to be stateless, similar to the concepts of a RESTful service, are better suited to be distributed, especially when a number of actors are coordinating together to accomplish some final task.

dmoscrop • 9 years ago

REST isn't about stateless services. It's about stateless communication. Both client and server are stateful

David Rodriguez • 9 years ago

Hi, good POST!!

I like this video on how to put actors in action (and show the difference with parallelism/threads)

https://www.youtube.com/wat...

C Wu • 9 years ago

Concise!

Jonas Verhoelen • 9 years ago

Thanks! Those 10 minute blog posts really come to the point - I love it.

p • 9 years ago

awesome!

Jack • 9 years ago

Good one