A tutorial on parallel programming in OCaml 5

For the CAMLparam macros, the discipline is the same as OCaml 4 – the user needs to ensure that allocations functions (caml_alloc*) are not called before the parameters are registered.

For the stop-the-world sections, OCaml 5 doesn’t stop a domain execution arbitrarily at any point (by interrupting the threads with signals, for example). Whenever a domain triggers a stop-the-world section, the other domains will participate in the stop-the-world barrier at their next allocation point. This ensures that the discipline followed for the correct use of CAMLparam macros in OCaml 4 is sufficient in OCaml 5.

Indeed if every domain has its own minor heap, what’s the point of one domain’s minor heap collection triggering another domain’s collection?

There could be cross minor-heap pointers. We cannot independently collect the minor heap of domains without handling this case.