> On 18 Jun 2020, at 19:00, Jonathan Fine <jfine2...@gmail.com> wrote:
> 
> Hi Barry
> 
> You wrote:
> Did my last reply cover a possible implementation of this?
> e.g. The code is nowhere near the ref-count that triggers COW.
> 
> Could say, do you think it's possible to extend Python so that it can use 
> permanent code objects, when they are made available?

We need to define terms here. What do you mean by permanent?

If you mean that after forking the child does not trigger COW on the code that 
is not modified then, yes I think that can be implemented.
Also the child can modify the code if that is part of its algorithms without 
problem.

> 
> For the moment, that is the main question. Is the basic scheme possible? (For 
> me, I use Unix shared objects as an existence proof.)

Shared objects are not the same as forking the address space and avoiding COW.

In the case of .so (and .dll) files the memory used for the code and read-only 
data in an .so is only loaded into memory once
and the operating system makes the page tables point to the one copy. Further 
paging of that data does use the linux swap file,
aka page file.

.pyc files cannot be used in the same way as .so can, by simple mapping the 
file into memory and paging in the code as you touch it.

Being able to create python share object files is another problem.

> 
> If so, then I suspect that we are focused on different parts of the 
> implementation details.

I think thats right. I think I am showing how what you want, if I have not 
misunderstood, could be implemented,

> 
> Oh, and thank you Christopher for your encouraging reply.


Indeed!


Barry

> 
> -- 
> Jonathan
> 
>  
> 
> 

_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/WV4C3KKQ743UJLJCRES2INRZKYBEUROE/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to