Re: Using Threads? - Mailing list pgsql-hackers

From Adam Haberlach
Subject Re: Using Threads?
Date
Msg-id 20001204151659.A30808@ricochet.net
Whole thread Raw
In response to Re: Using Threads?  (Bruce Guenter <bruceg@em.ca>)
Responses Re: Using Threads?  (Dan Lyke <danlyke@flutterby.com>)
Re: Using Threads?  (Bruce Guenter <bruceg@em.ca>)
List pgsql-hackers
On Mon, Dec 04, 2000 at 02:28:10PM -0600, Bruce Guenter wrote:
> On Mon, Nov 27, 2000 at 11:42:24PM -0600, Junfeng Zhang wrote:
> > I am new to postgreSQL. When I read the documents, I find out the Postmaster
> > daemon actual spawns a new backend server process to serve a new client
> > request. Why not use threads instead? Is that just for a historical reason,
> > or some performance/implementation concern?
> 
> Once all the questions regarding "why not" have been answered, it would
> be good to also ask "why use threads?"  Do they simplify the code?  Do
> they offer significant performance or efficiency gains?  What do they
> give, other than being buzzword compliant?
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()).  Also,
since everything in a group of threads (I'll call 'em a team) shares the
same address space, there can be some memory overhead savings.

-- 
Adam Haberlach           |"California's the big burrito, Texas is the big
adam@newsnipple.com      | taco ... and following that theme, Florida is
http://www.newsnipple.com| the big tamale ... and the only tamale that 
'88 EX500                | counts any more." -- Dan Rather 


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Wrong FOR UPDATE lock type
Next
From: Alex Perel
Date:
Subject: INSERT INTO ... SELECT problem