14.8 Thread Groups

► |  | The Racket Reference

1 | Language Model
2 | Notation for Documentation
3 | Syntactic Forms
4 | Datatypes
5 | Structures
6 | Classes and Objects
7 | Units
8 | Contracts
9 | Pattern Matching
10 | Control Flow
11 | Concurrency and Parallelism
12 | Macros
13 | Input and Output
14 | Reflection and Security
15 | Operating System
16 | Memory Management
17 | Unsafe Operations
18 | Running Racket
| Bibliography
| Index

▼ | 14 | Reflection and Security

14.1 | Namespaces
14.2 | Evaluation and Compilation
14.3 | The racket/ load Language
14.4 | Module Names and Loading
14.5 | Impersonators and Chaperones
14.6 | Security Guards
14.7 | Custodians
14.8 | Thread Groups
14.9 | Structure Inspectors
14.10 | Code Inspectors
14.11 | Plumbers
14.12 | Sandboxed Evaluation
14.13 | The racket/ repl Library
14.14 | Linklets and the Core Compiler

On this page:

make-thread-group
thread-group?
current-thread-group

top ← prev up next →

#### 14.8`` Thread Groups

A thread group is a collection of threads and other thread groups that have equal claim to the CPU. By nesting thread groups and by creating certain threads within certain groups, a programmer can control the amount of CPU allocated to a set of threads. Every thread belongs to a thread group, which is determined by the current-thread-group parameter when the thread is created. Thread groups and custodians (see Custodians) are independent.

The root thread group receives all of the CPU that the operating system gives Racket. Every thread or nested group in a particular thread group receives equal allocation of the CPU (a portion of the group’s access), although a thread may relinquish part of its allocation by sleeping or synchronizing with other processes.

> procedure (make-thread-group [group]) → thread-group?
> group : thread-group? = (current-thread-group)

Creates a new thread group that belongs to group.

> procedure (thread-group? v) → boolean?
> v : any/c

Returns #t if v is a thread group value, #f otherwise.

> parameter (current-thread-group) → thread-group?
> (current-thread-group group) → void?
> group : thread-group?

A parameter that determines the thread group for newly created threads.
top ← prev up next →