Re: Using Threads?

From: Bruce Guenter <bruceg(at)em(dot)ca>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Using Threads?
Date: 2000-12-05 15:30:32
Message-ID: 20001205093032.A6900@em.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)em(dot)ca> http://em.ca/~bruceg/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2000-12-05 15:43:10 Re: Need help with phys backed shm segments (Postgresql+FreeBSD).
Previous Message Alfred Perlstein 2000-12-05 15:26:32 Re: Spinlocks may be broken.