# The relationship between actor and thread

**URL:** <https://discuss.akka.io/t/the-relationship-between-actor-and-thread/7441>\
**Category:** Akka Libraries\
**Created:** [November 6, 2020, 1:37am UTC](https://discuss.akka.io/t/the-relationship-between-actor-and-thread/7441 "2020-11-06T01:37:39Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![schahaha](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.akka.io/schahaha/32/2130_2.png) [@schahaha](https://discuss.akka.io/u/schahaha)\
**Post date:** [November 6, 2020, 1:37am UTC](https://discuss.akka.io/t/the-relationship-between-actor-and-thread/7441/1 "2020-11-06T01:37:39Z")

</div>

What is the relationship between actor and thread? How does actor achieve high concurrency with thread ?

---

<div class="post-metadata">

**Author:** ![jlprat](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.akka.io/jlprat/32/487_2.png) [@jlprat](https://discuss.akka.io/u/jlprat)\
**Post date:** [November 30, 2020, 2:31pm UTC](https://discuss.akka.io/t/the-relationship-between-actor-and-thread/7441/2 "2020-11-30T14:31:24Z")

</div>

Hi @schahaha,  
Please note this is a bit simplified.

Akka actors run “on top” of a Thread Pool. This means code within the actors will be running on those threads.  
Akka Actors process “one message at a time” so you don’t have to worry about locks. Of course one can run into some concurrency issues if modifying the actor’s internal state in the wrong place.

Regarding how Akka Actors achieve high concurrency, is all due to well tuned code underneath that produces a really low overhead. Why I think you can design highly concurrent systems with Akka Actors is because the Actor Model itself forces you to design and break your architecture in a more concurrent way.

---

<div class="post-metadata">

**Author:** ![ignatius](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.akka.io/ignatius/32/1787_2.png) [@ignatius](https://discuss.akka.io/u/ignatius)\
**Post date:** [December 1, 2020, 10:23am UTC](https://discuss.akka.io/t/the-relationship-between-actor-and-thread/7441/3 "2020-12-01T10:23:48Z")

</div>

It’s the messages that are being processed on threads in parallel, not the actors. So message after message is processed (on each thread), and depending what actor the message belongs to, that’s the actor that will run on that thread at that moment for that message - and then the next, and so forth. So an actor does not belong to a particular thread (unless you configure it to). And since an actor is so lightweight, like a function, this parallel processing of messages is really fast, and the utilization of threads very high.

---

<div class="post-metadata">

**Author:** ![jlprat](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.akka.io/jlprat/32/487_2.png) [@jlprat](https://discuss.akka.io/u/jlprat)\
**Post date:** [December 1, 2020, 11:15am UTC](https://discuss.akka.io/t/the-relationship-between-actor-and-thread/7441/4 "2020-12-01T11:15:06Z")

</div>

Probably I should have written an Actor’s behavior instead of just actor.

---

<div class="post-metadata">

**Author:** ![ignatius](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.akka.io/ignatius/32/1787_2.png) [@ignatius](https://discuss.akka.io/u/ignatius)\
**Post date:** [December 1, 2020, 11:55am UTC](https://discuss.akka.io/t/the-relationship-between-actor-and-thread/7441/5 "2020-12-01T11:55:55Z")

</div>

Sorry, my post wasn’t a correction of your post or anything like that, I was just having a go at answering the question myself

---

<div class="post-metadata">

**Author:** ![jlprat](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.akka.io/jlprat/32/487_2.png) [@jlprat](https://discuss.akka.io/u/jlprat)\
**Post date:** [December 1, 2020, 12:52pm UTC](https://discuss.akka.io/t/the-relationship-between-actor-and-thread/7441/6 "2020-12-01T12:52:00Z")

</div>

No worries!  
I was doubting between answering with a somewhat eagle-eye-view of the thing or one a bit more detailed… I guess OP’s interactions with the Actor Model have been limited until now. Would be good to hear from them if our answers clarified the thing for them
