3 ms·
At an initial glance it looks like a forkbomb, but it isn't. The program is never going to get past: for (;;) { printf blah blah } So the fork
by mustpax 17y ago
At an initial glance it looks like a forkbomb, but it isn't. The program is never going to get past:
for (;;) {
printf blah blah
}
So the fork() call is only going to get executed once. It just fills your screen with lots of text, which doesn't "fuck yo memry."
- dmoney 17y agoBut wouldn't the forked process also fork another process (which would do the same...), thus, eventually "fucking yo memry"?
- cperciva 17y agoNo -- both processes return from the fork() call (with different return values).
- barrkel 17y agoBoth processes resume after the fork call, and both go into the loop. Only the return value from the fork call tells you which process you're in. It is somewhat idiosyncratic that the snippet uses both while (1) and for (;;) for infinite looping, which seems to indicate less than total familiarity with C.
- dmoney 17y agoAh, I was thinking the child process started from the beginning. I guess the artist was too. It'd be funny to get some green spraypaint and submit a patch.
- thwarted 17y agoNope, only a single child process is created, and the parent and child go into an infinite loop. And two processes stuck in finite loops do not fucked memry make.
- irrelative 17y agoIndeed. Only twice as much "damage" as one process stuck in an infinite loop.