Actor Flashcards

1
Q

What is an Actor in the Actor Model?

A

An independent computational unit with:

Private state (never shared)

A mailbox (for receiving messages)

Behavior (how it processes messages)

Key Idea: Actors communicate only via asynchronous messages.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are the 3 core rules of the Actor Model?

A

No shared state (actors encapsulate data)

Message-passing only (no direct method calls)

Process one message at a time (no locks needed)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How do Actors communicate?

A

By sending immutable messages asynchronously.

Messages are stored in the receiver’s mailbox (queue).

Each actor processes messages sequentially.

Example (Pseudocode):

python
actor ! {“type”: “greet”, “text”: “Hello”} # Send message

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Why use Actors for concurrency?

A

No locks: Each actor runs independently.

Scalability: Distributed across threads/machines.

Fault tolerance: Isolated failures (like Erlang’s “let it crash”).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How do Actors differ from OOP objects?

A

Actors OOP Objects
Communicate via messages Call methods directly
No shared state Shared state possible
Async by default Often sync/blocking

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How do Actors handle failures?

A

Supervision hierarchies: Parent actors monitor children.

Strategies: Restart, resume, or escalate failures.

Isolation: One actor crashing doesn’t break others.

Example: Erlang’s “let it crash” philosophy.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is location transparency in Actors?

A

Actors can communicate the same way whether they’re:

On the same thread

On different machines
(No code changes needed!)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Name 3 Actor Model frameworks/languages.

A

Erlang/Elixir (built-in Actors)

Akka (JVM, Scala/Java)

Orleans (.NET)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

When should you use the Actor Model?

A

High concurrency (e.g., chat servers)

Distributed systems (e.g., microservices)

Fault-tolerant systems (e.g., telecoms)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What are limitations of the Actor Model?

A

Debugging complexity (async flows)

Message overhead (serialization costs)

No guaranteed delivery (unless built explicitly)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What are the key lifecycle stages of an Actor?

A

Created

Running (processing messages)

Paused (waiting)

Terminated

How well did you know this?
1
Not at all
2
3
4
5
Perfectly