Re: Using Threads?

Поиск
Список
Период
Сортировка
От Bruce Guenter
Тема Re: Using Threads?
Дата
Msg-id 20001205093032.A6900@em.ca
обсуждение исходный текст
Ответ на AW: Using Threads?  (Zeugswetter Andreas SB <ZeugswetterA@wien.spardat.at>)
Список 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 по дате отправления:

Предыдущее
От: "Larry Rosenman"
Дата:
Сообщение: RE: Re: LOCK Fixes/Break on FreeBSD 4.2-STABLE
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Need help with phys backed shm segments (Postgresql+FreeBSD).