RE: Linux scheduler, overscheduling performance, threads

From: David Schwartz (davids@webmaster.com)
Date: Fri Jan 21 2000 - 15:28:44 EST


> On Fri, 21 Jan 2000, David Schwartz wrote:
>
> >
> > > Following this thread off and on since it's inception, and
> being a Java
> > > programmer myself, can I offer some observations?
> >
> > Ahh, a Java programmer, that explains it.
>
> So what's your experience?

        My experience is that well-written programs use threads for specific,
well-chosen purposes. They don't create hundreds of kernel threads just to
let them block most of the time. That wastes system resources.

> For the record, I _also_ write device drivers (most of the commercial unix
> versions and the various windows). Have you ever worked in an enterprise
> environment?

        Absolutely. I've developed software for everything from embedded medical
devices to clusters of servers managing tens of thousands of clients.

> Do you have any idea how the internals of a database works?

        Yes.

> Have you ever even used an OS other than Linux, FreeBSD, and Windows?

        Yes. I've ported enterprise code to Solaris, Irix, and Digital UNIX.

        System threads are only needed for a very small number of things:

        1) One thread for each CPU you need to keep busy.

        2) One thread for each I/O operation you want to 'pend' that can't be done
in a non-blocking fashion. (Network I/O doesn't count, disk I/O does.)

        3) A small number of threads for 'special tasks' that are best done by
their own thread. For example, one thread to 'poll' on all the file
descriptors you are using. One thread to fire off timers. One thread to
adjust the number of threads you have in other pools. One thread to watch
the system clock for jumps. And so on.

        That's it. If you use system threads for the wrong things, you deserve to
lose.

        DS

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Jan 23 2000 - 21:00:25 EST