Tag Info

New answers tagged

3

You know that fork returns 0 for child and nonzero for parent. It gets quite convoluted, but you can sketch a tree of how the processes are forked. or skips evaluation of the second argument if the first is true, because in that case, the result is known to be true. and skips the second argument, if the first is false, because in that case, the result is ...


2

More modern OSes protect themselves from this sort of misuse by default, usually by setting user limits. That's probably why the system is still responsive - it only lets you allocate memory up to a certain amount, which is much less than the machine has available.


3

Yes, you are correct. In particular, this means that the child will inherit all variables from the parent process with the value they had at the moment of the fork. However, if at a later step one of the parent or the child modifies one of these variables, the modification will be local to this process: if the child modify a variable, the parent process ...


4

There is kernel setting /proc/sys/vm/overcommit_memory Citation from excellent article: Since 2.5.30 the values are: 0 (default): as before: guess about how much overcommitment is reasonable, 1: never refuse any malloc(), 2: be precise about the overcommit - never commit a virtual address space larger than swap space plus a fraction overcommit_ratio ...



Top 50 recent answers are included