------------------------------------------------------------------->
pc5829:~/forkbomb$ cat bomb
bash: fork: Try again
pc5829:~/forkbomb$ cat bomb
#!/bin/bash
bomb &
bomb &
pc5829:~/forkbomb$ uptime
2:12pm up 28 min, 3 users, load average: 225.53, 169.94, 84.59
<------------------------------------------------------------------
the system is noticably slower, but it's still quite usable :) The patch
fixes other scheduling oddities as well, i hope it's the right thing ...
It's against 2.1.30, but it should work in 2.0 too.
-- mingo
--- linux-2.1.30_vanilla/kernel/fork.c Sun Jan 26 12:40:46 1997
+++ linux/kernel/fork.c Sat Mar 29 14:17:13 1997
@@ -292,7 +298,16 @@
/* ok, now we should be set up.. */
p->swappable = 1;
p->exit_signal = clone_flags & CSIGNAL;
- p->counter = current->counter >> 1;
+
+ /*
+ * "share" dynamic priority between parent and child, thus the
+ * total amount of dynamic priorities in the system doesnt change,
+ * more scheduling fairness. This is only important in the first
+ * timeslice, on the long run the scheduling behaviour is unchanged.
+ */
+ current->counter >>= 1;
+ p->counter = current->counter;
+
if(p->pid) {
wake_up_process(p); /* do this last, just in case */
} else {