[ OT for -security, merely for the record and the interested ] On Sun, Apr 22, 2001 at 20:46 +0200, Stefan Hoffmeister wrote:
When is "not enough memory" really "not enough memory"? If you fork an application with a code size of 5 MB a hundred times - do you need 5 MB of "memory", or do you need 500 MB?
Get a book on UNIX memory management (like the ubiquitous "The design of the UNIX operating system") and look at the "shared text" and "copy on write" discussion. In short: text segments (i.e. code) are loaded only once and get shared among applications. stack and data segments get shared upon fork(2) but marked for "copy on write" (that's some kind of read only). As soon as there's a write operation an exception is triggered to have the data copied to the writing process before manipulation. This method doesn't make much sense in regards of stack segments, so they could be separate right from the start. So: everything equal between the processes is shared (existing only once in reality, referenced multiple times) and everything special to an application is kept separately. NB: sticky executables' segments are kept in RAM even after the exit(2) call which makes them easier available upon their next invocation. That's really useful for shells, xterm, etc. virtually yours 82D1 9B9C 01DC 4FB4 D7B4 61BE 3F49 4F77 72DE DA76 Gerhard Sittig true | mail -s "get gpg key" Gerhard.Sittig@gmx.net -- If you don't understand or are scared by any of the above ask your parents or an adult to help you.