Skip to content

Commit b86ccd0

Browse files
committed
Ch. 17: pull disconnected material out of 17.01
1 parent d61b736 commit b86ccd0

File tree

2 files changed

+22
-19
lines changed

2 files changed

+22
-19
lines changed

src/ch17-01-tasks.md

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,11 @@
11
## Futures and the Async Syntax
22

3-
As we saw in the previous chapter, threads provide one approach to concurrency,
4-
and they let us solve some of these issues. However, they also have some
5-
tradeoffs. On many operating systems, they use a fair bit of memory for each
6-
thread, and they come with some overhead for starting up and shutting down.
7-
Threads are also only an option when your operating system and hardware support
8-
them! While mainstream desktop and mobile operating systems have all had
9-
threading for many years, many embedded operating systems, like those used on
10-
some microcontrollers, do not.
11-
12-
The async model provides a different—and ultimately complementary—set of
13-
tradeoffs. In
14-
15-
<!-- TODO: the following paragraph is not where it needs to be structurally. -->
16-
17-
In the async model, concurrent operations do not require their own threads.
18-
Instead, they can run on *tasks*. A task is a bit like a thread, but instead of
19-
being managed by the operating system, it is managed by a runtime.
20-
21-
<!-- TODO: connective tissue as it were. -->
3+
<!--
4+
TODO: connective tissue as it were. Also, an open question on whether we want
5+
to use “task” as the primary term here. Futures do not actually *require* a
6+
task primitive to run (and there are runtimes which do *not* use tasks!) so it
7+
might make more sense to find another common, appropriate term for it instead.
8+
-->
229

2310
Like other languages with async, Rust uses the `async` and `await`
2411
keywords—though with some important differences, as we will see. Blocks and

src/ch17-03-vs-threads.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!-- TODO: find the right home for this (maybe nowhere!) -->
2+
3+
As we saw in the previous chapter, threads provide one approach to concurrency,
4+
and they let us solve some of these issues. However, they also have some
5+
tradeoffs. On many operating systems, they use a fair bit of memory for each
6+
thread, and they come with some overhead for starting up and shutting down.
7+
Threads are also only an option when your operating system and hardware support
8+
them! While mainstream desktop and mobile operating systems have all had
9+
threading for many years, many embedded operating systems, like those used on
10+
some microcontrollers, do not.
11+
12+
The async model provides a different—and ultimately complementary—set of
13+
tradeoffs. In the async model, concurrent operations do not require their own
14+
threads. Instead, they can run on *tasks*. A task is a bit like a thread, but
15+
instead of being managed by the operating system, it is managed by code that
16+
lives at the level of libraries.

0 commit comments

Comments
 (0)