Yazi is built on a fully asynchronous architecture that maximizes performance through non-blocking I/O and intelligent task scheduling. All I/O operations run asynchronously while CPU-intensive tasks are distributed across multiple threads.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/sxyazi/yazi/llms.txt
Use this file to discover all available pages before exploring further.
Architecture Overview
Yazi’s async task system consists of several key components:- Scheduler - Central task coordinator and queue manager
- Runner - Thread pool executor for parallel task processing
- Ongoing - Active task registry with progress tracking
- Task Types - Specialized handlers for different operation types
Task Types
Yazi supports multiple categories of async tasks:File Operations
- Copy - Async file copying with progress tracking
- Cut/Move - File moving across filesystems
- Link - Symbolic and hard link creation
- Delete/Trash - File deletion with trash bin support
- Upload/Download - Remote file transfers via VFS
Background Tasks
- Preload - Pre-loading file previews and metadata
- Fetch - Running fetcher plugins for custom data
- Size - Calculating directory sizes recursively
- Process - External command execution
Plugin Tasks
- PluginEntry - Micro plugin execution
- Hook - Lifecycle hook handlers
Task Scheduling
The scheduler uses a priority-based queue system implemented inyazi-scheduler/src/scheduler.rs:
Priority Levels
Tasks are scheduled with three priority levels:- HIGH - Critical operations (cancellation hooks)
- NORMAL - Standard user operations (size calculation, processes)
- LOW - Background operations (file copy/move/delete)
Progress Tracking
Every task includes comprehensive progress tracking:Task States
Tasks progress through several states:- Pending - Queued but not yet started
- Running - Currently executing
- Success - Completed successfully
- Failed - Encountered an error
- Cleaned - Cleanup completed
File Operations
Copy Operation
Async file copying with progress tracking:Progress Updates
File operations send real-time progress updates:- Bytes processed - Track data transfer progress
- File count - Number of files processed
- Current file - Which file is being processed
- Speed - Transfer rate calculation
- ETA - Estimated time remaining
Process Execution
Yazi supports three process execution modes:Block Mode
Blocking execution that waits for completion:Background Mode
Non-blocking background execution:Orphan Mode
Detached process that continues after Yazi exits:Preloading System
Yazi preloads file previews before you navigate to them:- Image decoding - Images decode before display
- Code highlighting - Syntax highlighting prepared in advance
- Archive listing - Archive contents scanned ahead
- Video thumbnails - Video frames extracted asynchronously
Size Calculation
Directory size calculation runs asynchronously with throttling:Task Cancellation
Tasks can be cancelled with automatic cleanup:Cancellation Hooks
Certain operations register hooks for cleanup:- Delete/Trash - Notify other instances
- Upload/Download - Close connections, remove partial files
Task Logging
Tasks can log output for debugging:w by default).
Completion Tokens
Async operations return completion tokens for waiting:Performance Benefits
Yazi’s async architecture provides:- Zero blocking - UI never freezes on I/O
- Parallel execution - Multiple operations run simultaneously
- Resource efficiency - Async I/O uses minimal threads
- Responsive UI - Updates stream in real-time
- Smart scheduling - Priority system ensures important tasks run first
Configuration
Task behavior can be configured inyazi.toml:
Monitoring Tasks
View active tasks by pressingw (default keybinding):
- See all running operations
- Monitor progress in real-time
- View task logs
- Cancel running tasks
See Also
- Virtual Filesystem - Remote file operations
- DDS - Cross-instance task coordination
- Why is Yazi Fast? - Architecture deep dive