introduction to actor model of concurrent and distributed
TRANSCRIPT
![Page 1: Introduction to actor model of concurrent and distributed](https://reader033.vdocuments.net/reader033/viewer/2022042607/55a645751a28abed148b4666/html5/thumbnails/1.jpg)
Introduction to Actor Model of Concurrent and Distributed Computation
Dmitry Tolpeko, EPAM Systems - January 2015
![Page 2: Introduction to actor model of concurrent and distributed](https://reader033.vdocuments.net/reader033/viewer/2022042607/55a645751a28abed148b4666/html5/thumbnails/2.jpg)
What is Actor Model?
Design pattern to develop scalable concurrent and distributed applications
![Page 3: Introduction to actor model of concurrent and distributed](https://reader033.vdocuments.net/reader033/viewer/2022042607/55a645751a28abed148b4666/html5/thumbnails/3.jpg)
Concurrent Models
• Shared Resources
• Actor-based Concurrency
![Page 4: Introduction to actor model of concurrent and distributed](https://reader033.vdocuments.net/reader033/viewer/2022042607/55a645751a28abed148b4666/html5/thumbnails/4.jpg)
Shared Resources
• Shared Memory
• Locks
![Page 5: Introduction to actor model of concurrent and distributed](https://reader033.vdocuments.net/reader033/viewer/2022042607/55a645751a28abed148b4666/html5/thumbnails/5.jpg)
Shared Resources - Advantages
• Traditional and well known
• OS and programming language support
• Relatively easy to program (no queues, no messaging i.e.)
![Page 6: Introduction to actor model of concurrent and distributed](https://reader033.vdocuments.net/reader033/viewer/2022042607/55a645751a28abed148b4666/html5/thumbnails/6.jpg)
Shared Resources - Disadvantages
• Error prone and buggy
• Race conditions and deadlocks
• Over-synchronization that can impact performance
• No distributed processing
![Page 7: Introduction to actor model of concurrent and distributed](https://reader033.vdocuments.net/reader033/viewer/2022042607/55a645751a28abed148b4666/html5/thumbnails/7.jpg)
Actor Model
• Similar to Object-oriented model but asynchronous, concurrent and distributed
• Actors are processes (threads) that process and send messages
• Shared nothing architecture
![Page 8: Introduction to actor model of concurrent and distributed](https://reader033.vdocuments.net/reader033/viewer/2022042607/55a645751a28abed148b4666/html5/thumbnails/8.jpg)
Asynchronous
• When an Actor sends a message it is not blocked until the message processed
• Actor is not interrupted when it receives a message
• Every Actor has Mailbox, a task queue to buffer incoming messages
![Page 9: Introduction to actor model of concurrent and distributed](https://reader033.vdocuments.net/reader033/viewer/2022042607/55a645751a28abed148b4666/html5/thumbnails/9.jpg)
Concurrent and Distributed
• Each Actor runs an infinite loop to read, process and send messages
• Use of messaging allows distributed processing (Multiple Actors running on multiple nodes)
![Page 10: Introduction to actor model of concurrent and distributed](https://reader033.vdocuments.net/reader033/viewer/2022042607/55a645751a28abed148b4666/html5/thumbnails/10.jpg)
Topology and Life Cycle
• Actors can create other actors, the topology is dynamic
• Actor usually terminates by receiving the application specific “Stop” message
• Actor can also terminate by timeout (no messages in queue) or after completing a message
![Page 11: Introduction to actor model of concurrent and distributed](https://reader033.vdocuments.net/reader033/viewer/2022042607/55a645751a28abed148b4666/html5/thumbnails/11.jpg)
Advantages of Actor Model
• Scalable
• Clear and reliable design
![Page 12: Introduction to actor model of concurrent and distributed](https://reader033.vdocuments.net/reader033/viewer/2022042607/55a645751a28abed148b4666/html5/thumbnails/12.jpg)
Thank [email protected]
https://twitter.com/dmtolpeko
www.dmtolpeko.com
Join Belarus Hadoop User Group at LinkedIn