Skip to main content

Actor Over Mutex

For terminal state management, the Actor pattern eliminates the race conditions that Mutex can only mitigate.

The Problem: Concurrent State Access


Solution A: Mutex (Traditional)

Problems with Mutex for Terminal


Solution B: Actor Pattern (MonoTerm)

Why Actor Wins for Terminal


Side-by-Side Comparison

Scenario: PTY outputs 100 lines while user resizes window

Comparison Table


Pattern History

The Actor pattern is not Rust-specific. It has a 50+ year track record.

SessionActor in MonoTerm

The SessionActor owns all terminal state. No locks needed.

Summary