Skip to main content

Crate Echo

Crate Echo 

Source
Expand description

§Echo: Work-Stealing Task Scheduler

Echo keeps every CPU core busy. It uses a lock-free work-stealing queue (crossbeam-deque) so that idle threads automatically pick up tasks from busy ones. No central bottleneck, no wasted cores.

§Why Echo Instead of tokio::spawn

Tokio is great for I/O-bound work, but CPU-bound tasks (parsing, diffing, indexing) block the executor. Echo provides:

  • Priority levels: UI-blocking tasks pre-empt background indexing
  • Work stealing: Idle workers take from busy workers’ queues
  • Structured shutdown: Graceful drain with timeout

§Usage

use Echo::Scheduler::SchedulerBuilder;
use Echo::Task::Priority;

let Scheduler = SchedulerBuilder::new().Workers(4).Build();
Scheduler.Submit(Priority::High, async { /* critical work */ });
Scheduler.Submit(Priority::Low, async { /* background indexing */ });

§Modules

  • Scheduler: Builder and runtime for the worker pool
  • Queue: Lock-free work-stealing deque wrapper
  • Task: Task definition with priority levels

Modules§

Queue
Queue Module
Scheduler
Scheduler Module
Task
Task Module