aboutsummaryrefslogtreecommitdiff
path: root/notes/threading_api.txt
blob: f052b408b80d15a745665c1d329b6712e84ab540 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

Safe multi-threading API
========================

It could work by creating a thread pool, and having a different lists/maps(?)
of objects for various types of sharing. Or some central "repository object"
to allocate them.

* Immutable
* Per-thread
    - Mutable
    - Append-only and appearing as one list per thread
    - Append-only and appearing as one single list
* Written by one fixed thread only
* Written under a lock only
* Written under a lock by one fixed thread only
* Read under a lock only
* Read under a lock by one fixed thread only
* Accessed (read/written) under a lock only
    - Non-atomic access
    - Atomic access (maybe it should be an implementation-detail /
      optional optimization)
* Per-thread counters, read at end
* Per-thread counters, and read by one thread
* Per-thread counters, and read periodcally/rarely by one thread
* Limit counters (see "perfbook" below)

See also:
https://mirrors.edge.kernel.org/pub/linux/kernel/people/paulmck/perfbook/perfbook.html