Skip to content

Commit 6f60db3

Browse files
committed
---
yaml --- r: 155358 b: refs/heads/try2 c: 6672760 h: refs/heads/master v: v3
1 parent 5644f4b commit 6f60db3

File tree

2 files changed

+12
-49
lines changed

2 files changed

+12
-49
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: fdd511d124523707b20227a7497aced1540add7e
8+
refs/heads/try2: 667276040feda6db6b4515ae7e82d7f4e1309f30
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/doc/reference.md

Lines changed: 11 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -4041,47 +4041,20 @@ let y = x;
40414041
An executing Rust program consists of a tree of tasks. A Rust _task_ consists
40424042
of an entry function, a stack, a set of outgoing communication channels and
40434043
incoming communication ports, and ownership of some portion of the heap of a
4044-
single operating-system process. (We expect that many programs will not use
4045-
channels and ports directly, but will instead use higher-level abstractions
4046-
provided in standard libraries, such as pipes.)
4047-
4048-
Multiple Rust tasks may coexist in a single operating-system process. The
4049-
runtime scheduler maps tasks to a certain number of operating-system threads.
4050-
By default, the scheduler chooses the number of threads based on the number of
4051-
concurrent physical CPUs detected at startup. It's also possible to override
4052-
this choice at runtime. When the number of tasks exceeds the number of threads
4053-
— which is likely — the scheduler multiplexes the tasks onto
4054-
threads.[^mnscheduler]
4055-
4056-
[^mnscheduler]: This is an M:N scheduler, which is known to give suboptimal
4057-
results for CPU-bound concurrency problems. In such cases, running with the
4058-
same number of threads and tasks can yield better results. Rust has M:N
4059-
scheduling in order to support very large numbers of tasks in contexts where
4060-
threads are too resource-intensive to use in large number. The cost of
4061-
threads varies substantially per operating system, and is sometimes quite
4062-
low, so this flexibility is not always worth exploiting.
4044+
single operating-system process.
40634045

40644046
### Communication between tasks
40654047

4066-
Rust tasks are isolated and generally unable to interfere with one another's memory directly,
4067-
except through [`unsafe` code](#unsafe-functions).
4068-
All contact between tasks is mediated by safe forms of ownership transfer,
4069-
and data races on memory are prohibited by the type system.
4070-
4071-
Inter-task communication and co-ordination facilities are provided in the
4072-
standard library. These include:
4073-
4074-
- synchronous and asynchronous communication channels with various
4075-
communication topologies
4076-
- read-only and read-write shared variables with various safe mutual exclusion
4077-
patterns
4078-
- simple locks and semaphores
4079-
4080-
When such facilities carry values, the values are restricted to the [`Send`
4081-
type-kind](#type-kinds). Restricting communication interfaces to this kind
4082-
ensures that no references or managed pointers move between tasks. Thus access
4083-
to an entire data structure can be mediated through its owning "root" value; no
4084-
further locking or copying is required to avoid data races within the
4048+
Rust tasks are isolated and generally unable to interfere with one another's
4049+
memory directly, except through [`unsafe` code](#unsafe-functions). All
4050+
contact between tasks is mediated by safe forms of ownership transfer, and data
4051+
races on memory are prohibited by the type system.
4052+
4053+
When you wish to send data between tasks, the values are restricted to the
4054+
[`Send` type-kind](#type-kinds). Restricting communication interfaces to this
4055+
kind ensures that no references or managed pointers move between tasks. Thus
4056+
access to an entire data structure can be mediated through its owning "root"
4057+
value; no further locking or copying is required to avoid data races within the
40854058
substructure of such a value.
40864059

40874060
### Task lifecycle
@@ -4123,16 +4096,6 @@ A task in the *dead* state cannot transition to other states; it exists only to
41234096
have its termination status inspected by other tasks, and/or to await
41244097
reclamation when the last reference to it drops.
41254098

4126-
### Task scheduling
4127-
4128-
The currently scheduled task is given a finite *time slice* in which to
4129-
execute, after which it is *descheduled* at a loop-edge or similar preemption
4130-
point, and another task within is scheduled, pseudo-randomly.
4131-
4132-
An executing task can yield control at any time, by making a library call to
4133-
`std::task::yield`, which deschedules it immediately. Entering any other
4134-
non-executing state (blocked, dead) similarly deschedules the task.
4135-
41364099
# Runtime services, linkage and debugging
41374100

41384101
The Rust _runtime_ is a relatively compact collection of C++ and Rust code that

0 commit comments

Comments
 (0)