Re:Unix system programming in OCaml (2014)
by rpcope1 on Wednesday July 11, 2018 @11:53PM
(#17512060)
I think one major turn off, especially for systems programming, was the lack of multicore threading support (i.e. it had no way to get parallelism using threads). Does anyone know if this has changed?
[ Parent
| on HN ]
Re:Unix system programming in OCaml (2014)
by fpoling on Thursday July 12, 2018 @04:48AM
(#17513077)
One of the fastest web servers is nginx that uses child processes (typically one child per core) and asynchronous IO within the child without any threads. The same model with a parent process that monitor threadless child workers is often used in embedded system. One can and people do exactly the same in OCaml.
Surely it requires more code to setup things especially if the child processes need to communicate over shared memory to max the performance, but the big plus is that the resulting system is much more robust. In case of troubles one can just let a child die or even use kill -9 and start a new child. This is not possible with most threading implementations. For example, try to recover from out-of-memory in multi threaded C++/Java/Go etc. application. It is very hard. With threadless children it is almost trivial.
Plus we have learned the hard way that concurrency and processes are much saner from safety point of view than threads.
Re:Unix system programming in OCaml (2014)
by atombender on Thursday July 12, 2018 @12:10AM
(#17512126)
Posted a week ago: http://kcsrk.info/slides/mcocaml_gallium.pdf
Discussion: https://news.ycombinator.com/item?id=17416797
In short, expect it merged in mid-to-late 2019, maybe.
Re:Unix system programming in OCaml (2014)
by ZirconiumX on Thursday July 12, 2018 @03:08AM
(#17512766)
While this is an issue, there are cooperative threading libraries (mainly Lwt and Async, though the community prefers Lwt) which can mitigate most of the reasons you'd need multithreading. Hell, because it's only single threaded, you can mostly ignore locking.
Re:Unix system programming in OCaml (2014)
by StreamBright on Thursday July 12, 2018 @03:17AM
(#17512795)
Isn't this project aiming to solve that?