Linux implements copy-on-write. When you fork a process you create a copy of
the page/segment tables of the parent but your pages are protected. Thus if
you need to read you can read the shared copy of the page. However, if you
need to write then you'll generate a protection exception. The kernel will
field this determine if the address your attempting to write to is valid (it
looks up your mmap info.) and will create a copy of the page and mark it as
writable by the process. The operation is retried and you program proceeds.
Consider the alternative: as soon as you fork a copy of the entire address
space is created for you. Your system would soon be thrashing itself silly.

-----Original Message-----

On another, unrelated but equally newbie topic - while TRACEing around the
Linux guest, I saw what seemed an alarming number of PROG 4's (not the
expected page and segment translation exceptions, which I also see). In
systems with which I'm more familiar, this number of protection exceptions
(48 during a "who") would have meant a serious coding problem. But I see
no indication of any error.  Should I assume this is just part of normal
Linux operation?

If it's normal, would anyone care to explain (or point me to a discussion
somewhere which explains) how it's being used? It's obviously not
critical, and I only did a quick search myself, but I'd like to
understand.

Reply via email to