The run queue length (or "load average") is an estimate of processes
that *could* run if there were CPU cycles available.  However,
there's a fudge factor because the kernel also figures in processes
that it *expects* to be runnable within the next few seconds
("short-term sleepers"); e.g., processes waiting for I/O or fork()s
to complete.  Problems can arise when some processes treat this
number as TRVTH.   For example, sendmail refuses connections if
the load average goes above certain levels.

Below is a cute program that I've used to pump up load averages.
Interestingly, FreeBSD is clever enough to avoid figuring such a
"vfork() chain" into its load average computations.

Regards,
Romain Kang                             Disclaimer: I speak for myself alone,
[EMAIL PROTECTED]                except when indicated otherwise.

main(argc, argv)
        int argc;
        char **argv;
{
        int i, nproc;
        int rc, wc;

        if (argc < 2) {
                exit(1);
        }
        nproc = atoi(argv[1]);

        do {
                rc = vfork();
                if (rc == -1) {
                        printf("rc = %d, nproc = %d\n", rc, nproc);
                        pause();
                }
                else if (rc == 0) {
                        if (nproc-- > 0)
                                continue;
                }
                else {
                        wait(&wc);
                }
        } while (nproc > 0);
        pause();        /* wait for control-C or whatever */
}



_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to