Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-general by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group