Re: Reasoning behind process instead of thread based

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: nd02tsk(at)student(dot)hig(dot)se
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Reasoning behind process instead of thread based
Date: 2004-10-27 18:09:32
Message-ID: 20041027180931.GD17293@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Oct 27, 2004 at 07:47:03PM +0200, nd02tsk(at)student(dot)hig(dot)se wrote:
> >Two: If a
> > single process in a multi-process application crashes, that process
> > alone dies. The buffer is flushed, and all the other child processes
> > continue happily along. In a multi-threaded environment, when one
> > thread dies, they all die.
>
>
> So this means that if a single connection thread dies in MySQL, all
> connections die?
>
> Seems rather serious. I am doubtful that is how they have implemented it.

It's part of the design of threads. If a thread does an invalid lookup,
it's the *process* (ie all threads) that receives the signal and it's
the *process* that dies.

Just like a SIGSTOP stops all threads and a SIGTERM terminates them
all. Signals are shared between threads. Now, you could ofcourse catch
these signals but you only have one address space shared between all
the threads, so if you want to exit to get a new process image (because
something is corrupted), you have to close all connections.

And indeed, the one MySQL server I can see is four threads. Nasty.
--
Martijn van Oosterhout <kleptog(at)svana(dot)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.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2004-10-27 18:09:43 Re: Newbie question about casting literals - oracle/postgres
Previous Message Alvaro Herrera 2004-10-27 18:08:39 Re: what could cause inserts getting queued up and db locking??