Skip to main content
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.

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 in yazi-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:
  1. Pending - Queued but not yet started
  2. Running - Currently executing
  3. Success - Completed successfully
  4. Failed - Encountered an error
  5. Cleaned - Cleanup completed
Query task state with these methods:

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:
This provides:
  • 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:
Throttling prevents UI flooding when calculating many directories.

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:
Access logs via the tasks UI (press 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 in yazi.toml:

Monitoring Tasks

View active tasks by pressing w (default keybinding):
  • See all running operations
  • Monitor progress in real-time
  • View task logs
  • Cancel running tasks
Tasks are persisted across sessions, so interrupted operations can resume.

See Also