2 ms·
Just to add to the sibling comment. To maintain backwards compatibility, OCaml 5 has both threads and domains. Threads belong to a domain and only one thread c
by sadiq 4y ago
Just to add to the sibling comment. To maintain backwards compatibility, OCaml 5 has both threads and domains.
Threads belong to a domain and only one thread can hold the runtime lock for the domain. This is the same behaviour as in OCaml 4.
With OCaml 5 you can have as many domains as you want though (we recommend no more than you have cores though).
- edwintorok 4y agoThis backwards compatibility decision to separate threads from domains has been very useful and allows to gradually "port" existing code to 5.0: first just fixup C bindings to avoid naked pointers, and then code can safely run on OCaml 5 just as before. And once a program (and all its dependencies) have removed dependence on global state they can opt-in to multicore by spawning additional domains.