Why OCaml's threading is considered as `not enough`?

后端 未结 2 1975
别那么骄傲
别那么骄傲 2020-12-31 05:59

It seems many people are saying OCaml does not have a good capacity for concurrency and it is also not good for web server applications.

I am currently learning oca

2条回答
  •  旧时难觅i
    2020-12-31 06:53

    OCaml supports the usage of multiple threads. But only one ocaml thread can run at a given point in time, there is never a parellelism of different ocaml threads.

    However:

    • you can fork / use multiple processes.

    • external code (eg. external c/c++-libraries) can run in parallel, as long as their interaction with the ocaml runtime is properly controlled.

    PS: The linked document is not the ocaml manual. It's a good, but dated book about OCaml.

    Appendix: Of course, you can develop servers in ocaml (live example: ocsigen - a web server ). It depends on your needs, if the lack of real thread concurreny is a feature or disadvantage.

提交回复
热议问题