From: nichols@ttd.teradyne.com Subject: Re: shared libs - can everyone be happy with this? Date: 21 Aug 1992 21:24:26 GMT
In article <LILJEBER.92Aug17203359@klaava.Helsinki.FI>, liljeber@klaava.Helsinki.FI (Mika Pekka Liljeberg) writes:
>>
>> No, it wouldn't be shareable. When a process writes to a shared page,
>> it gets its very own copy of it which is no longer shared. There is a
>> term for this that you probably already know, but others may not. It's
>> called Copy-On-Write.
>
> I'll admit right away that I'm no expert, but it seems to me that William is
> right. The page _could_ still be shared, since all the processes using the
> page would be using the same libs. Of course, some kernel support would be
> needed: The page fault handler would have to check, if the referenced address
> is in library space and if so, fix the reference to point to the correct
> place in the library and clear the dirty-bit for that page instead of doing
> a Copy On Write. This would also work for static data references, as long as
> the data structures didn't change too profoundly.
>
> Would this break demand loading, then? I think not. A text page could still
> be freed and reloaded on demand. Any library references on it would simply
> get relinked, when the path of execution intercepted them.
What happens if the 'linker fixup' code just happens to span a text page?
Since it's extremely unlikely that the link code is only one byte long, I
could forsee a problem if only part of it is paged back in ( *BOOM* ). Try
to find that one with your debugger! :-)
Rick