Re: Reasoning behind process instead of thread based - Mailing list pgsql-general

From Martijn van Oosterhout
Subject Re: Reasoning behind process instead of thread based
Date
Msg-id 20041028095816.GA4673@svana.org
Whole thread Raw
In response to Re: Reasoning behind process instead of thread based  (Thomas Hallgren <thhal@mailblocks.com>)
Responses Re: Reasoning behind process instead of thread based  (Thomas Hallgren <thhal@mailblocks.com>)
List pgsql-general
On Thu, Oct 28, 2004 at 12:13:41AM +0200, Thomas Hallgren wrote:
> Martijn van Oosterhout wrote:
> >A lot of these advantages are due to sharing an address space, right?
> >Well, the processes in PostgreSQL share address space, just not *all*
> >of it. They communicate via this shared memory.
> >
> Whitch is a different beast altogether. The inter-process mutex handling
> that you need to synchronize shared memory access is much more expensive
> than the mechanisms used to synchronize threads.

Now you've piqued my curiosity. You have two threads of control (either
two processes or two threads) which shared a peice of memory. How can
the threads syncronise easier than processes, what other feature is
there? AFAIK the futexes used by Linux threads is just as applicable
and fast between two processes as two threads. All that is required is
some shared memory.

Or are you suggesting the only difference is in switching time (which
is not that significant).

Also, I admit that on some operating systems, threads are much faster
than processes, but I'm talking specifically about linux here.

Thanks in advance,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

Attachment

pgsql-general by date:

Previous
From: Joel
Date:
Subject: Re: compatibilityissues from 7.1 to 7.4
Next
From: Thomas Hallgren
Date:
Subject: Re: Reasoning behind process instead of thread based