The future of "frozen" types as the number of CPU cores increases
no.email at nospam.invalid
Sun Feb 21 04:46:33 CET 2010
John Nagle <nagle at animats.com> writes:
>> A decent OS will use copy-on-write with forked processes, which should
>> carry through to the cache for the code.
> That doesn't help much if you're using the subprocess module. The
> C code of the interpreter is shared, but all the code generated from
> Python is not.
Emacs in days of yore used a hack called "unexec" to bring its Lisp code
into the pure text segment. I think it's not used any more because
machines are now big enough that the benefits aren't that great.
Basically in the Emacs build process, you'd start up the C portion of
Emacs, then tell it to load all its Lisp code, then call "unexec".
Unexec basically performed a core dump of the process, then ran
something that manipulated the original Emacs image and the core dump
into a new executable that had the static Lisp code and data now marked
as part of the (immutable) program area. Unexec necessarily had
platform dependencies, but this was managed with a bunch of ifdefs in a
reasonably clean and maintainable way. I could imagine doing something
similar with a large Python program.
More information about the Python-list