From 08399f2cd1b6077a358d39f97479420dbc71dc81 Mon Sep 17 00:00:00 2001 From: Aananth V Date: Wed, 11 Dec 2024 14:26:55 +0530 Subject: [PATCH] Update concurrency.md The sentence doesn't seem gramatically correct in its current form "Even where IO happens", One of the following can be used in place of "Even where" to make it flow better: "Everywhere", "When", "Whenever", "Where", "Wherever". I've replaced it with "Whenever" --- src/part-guide/concurrency.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/part-guide/concurrency.md b/src/part-guide/concurrency.md index 6d6aa85d..4b89731b 100644 --- a/src/part-guide/concurrency.md +++ b/src/part-guide/concurrency.md @@ -22,7 +22,7 @@ do_another_thing(); Each statement is completed before the next one starts[^obs1]. Nothing happens in between those statements[^obs2]. This might sound trivial but it is a really useful property for reasoning about our code. However, it also means we waste a lot of time. In the above example, while we're waiting for `println!("hello!")` to happen, we could have executed `do_another_thing()`. Perhaps we could even have executed all three statements at the same time. -Even where IO[^io-def] happens (printing using `println!` is IO - it is outputting text to the console via a call to the OS), the program will wait for the IO to complete[^io-complete] before executing the next statement. Waiting for IO to complete before continuing with execution *blocks* the program from making other progress. Blocking IO is the easiest kind of IO to use, implement, and reason about, but it is also the least efficient - in a sequential world, the program can do nothing while it waits for the IO to complete. +Whenever IO[^io-def] happens (printing using `println!` is IO - it is outputting text to the console via a call to the OS), the program will wait for the IO to complete[^io-complete] before executing the next statement. Waiting for IO to complete before continuing with execution *blocks* the program from making other progress. Blocking IO is the easiest kind of IO to use, implement, and reason about, but it is also the least efficient - in a sequential world, the program can do nothing while it waits for the IO to complete. [^obs1]: This isn't really true: modern compilers and CPUs will reorganize your code and run it any order they like. Sequential statements are likely to overlap in many different ways. However, this should never be *observable* to the program itself or its users. [^obs2]: This isn't true either: even when one program is purely sequential, other programs might be running at the same time; more on this in the next section.