
On Thu, Feb 17, 2022 at 7:01 AM Eric Snow <ericsnowcurrently@gmail.com> wrote:
Also note that "fork" isn't the only operating system mechanism that uses copy-on-write semantics.
Could you elaborate? mmap, maybe? [snip[ So if you know how to get benefit from CoW without fork, I want to know it.
Sorry if I got your hopes up. Yeah, I was talking about mmap.
Is there any common tool that utilize CoW by mmap? If you know, please its link to the PEP. If there is no common tool, most Python users can get benefit from this. Generally speaking, fork is a legacy API. It is too difficult to know which library is fork-safe, even for stdlibs. And Windows users can not use fork. Optimizing for non-fork use case is much better than optimizing for fork use cases. * https://gist.github.com/nicowilliams/a8a07b0fc75df05f684c23c18d7db234 * https://www.microsoft.com/en-us/research/uploads/prod/2019/04/fork-hotos19.p... * https://www.evanjones.ca/fork-is-dangerous.html * https://bugs.python.org/issue33725 I hope per-interpreter GIL replaces fork use cases. But tools using CoW without fork also welcome, especially if it supports Windows. Anyway, I don't believe stopping refcounting will fix the CoW issue yet. See this article [1] again. [1] https://instagram-engineering.com/dismissing-python-garbage-collection-at-in... Note that they failed to fix CoW by stopping refcounting code objects! (*) Most CoW was caused by cyclic GC and finalization caused most CoW. (*) It is not surprising to me because eval loop don't incre/decref most code attributes. They borrow reference from the code object. So we need a sample application and profile it, before saying it fixes CoW. Could you provide some data, or drop the CoW issue from this PEP until it is proved? Regards, -- Inada Naoki <songofacandy@gmail.com>