4. Make classes and functions
Find areas where you can do multiple things at once
Queue work onto a new thread or thread pool
Use synchronization mechanisms to protect shared memory
Finish work on one thread
Consume that work on another
How we write multithreaded code?
4
12. 1973 - Concept formulated by Carl Hewitt et al.: “A universal
modular ACTOR formalism for artificial intelligence”
1986 - Gul Agha, doctoral dissertation "Actors: A Model of
Concurrent Computation in Distributed Systems“
1986 - Joe Armstrong and others in Ericsson - Erlang programming
language and VM.
2009 - initial release of Akka framework (JVM, Scala)
2014.02 - initial release of Akka.NET - Aaron Stannard, Roger
Actor model history
12
13. The Actor Model provides a higher level of abstraction for writing
concurrent and distributed systems.
Actor Model alleviates the developer from having to deal with explicit
locking and thread management, making it easier to write correct
concurrent and parallel systems.
Actor Model defines some general rules for how the system’s
components should behave and interact with each other.
What is an actor model?
13
14. No deadlocks
No shared state
No global mutable state
Fault isolation – “let it crash”
Encapsulation
Actor model benefits
14
15. Akka.NET is a toolkit and runtime for building highly concurrent,
distributed, and fault tolerant event-driven applications on .NET &
Mono.
Akka.NET is a port of the popular Java/Scala framework Akka to
.NET.
What is Akka.NET?
15
16. Everything is an actor!
From OOP to Actor Model paradigm shift
16
17. Actor is a code unit organization
What is actor?
OOP Actor
Behavior
State
Synchronous calls
Behavior
State
Asynchronous messages
17
19. All communication is done via message-passing
All messages are immutable
Sender and recipient are decoupled, asynchronous
Actors are fundamental units of work & concurrency
19
20. Process messages
Contain private state, invisible from the outside and changes it upon
reception of a message
Change behavior between messages (i.e. state machine)
Actors can
20
21. One message processed at a time
Messages processed in FIFO order
“At Most Once” delivery guarantied:
at-most-once delivery
at-least-once delivery
exactly-once delivery
Actors promise
21
30. Thread
Instance of an object/component
Publisher/Subscriber
Singleton or service (e.g. data access layer)
State machine
Load balancer or router
Actor use cases
30