On Wed, Feb 28, 2001 at 12:35:20PM -0800, Living Dead wrote:
> I have the following code:
> The question is:
> Is there a risk to run out of memory?
>
> To put it in another way:
> If I allocate 32Mb of memory in the parent process,
> then I call fork(), the amount of memory needed for
> both parent and child is 64Mb?
No. There wouldn't have been with "old" Unix fork, and less with
Linux's fork.
The old Unix fork would have required 64Mb, but that just means someone
would have paged to disk.
Linux does a "copy on write", meaning the memory isn't allocated until
changed; all that's created are page tables for the new process.
See "fork(2)" via "man fork".
Cheers,
--
Dave Ihnat
[EMAIL PROTECTED]
_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list