Re: Using Threads? - Mailing list pgsql-hackers

From Bruce Guenter
Subject Re: Using Threads?
Date
Msg-id 20001205093032.A6900@em.ca
Whole thread Raw
In response to AW: Using Threads?  (Zeugswetter Andreas SB <ZeugswetterA@wien.spardat.at>)
List pgsql-hackers
On Tue, Dec 05, 2000 at 10:07:37AM +0100, Zeugswetter Andreas SB wrote:
> > And using the following program for timing thread creation
> > and cleanup:
> >
> > #include <pthread.h>
> >
> > threadfn() { pthread_exit(0); }
>
> I think you would mainly need to test how the system behaves, if
> the threads and processes actually do some work in parallel, like:
>
> threadfn() {int i; for (i=0; i<10000000;) {i++}; pthread_exit(0); }

The purpose of the benchmark was to time how long it took to create and
destroy a process or thread, nothing more.  It was not creating
processes in parallel for precisely that reason.  The point in dispute
was that threads took much less time to create than processes.

> In a good thread implementation 10000 parallel processes tend to get way less
> cpu than 10000 parallel threads, making threads optimal for the very many clients case
> (like > 3000).

Why do you believe this?  In the "classical" thread implementation, each
process would get the same amount of CPU, no matter how many threads was
running in it.  That would mean that many parallel processes would get
more CPU in total than many threads in one process.
--
Bruce Guenter <bruceg@em.ca>                       http://em.ca/~bruceg/

pgsql-hackers by date:

Previous
From: "Larry Rosenman"
Date:
Subject: RE: Re: LOCK Fixes/Break on FreeBSD 4.2-STABLE
Next
From: Tom Lane
Date:
Subject: Re: Need help with phys backed shm segments (Postgresql+FreeBSD).