Quickstart Guide
This guide will help you run your first synchronization simulation and understand the basic controls.Opening the Simulator
The simulator is a static HTML application that runs entirely in your browser.Running Your First Simulation
Let’s walk through a complete simulation using the Mutex algorithm with the bank account scenario.Configure the scenario
You’ll see two input fields:
- Thread count: Number of clients accessing the account (default: 3)
- Initial balance: Starting account balance (default: $1000)
Configure operations
After generating, you’ll see operation rows for each client. Each client can either:Configure your operations, then proceed to execution.
- Withdraw money (removes from balance)
- Deposit money (adds to balance)
Execute step-by-step
Click the Step button to execute one instruction at a time.Watch what happens:
- One thread enters the critical section (acquires mutex)
- Other threads block and wait in the queue
- The active thread modifies the balance
- The mutex transfers to the next waiting thread
Understanding the Display
State Panel
The state panel shows the current system state:Current Balance
Real-time account balance as threads withdraw and deposit
Mutex Owner
Shows which thread currently holds the lock, or “Libre” (Free) if unlocked
Mutex Queue
Visual representation of threads waiting to acquire the mutex, displayed in FIFO order.Thread Cards
Each client has a card showing:- Thread name and current state indicator
- Balance bar (visual representation of transaction amount)
- Operation type (Withdraw/Deposit) and amount
- State badge: Running (blue), Blocked (yellow), Finished (gray), Ready (green)
Timeline
The timeline shows a chronological log of all events:What Just Happened?
Let’s break down the execution you just witnessed:Critical Section Protection
Critical Section Protection
The mutex ensures that only one thread can access the shared
account.balance at a time. This prevents race conditions where simultaneous withdrawals could corrupt the balance.FIFO Queue
FIFO Queue
When multiple threads try to acquire a locked mutex, they wait in a First-In-First-Out queue. This guarantees fairness - no thread waits forever.
Direct Ownership Transfer
Direct Ownership Transfer
When a thread releases the mutex, ownership transfers directly to the next waiting thread. The mutex never becomes “free” if threads are waiting, improving efficiency.
Atomic Operations
Atomic Operations
Each WITHDRAW or DEPOSIT operation completes atomically inside the critical section. No other thread can observe a partial state change.
The Instruction Sequence
Behind the scenes, each client thread executes these instructions:- ACQUIRE: Thread attempts to lock the mutex
- If free: Lock acquired, thread enters critical section
- If locked: Thread blocks and joins the queue
- WITHDRAW/DEPOSIT: Thread modifies shared balance
- This only happens after acquiring the mutex
- Operation is atomic and isolated from other threads
- RELEASE: Thread unlocks the mutex
- If queue is empty: Mutex becomes free
- If threads are waiting: Direct transfer to next in queue
Try Other Algorithms
Now that you understand the basics, explore the other synchronization primitives:Semaphores
Control access to a limited pool of resources (printers)
Condition Variables
Wait efficiently for events (restaurant food service)
Monitors
High-level readers-writer coordination (library catalog)
Barriers
Synchronize at checkpoints (race coordination)
Join/Await
Wait for task dependencies (house construction)
Peterson's Algorithm
Two-thread mutual exclusion without hardware (robots sharing station)
Next Steps
Architecture
Learn how the simulator works internally
Core Concepts
Understand threads, instructions, and execution
API Reference
Explore the technical API documentation