async-rs / async-rs/async-std

[ASK] what is the purpose of sleep?

Open
#743 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
4.1k
Forks
339
PR merge metrics
No merged PRs in 30d

Description

Hi, I'm trying to understand how the runtime works,
can anyone explain to me what is the purpose of sleep 10 ms in
https://github.com/async-rs/async-std/blob/fc4e4725992b1b147a4a286cea5d094c5263b951/src/rt/runtime.rs#L247-L250
and
https://github.com/async-rs/async-std/blob/fc4e4725992b1b147a4a286cea5d094c5263b951/src/rt/runtime.rs#L263-L266

why not just blocking on reactor instead of blocking on sleep,
does that mean that short blocking on sleep is more efficient than short blocking on reactor? like, we let the reactor to capture multiple io event, analogous to buffering when reading data, instead of byte by byte, we go block by block

Contributor guide

Open the contributing guide

Research direction

Read src/rt/runtime.rs at lines 247-250 and 263-266, then trace the referenced reactor and sleep entry points. Compare what each wait does and document the purpose of the 10 ms sleeps, including why the runtime uses them instead of blocking directly on the reactor.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
operating-systems
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.