Xref: utzoo comp.unix.aux:4760 comp.unix.wizards:25786 Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!mintaka!ai-lab!life.ai.mit.edu!mycroft From: mycroft@kropotki.gnu.ai.mit.edu (Charles Hannum) Newsgroups: comp.unix.aux,comp.unix.wizards Subject: Re: collapsing forks Message-ID: Date: 29 May 91 23:48:28 GMT References: <1991May24.215945.13707@ddtg.com> Sender: news@ai.mit.edu Distribution: usa Organization: /home/fsf/mycroft/.organization Lines: 37 In-reply-to: pechner@ddtg.com's message of 24 May 91 21:59:45 GMT In article <1991May24.215945.13707@ddtg.com> pechner@ddtg.com (Michael Pechner) writes: I am having a very strange problem with A/UX. I can cause a fork to "sort of" fail by having a huge automatic variable. Here are two programs to show my point. The only difference between the two programs are that junk is an automatic in the version that fails, and a global static The working program: static char junk[256000]; The non-working program. The only difference is that "junk" is an automatic variable. main(){ /*...*/ char junk[256000]; } Notice that on the failed call, the fork returns a valid pid to the parent. The child does not return. The child process collapses immediately. Can anybody explain this to me? I believe so. B-) In the first example, 'junk' is indeed being allocated at the top level, as a global variable. This means the space is allocated in a separate data segment when the program is started. Since presumably your machine has enough RAM and/or virtual memory, this works. In the second example, 'junk' is indeed being allocated as an automatic variable. Most C compilers cause this data to be placed on the stack. For some reason, tossing 250K on the stack at once gives A/UX indigestion, and your program dies. (As an aside: On what systems, using what operating systems, *will* this work, and on which ones will it crash the kernel? B-) )