Skip to content

Commit

Permalink
Update src/part-guide/adv-async-await.md
Browse files Browse the repository at this point in the history
Co-authored-by: Travis Cross <[email protected]>
  • Loading branch information
nrc and traviscross authored Nov 18, 2024
1 parent 4e93809 commit ea7271e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/part-guide/adv-async-await.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Blocking and cancellation are important to keep in mind when programming with as

We say a thread (note we're talking about OS threads here, not async tasks) is blocked when it can't make any progress. That's usually because it is waiting for the OS to complete a task on its behalf (usually I/O). Importantly, while a thread is blocked, the OS knows not to schedule it so that other threads can make progress. This is fine in a multithreaded program because it lets other threads make progress while the blocked thread is waiting. However, in an async program, there are other tasks which should be scheduled on the same OS thread, but the OS doesn't know about those and keeps the whole thread waiting. This means that rather than the single task waiting for its I/O to complete (which is fine), many tasks have to wait (which is not fine).

We'll talk soon about non-blocking/async IO. For now, just know that non-blocking IO is IO which the async runtime knows about and so will only block the task which is waiting for it, not the whole thread. It is very important to only use non-blocking IO from an async task, never blocking IO (which is the only kind provided in Rust's standard library).
We'll talk soon about non-blocking/async I/O. For now, just know that non-blocking I/O is I/O which the async runtime knows about and so will only block the task which is waiting for it, not the whole thread. It is very important to only use non-blocking I/O from an async task, never blocking I/O (which is the only kind provided in Rust's standard library).

### Blocking computation

Expand Down

0 comments on commit ea7271e

Please sign in to comment.