Understanding Akka Actors' threading

I'm having troubles understanding Actors in Akka and how a thread relates to an Actor.

Let's take the example of a Fridge Actor and a Person Actor sending GetFoodMessage(s) to a Fridge Actor Reference. Assume that immutability is respected.

  • Will those messages be processed at the "same time" in differrent threads or will those messages be processed one by one in a queue?
  • Is thread spawning completely managed by the library and abstracted from the concept of an Actor?
  • Is an Actor reference an instance of the Actor?
  • When I stop an Actor (and his children) am I killing threads? (In the case that the Fridge has no more food and notifies the Person Actor that no more food is available)
  • Is the Actor System the parent process of all these threads?
  • Is the Fridge Actor a child of the Person Actor?
  • These questions all came to me when developping an Akka system "for fun", I saw other Stack Overflow threads discussing how Threads relate to Actors but I believe these questions are different


  • Will those messages be processed at the "same time" in differrent threads or will those messages be processed one by one in a queue?- one by one in a queue

  • Is thread spawning completely managed by the library and abstracted from the concept of an Actor? - yes

  • Is an Actor reference an instance of the Actor? - no. Actor can be in another JVM instance.

  • When I stop an Actor (and his children) am I killing threads? (In the case that the Fridge has no more food and notifies the Person Actor that no more food is available) - no

  • Is the Actor System the parent process of all these threads? - no

  • Is the Fridge Actor a child of the Person Actor? - it can be, or can be not, as programmer decided

  • Generally, Akka Actor is a task able to run on a single thread of a thread pool. It is submitted to the execution when there are messages to process, and leaves the thread when there are no more messages.

    链接地址: http://www.djcxy.com/p/21518.html

    上一篇: 演员模型:一名演员需要来自另一名演员的信息

    下一篇: 了解Akka Actor的线程