Tagged articles

busy-spin

1 articles · Page 1 of 1

Microsecond‑Level Sleep: Why thread::sleep Misses Its Target and How to Fix It

On Linux, a call to std::thread::sleep(Duration::from_micros(2)) typically pauses for about 60 µs—30× longer than requested—because the API only guarantees a lower bound and adds a default timer_slack of 50 µs; the article explains the kernel path, shows benchmark data, and provides practical ways to shrink the floor to ~10 µs or achieve sub‑µs latency with busy‑spin and full system tuning.

LinuxRustbusy-spin
0 likes · 21 min read
Microsecond‑Level Sleep: Why thread::sleep Misses Its Target and How to Fix It