Re: Using Threads?

Поиск
Список
Период
Сортировка
От Dan Lyke
Тема Re: Using Threads?
Дата
Msg-id 14892.6919.336659.41711@wynand.flutterby.com
обсуждение исходный текст
Ответ на Re: Using Threads?  (Adam Haberlach <adam@newsnipple.com>)
Ответы Re: Using Threads?  (Bruce Guenter <bruceg@em.ca>)
Re: Using Threads?  (Bruce Momjian <pgman@candle.pha.pa.us>)
Список pgsql-hackers
Adam Haberlach writes:
> Typically (on a well-written OS, at least), the spawning of a thread
> is much cheaper then the creation of a new process (via fork()).

This would be well worth testing on some representative sample
systems.

Within the past year and a half at one of my gigs some coworkers did
tests on various platforms (Irix, Solaris, a few variations of Linux
and *BSDs) and concluded that in fact the threads implementations were
often *slower* than using processes for moving and distributing the
sorts of data that they were playing with.

With copy-on-write and interprocess pipes that are roughly equivalent
to memcpy() speeds it was determined for that application that the
best way to split up tasks was fork()ing and dup().

As always, your mileage will vary, but the one thing that consistently
amazes me on the Un*x like operating systems is that usually the
programmatically simplest way to implement something has been
optimized all to heck.

A lesson that comes hard to those of us who grew up on MS systems.

Dan


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Alex Perel
Дата:
Сообщение: INSERT INTO ... SELECT problem
Следующее
От: Jan Wieck
Дата:
Сообщение: Re: 8192 BLCKSZ ?]