J
jeremy
8 minutes
Drivers constantly need to wait: a few microseconds for a chip to settle, a millisecond before retrying, or a callback in one second to check a timeout. The kernel distinguishes busy-waiting, which burns the processor and is the only option in atomic context, from sleeping, which is correct everywhere else, and gives a high-resolution timer for callbacks. Kernel Rust wraps durations in a type with explicit units so microseconds and milliseconds cannot be confused, and the sleep helper picks the right underlying mechanism for the length you asked for. Getting this wrong in C means either a machine that stutters or a chip read before it was ready.