Skip to content

Commit 2ed2081

Browse files
SGrondintalex5
authored andcommitted
Minor documentation updates
- OCaml 5.1 is now the minimum version - Add some helpful links - Clarify executor pool API docs
1 parent ccf1ba7 commit 2ed2081

File tree

2 files changed

+14
-18
lines changed

2 files changed

+14
-18
lines changed

README.md

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# Eio -- Effects-Based Parallel IO for OCaml
44

5-
Eio provides an effects-based direct-style IO stack for OCaml 5.0.
5+
Eio provides an effects-based direct-style IO stack for OCaml 5.
66
For example, you can use Eio to read and write files, make network connections,
77
or perform CPU-intensive calculations, running multiple operations at the same time.
88
It aims to be easy to use, secure, well documented, and fast.
@@ -17,7 +17,7 @@ Eio replaces existing concurrency libraries such as Lwt
1717
* [Motivation](#motivation)
1818
* [Current Status](#current-status)
1919
* [Structure of the Code](#structure-of-the-code)
20-
* [Getting OCaml 5.0](#getting-ocaml-50)
20+
* [Getting OCaml 5.1](#getting-ocaml-51)
2121
* [Getting Eio](#getting-eio)
2222
* [Running Eio](#running-eio)
2323
* [Testing with Mocks](#testing-with-mocks)
@@ -64,10 +64,10 @@ Eio replaces existing concurrency libraries such as Lwt
6464
## Motivation
6565

6666
The `Unix` library provided with OCaml uses blocking IO operations, and is not well suited to concurrent programs such as network services or interactive applications.
67-
For many years, the solution to this has been libraries such as Lwt and Async, which provide a monadic interface.
67+
For many years, the solution was to use libraries such as Lwt and Async, which provide a monadic interface.
6868
These libraries allow writing code as if there were multiple threads of execution, each with their own stack, but the stacks are simulated using the heap.
6969

70-
OCaml 5.0 adds support for "effects", removing the need for monadic code here.
70+
OCaml 5 added support for "effects", removing the need for monadic code here.
7171
Using effects brings several advantages:
7272

7373
1. It's faster, because no heap allocations are needed to simulate a stack.
@@ -77,17 +77,13 @@ Using effects brings several advantages:
7777

7878
Additionally, modern operating systems provide high-performance alternatives to the old Unix `select` call.
7979
For example, Linux's io_uring system has applications write the operations they want to perform to a ring buffer,
80-
which Linux handles asynchronously.
81-
82-
Due to this, many OCaml users will want to rewrite their IO code.
83-
It would be very beneficial to use this opportunity to standardise a single concurrency API for OCaml,
84-
and we hope that Eio will be that API.
80+
which Linux handles asynchronously, and Eio can take advantage of this.
8581

8682
## Current Status
8783

8884
See [Eio 1.0 progress tracking](https://github.com/ocaml-multicore/eio/issues/388) for the current status.
8985
Please try porting your programs to use Eio and submit PRs or open issues when you find problems.
90-
Remember that you can always fall back to using Lwt libraries to provide missing features if necessary.
86+
Remember that you can always [fall back to using Lwt libraries](#lwt) to provide missing features if necessary.
9187

9288
See [Awesome Multicore OCaml][] for links to work migrating other projects to Eio.
9389

@@ -100,19 +96,19 @@ See [Awesome Multicore OCaml][] for links to work migrating other projects to Ei
10096
- [Eio_windows][] is for use on Windows (incomplete - [help wanted](https://github.com/ocaml-multicore/eio/issues/125)).
10197
- [Eio_main][] selects an appropriate backend (e.g. `eio_linux` or `eio_posix`), depending on your platform.
10298

103-
## Getting OCaml 5.0
99+
## Getting OCaml 5.1
104100

105-
You'll need OCaml 5.0.0 or later.
101+
You'll need OCaml 5.1.0 or later.
106102
You can either install it yourself or build the included [Dockerfile](./Dockerfile).
107103

108104
To install it yourself:
109105

110106
1. Make sure you have opam 2.1 or later (run `opam --version` to check).
111107

112-
2. Use opam to install OCaml 5.0.0:
108+
2. Use opam to install OCaml:
113109

114110
```
115-
opam switch create 5.0.0
111+
opam switch create 5.1.1
116112
```
117113

118114
## Getting Eio
@@ -1003,7 +999,7 @@ The mock backend provides a mock clock that advances automatically where there i
1003999

10041000
## Multicore Support
10051001

1006-
Fibers are scheduled cooperatively within a single domain, but you can also create new domains that run in parallel.
1002+
Fibers are scheduled cooperatively within a single [domain](https://v2.ocaml.org/manual/parallelism.html), but you can also create new domains that run in parallel.
10071003
This is useful to perform CPU-intensive operations quickly.
10081004
For example, let's say we have a CPU intensive task:
10091005

lib_eio/executor_pool.mli

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
(** An executor pool distributes jobs among a pool of domains workers (threads).
1+
(** An executor pool distributes jobs (functions to execute) among a pool of domain workers (threads).
22
33
Domains are reused and can execute multiple jobs concurrently.
44
Jobs are queued up if they cannot be started immediately due to all workers being busy.
55
6-
[Eio.Executor_pool] is the recommended way of leveraging OCaml's 5 multicore capabilities.
6+
[Eio.Executor_pool] is the recommended way of leveraging OCaml 5's multicore capabilities.
77
It is built on top of the low level [Eio.Domain_manager].
88
99
Usually you will only want one pool for an entire application,
@@ -37,7 +37,7 @@ val create :
3737
The executor pool will not block switch [sw] from completing;
3838
when the switch finishes, all domain workers and running jobs are cancelled.
3939
40-
@param domain_count The number of additional domain workers to create.
40+
@param domain_count The number of domain workers to create.
4141
The total number of domains should not exceed {!Domain.recommended_domain_count} or the number of cores on your system.
4242
Additionally, consider reducing this number by 1 if your original domain will be performing CPU intensive work at the same time as the Executor_pool.
4343
*)

0 commit comments

Comments
 (0)