| Markus E L 2007-08-20, 7:09 pm |
|
Paul Rubin wrote:
> Jon Harrop <jon@ffconsultancy.com> writes:
>
> I don't understand this at all.
>
> 1. Say I have some big structure in memory, then fork. Now there are
> two processes that can both read that structure. They can both make
> and release pointers to the structure as they run. Maybe eventually,
> all the pointers are released. How does the GC know it can free the
> structure?
Both processes have their own copy of the structure, but a "virtual"
copy because of COW.
> 2. I thought Unix fork resulted in copy-on-write. So what happens if
Yes.
> both processes want to modify the existing structure, or cons new
> structure that the other process can then access?
There is no shared data with fork()-parallelism. This can also be seen
as an advantage (e.g. isolation of processes) in certain application
scenarios.
> Maybe we need some faster type of IPC, like x86 call gates directly
> between user processes, instead of using sockets and system calls.
Everything is possible. But (1) if it is processor dependent it won't
port efficiently to other architectures and (2) AFAIR x86 call gates
are everything but fast :-).
Regards -- Markus
|