| name | actor-model-implementer |
| description | Implements actor model for concurrent computation. Use when: (1) Building concurrent systems, (2) Distributed programming, (3) Fault-tolerant systems. |
| version | 1.0.0 |
| tags | ["concurrency","actor-model","distributed","message-passing"] |
| difficulty | intermediate |
| languages | ["python","rust","erlang"] |
| dependencies | [] |
Actor Model Implementer
Implements the actor model for concurrent computation.
When to Use
- Building concurrent/distributed systems
- Implementing fault-tolerant systems
- Modeling reactive systems
- Erlang/Elixir-style concurrency
What This Skill Does
- Creates actors - Independent computational entities
- Handles message passing - Asynchronous communication
- Manages mailboxes - Message queuing
- Implements behaviors - Actor state machines
Usage Example
system = ActorSystem("example")
counter_ref = system.spawn(CounterActor)
counter_ref.tell(10)
counter_ref.tell("get")
def on_reply(count):
print(f"Count is: {count}")
future = counter_ref.ask("get")
print(f"Count: {future.result()}")
ping = system.spawn(PingPongActor)
pong = system.spawn(PingPongActor)
ping.tell("ping", sender=pong)
system.stop()
Key Concepts
| Concept | Description |
|---|
| Actor | Isolated computation with private state |
| Mailbox | Message queue |
| Address | Reference to actor (PID) |
| Message passing | Async, no sharing |
| Behavior | Message handler function |
| Supervision | Fault handling hierarchy |
Actor Patterns
- Fire and forget - Async send
- Request-response - Ask with reply
- Pipeline - Chain actors
- Pub/sub - Topic-based messaging
- Aggregator - Collect results
Tips
- Keep messages immutable
- Avoid blocking in actors
- Use supervision for fault tolerance
- Consider actor per request for isolation
- Monitor mailbox sizes
Related Skills
software-transactional-memory - STM concurrency
race-detection-tool - Detect race conditions
cps-transformer - First-class continuations
Research Tools & Artifacts
Actor model implementations:
| System | Language | What to Learn |
|---|
| Erlang/OTP | Erlang | Original actor model |
| Akka | Scala/Java | Production actors |
| Erlang/Elixir | Elixir | Distributed actors |
| Scala Akka | Scala | Typed actors |
| Pony | Pony | Capabilities-based actors |
Papers
- Hewitt, Bishop, Steiger (1973) - Original actor model paper "A Universal Modular ACTOR Formalism for Artificial Intelligence"
- Agha (1986) - "Actors: A Model of Concurrent Computation in Distributed Systems"
- Armstrong - Erlang design papers
Research Frontiers
1. Type-Safe Actors
- Challenge: Message type safety
- Approach: Typed channels, session types
- Tools: Akka Typed, Pony
2. Distributed Actor Frameworks
- Challenge: Location transparency
- Approach: Remoting, cluster management
Implementation Pitfalls
| Pitfall | Real Consequence | Solution |
|---|
| Blocking | Mailbox buildup | Async operations |
| Shared mutable state | Race conditions | Immutable messages |
| Deadlocks | System halt | Avoid cyclic dependencies |