Skip to content

Commit 8cc5949

Browse files
committed
Add custom index page for the package and restructure the intro
1 parent da4ea6f commit 8cc5949

File tree

4 files changed

+215
-153
lines changed

4 files changed

+215
-153
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,5 +79,5 @@ to
7979
i.e. to make them usable on other Picos-compatible schedulers.
8080

8181
Please read
82-
[the introduction section of the reference manual](https://ocaml-multicore.github.io/picos/doc/picos/Picos/index.html)
82+
[the reference manual](https://ocaml-multicore.github.io/picos/doc/picos/index.html)
8383
for further information.

lib/dune

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
(documentation)

lib/index.mld

Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
{0 Picos — Interoperable effects based concurrency}
2+
3+
{1 Introduction}
4+
5+
Picos, or {{:https://en.wikipedia.org/wiki/Metric_prefix} pico}-scheduler
6+
framework, is a framework for building
7+
{{:https://en.wikipedia.org/wiki/Interoperability} interoperable} elements of
8+
{{:https://v2.ocaml.org/manual/effects.html} effects based}
9+
{{:https://en.wikipedia.org/wiki/Cooperative_multitasking} cooperative}
10+
{{:https://en.wikipedia.org/wiki/Concurrent_computing} concurrent programming
11+
models} such as
12+
13+
- {{:https://en.wikipedia.org/wiki/Scheduling_(computing)} schedulers} that
14+
multiplex large numbers of {{:https://en.wikipedia.org/wiki/Green_thread} user
15+
level fibers} to run on a small number of system level threads,
16+
- mechanisms for managing fibers and for
17+
{{:https://en.wikipedia.org/wiki/Structured_concurrency} structuring
18+
concurrency},
19+
- communication and synchronization primitives, such as
20+
{{:https://en.wikipedia.org/wiki/Monitor_(synchronization)} mutexes and
21+
condition variables}, message queues,
22+
{{:https://en.wikipedia.org/wiki/Software_transactional_memory} STMs}, and
23+
more, and
24+
- integration with low level {{:https://en.wikipedia.org/wiki/Asynchronous_I/O}
25+
asynchronous IO} systems.
26+
27+
If you are the author of an application level concurrent programming library or
28+
framework, then Picos should not fundamentally be competing with your work.
29+
However, Picos and libraries built on top of Picos probably do have overlap with
30+
your work and making your work Picos compatible may offer benefits:
31+
32+
- You may find it useful that the {{!Picos} core} of Picos provides parallelism
33+
safe building blocks for cancelation, which is a particularly tricky problem
34+
to get right.
35+
- You may find it useful that you don't have to reinvent many of the
36+
{{!Picos_sync} basic communication and synchronization abstractions} such as
37+
mutexes and condition variables, promises, concurrent bounded queues,
38+
channels, and what not.
39+
- You may benefit from further non-trivial libraries, such as {{!Picos_stdio} IO
40+
libraries}, that you don't have to reimplement.
41+
- Potential users of your work may be reassured and benefit from the ability to
42+
mix-and-match your work with other Picos compatible libraries and frameworks.
43+
44+
Of course, interoperability does have some costs. It takes time to understand
45+
Picos and it takes time to implement Picos compatibility. Implementing your
46+
programming model elements in terms of Picos primitives may not give ideal
47+
results. To address concerns such as those, a conscious effort has been made to
48+
keep Picos as minimal and unopinionated as possible.
49+
50+
{2 Interoperability}
51+
52+
Picos is essentially an interface between schedulers and other elements. Two
53+
phrases are used to describe the opposing sides of this contract.
54+
55+
{3 Picos compatible}
56+
57+
The idea is that schedulers provide their own handlers for the Picos effects.
58+
By handling the Picos effects a scheduler allows any libraries built on top of
59+
the Picos concepts to be used with the scheduler. Such a scheduler is then said
60+
to be {i Picos compatible}.
61+
62+
{3 Implemented in Picos}
63+
64+
A scheduler is just one element of a concurrent programming model. Separately
65+
from making a scheduler Picos compatible, one may choose to implement other
66+
elements of the programming model, e.g. a particular approach to structuring
67+
concurrency or a particular collection of communication and synchronization
68+
primitives, in terms of the Picos concepts. Such scheduler agnostic elements
69+
can then be used on any Picos compatible scheduler and are said to be {i
70+
Implemented in Picos}.
71+
72+
{2 Design goals and principles}
73+
74+
The {{!Picos} core} of Picos is designed and developed with various goals and
75+
principles in mind.
76+
77+
- {b Simple}: Picos should be kept as simple as possible.
78+
- {b Minimal}: Picos should be kept minimal. The dependency footprint should be
79+
as small as possible. Convenience features should be built on top of the
80+
framework.
81+
- {b Safe}: Picos should be designed with safety in mind. The implementation
82+
must be data race free. The framework should promote and always allow proper
83+
resource management.
84+
- {b Unopinionated}: Picos should not make strong design choices that are
85+
controversial.
86+
- {b Flexible}: Picos should allow higher level libraries as much freedom as
87+
possible to make their own design choices.
88+
89+
The documentation of the {{!Picos} concepts} includes design rationale for some
90+
of the specific ideas behind their detailed design.
91+
92+
{3 Constraints Liberate, Liberties Constrain}
93+
94+
Picos aims to be unopinionated and flexible enough to allow higher level
95+
libraries to provide many different kinds of concurrent programming models.
96+
While it is impossible to give a complete list of what Picos does not dictate,
97+
it is perhaps illuminating to explicitly mention some of those:
98+
99+
- Picos does not implement
100+
{{:https://en.wikipedia.org/wiki/Capability-based_security} capability-based
101+
security}. Higher level libraries with or without capabilities may be built
102+
on top of Picos.
103+
- Picos never cancels computations implicitly. Higher level libraries may
104+
decide when cancelation should be allowed to take effect.
105+
- Picos does not dictate which fiber should be scheduled next after a Picos
106+
effect. Different schedulers may freely use desired data structures (queues,
107+
work-stealing deques, stacks, priority queues, ...) and, after handling any
108+
Picos effect, freely decide which fiber to run next.
109+
- Picos does not dictate how fibers should be managed. It is possible to
110+
implement both unstructured and structured concurrent programming models on
111+
top of Picos.
112+
- Picos does not dictate which mechanisms applications should use for
113+
communication and synchronization. It is possible to build many different
114+
kinds of communication and synchronization mechanisms on top of Picos
115+
including mutexes and condition variables, STMs, asynchronous and synchronous
116+
message passing, {{:https://en.wikipedia.org/wiki/Actor_model} actors}, and
117+
more.
118+
- Picos does not dictate that there should be a connection between the scheduler
119+
and other elements of the concurrent programming model. It is possible to
120+
provide those separately and mix-and-match.
121+
- Picos does not dictate which library to use for IO. It is possible to build
122+
direct-style asynchronous IO libraries on top of Picos that can then be used
123+
with any Picos compatible schedulers or concurrent programming models.
124+
125+
Let's build an incredible ecosystem of interoperable concurrent programming
126+
libraries and frameworks!
127+
128+
{1 Libraries}
129+
130+
The Picos package is divided into multiple libraries.
131+
132+
{2 Core}
133+
134+
The only essential part of the package is the core framework.
135+
136+
- {!modules: Picos}
137+
138+
{^ Everything else is entirely opt-in and you are free to mix-and-match with any
139+
other Picos compatible schedulers and libraries implemented in Picos or
140+
develop your own.}
141+
142+
{2 Sample schedulers}
143+
144+
These are minimalistic, but fully-functioning, schedulers provided as samples.
145+
146+
- {!modules: Picos_fifos}
147+
- {!modules: Picos_threaded}
148+
149+
{^ You may find these useful for both understanding the core Picos framework and
150+
for testing your own libraries implemented in Picos.}
151+
152+
{2 Scheduler agnostic libraries}
153+
154+
These are examples of libraries implemented in Picos.
155+
156+
- {!modules: Picos_sync}
157+
- {!modules: Picos_stdio}
158+
- {!modules: Picos_select}
159+
160+
{^ The IO libraries in this package are built only on top of the standard
161+
libraries distributed with OCaml and are hopefully useful for building simple
162+
applications. Bindings to asynchronous system IO libraries are outside the
163+
scope of this package.}
164+
165+
{2 Auxiliary libraries}
166+
167+
These have no dependency to the core {!Picos} framework and are used in the
168+
implementation of the other libraries.
169+
170+
- {!modules: Picos_domain}
171+
- {!modules: Picos_exn_bt}
172+
- {!modules: Picos_fd}
173+
- {!modules: Picos_htbl}
174+
- {!modules: Picos_mpsc_queue}
175+
- {!modules: Picos_rc}
176+
- {!modules: Picos_thread}
177+
178+
{^ Some of these libraries might be moved to other packages in the future.}

0 commit comments

Comments
 (0)