Skip to content

Commit e163a5d

Browse files
author
Eric Holk
committed
---
yaml --- r: 4930 b: refs/heads/master c: 4d92cb5 h: refs/heads/master v: v3
1 parent 0d5d5ef commit e163a5d

File tree

2 files changed

+24
-63
lines changed

2 files changed

+24
-63
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 880fd788eb04717d7a75bd5bbf0b8f0a692bda53
2+
refs/heads/master: 4d92cb5c63469003903a87574e30308f512314cc

trunk/doc/rust.texi

Lines changed: 23 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1227,15 +1227,6 @@ immediately destructed (if acyclic) or else collected using a general
12271227
(cycle-aware) garbage-collector local to each task. Garbage collection within
12281228
a local heap does not interrupt execution of other tasks.
12291229

1230-
Immutable boxes are @dfn{shared}, and can be multiply-referenced by many
1231-
different tasks. Like any other immutable type, they can pass over channels,
1232-
and live as long as the last task referencing them within a given domain. When
1233-
unreferenced, they are destroyed immediately (due to reference-counting) and
1234-
returned to the heap memory allocator. Destruction of an immutable box also
1235-
executes within the context of the task that drops the last reference to a
1236-
shared heap allocation, so executing a long-running destructor does not
1237-
interrupt execution of other tasks.
1238-
12391230

12401231
@node Ref.Mem.Own
12411232
@subsection Ref.Mem.Own
@@ -1371,25 +1362,23 @@ fn main() @{
13711362
@node Ref.Mem.Acct
13721363
@subsection Ref.Mem.Acct
13731364
@c * Ref.Mem.Acct:: Memory accounting model.
1374-
@cindex Domain
13751365
@cindex Accounting
13761366
@cindex Memory budget
13771367

1378-
Every task belongs to a domain, and that domain tracks the amount of memory
1379-
allocated and not yet released by tasks within it. @xref{Ref.Task.Dom}. Each
1380-
domain has a memory budget. The @dfn{budget} of a domain is the maximum amount
1381-
of memory that can be simultaneously allocated in the domain. If a task tries
1382-
to allocate memory within a domain with an exceeded budget, the task will
1383-
receive a signal.
1368+
Every task tracks the amount of memory allocated and not yet released. Each
1369+
task may have a memory budget. The @dfn{budget} of a task is the maximum
1370+
amount of memory that can be simultaneously allocated in the task. If a task
1371+
tries to allocate memory with an exceeded budget, the task will receive a
1372+
signal.
13841373

13851374
Within a task, accounting is strictly enforced: all memory allocated through
1386-
the runtime library, both user data, sub-domains and runtime-support
1387-
structures such as channel and signal queues, are charged to a task's domain.
1375+
the runtime library, both user data and runtime-support structures such as
1376+
channel and signal queues, are charged to a task.
13881377

1389-
When a communication channel crosses from one domain to another, any value
1378+
When a communication channel crosses from one task to another, any value
13901379
sent over the channel is guaranteed to have been @emph{detached} from the
1391-
domain's memory graph (singly referenced, and/or deep-copied), so its memory
1392-
cost is transferred to the receiving domain.
1380+
task's memory graph (singly referenced, and/or deep-copied), so its memory
1381+
cost is transferred to the receiving task.
13931382

13941383

13951384
@page
@@ -1414,7 +1403,6 @@ operating-system processes.
14141403
@menu
14151404
* Ref.Task.Comm:: Inter-task communication.
14161405
* Ref.Task.Life:: Task lifecycle and state transitions.
1417-
* Ref.Task.Dom:: Task domains.
14181406
* Ref.Task.Sched:: Task scheduling model.
14191407
* Ref.Task.Spawn:: Library interface for making new tasks.
14201408
* Ref.Task.Send:: Library interface for sending messages.
@@ -1467,12 +1455,12 @@ transmit side. A channel contains a message queue and asynchronously sending a
14671455
message merely inserts it into the sending channel's queue; message receipt is
14681456
the responsibility of the receiving task.
14691457

1470-
Queued messages in channels are charged to the domain of the @emph{sending}
1471-
task. If too many messages are queued for transmission from a single sending
1472-
task, without being received by a receiving task, the sending task may exceed
1473-
its memory budget, which causes a run-time signal. To help control this
1474-
possibility, a semi-synchronous send operation is possible, which blocks until
1475-
there is room in the existing queue before sending send.
1458+
Queued messages in channels are charged to the @emph{sending} task. If too
1459+
many messages are queued for transmission from a single sending task, without
1460+
being received by a receiving task, the sending task may exceed its memory
1461+
budget, which causes a run-time signal. To help control this possibility, a
1462+
semi-synchronous send operation is possible, which blocks until there is room
1463+
in the existing queue before sending send.
14761464

14771465
Messages are sent on channels and received on ports using standard library
14781466
functions.
@@ -1535,31 +1523,6 @@ A task in the @emph{dead} state cannot transition to other states; it exists
15351523
only to have its termination status inspected by other tasks, and/or to await
15361524
reclamation when the last reference to it drops.
15371525

1538-
@node Ref.Task.Dom
1539-
@subsection Ref.Task.Dom
1540-
@c * Ref.Task.Dom:: Task domains
1541-
1542-
@cindex Domain
1543-
@cindex Process
1544-
@cindex Thread
1545-
1546-
Every task belongs to a domain. A @dfn{domain} is a structure that owns tasks,
1547-
schedules tasks, tracks memory allocation within tasks and manages access to
1548-
runtime services on behalf of tasks.
1549-
1550-
Typically each domain runs on a separate operating-system @emph{thread}, or
1551-
within an isolated operating-system @emph{process}. An easy way to think of a
1552-
domain is as an abstraction over either an operating-system thread @emph{or} a
1553-
process.
1554-
1555-
The key feature of a domain is that it isolates memory references created by
1556-
the Rust tasks within it. No Rust task can refer directly to memory outside
1557-
its domain.
1558-
1559-
Tasks can own sub-domains, which in turn own their own tasks. Every domain
1560-
owns one @emph{root task}, which is the root of the tree of tasks owned by the
1561-
domain.
1562-
15631526
@node Ref.Task.Sched
15641527
@subsection Ref.Task.Sched
15651528
@c * Ref.Task.Sched:: Task scheduling model.
@@ -1568,11 +1531,9 @@ domain.
15681531
@cindex Preemption
15691532
@cindex Yielding control
15701533

1571-
Every task is @emph{scheduled} within its domain. @xref{Ref.Task.Dom}. The
1572-
currently scheduled task is given a finite @emph{time slice} in which to
1534+
The currently scheduled task is given a finite @emph{time slice} in which to
15731535
execute, after which it is @emph{descheduled} at a loop-edge or similar
1574-
preemption point, and another task within the domain is scheduled,
1575-
pseudo-randomly.
1536+
preemption point, and another task within is scheduled, pseudo-randomly.
15761537

15771538
An executing task can @code{yield} control at any time, which deschedules it
15781539
immediately. Entering any other non-executing state (blocked, dead) similarly
@@ -1591,7 +1552,7 @@ function. The passed function is referred to as the @dfn{entry function} for
15911552
the spawned task, and any captured environment is carries is moved from the
15921553
spawning task to the spawned task before the spawned task begins execution.
15931554

1594-
The result of a @code{spawn} call is a @code{std::task::task_id} value.
1555+
The result of a @code{spawn} call is a @code{std::task::task} value.
15951556

15961557
An example of a @code{spawn} call:
15971558
@example
@@ -1606,10 +1567,10 @@ fn helper(c: chan<u8>) @{
16061567
16071568
let p: port<u8>;
16081569
1609-
spawn(bind helper(p.mk_chan()));
1570+
spawn(bind helper(chan(p)));
16101571
// let task run, do other things.
16111572
// ...
1612-
let result = p.recv();
1573+
let result = recv(p);
16131574
16141575
@end example
16151576

@@ -1649,7 +1610,7 @@ An example of a @emph{receive}:
16491610
@example
16501611
import std::comm::*;
16511612
let p: port<str> = @dots{};
1652-
let s: str = p.recv();
1613+
let s: str = recv(p);
16531614
@end example
16541615

16551616

@@ -3699,7 +3660,7 @@ signal queue associated with each task. Sending a signal to a task inserts the
36993660
signal into the task's signal queue and marks the task as having a pending
37003661
signal. At the next scheduling opportunity, the runtime processes signals in
37013662
the task's queue using its dispatch table. The signal queue memory is charged
3702-
to the task's domain; if the queue grows too big, the task will fail.
3663+
to the task; if the queue grows too big, the task will fail.
37033664

37043665
@c ############################################################
37053666
@c end main body of nodes

0 commit comments

Comments
 (0)