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

Re: Using Threads?

From: Junfeng Zhang <junfengz(at)cae(dot)wisc(dot)edu>
To: Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Using Threads?
Date: 2000-12-04 15:31:14
Message-ID: Pine.SOL.4.05.10012040919510.548-100000@sun-37.cae.wisc.edu (view raw or flat)
Thread:
Lists: pgsql-hackers
All the major operating systems should have POSIX threads implemented.
Actually this can be configurable--multithreads or one thread.

Thread-only server is unsafe, I agree. Maybe the following model can be a
little better. Several servers, each is multi-threaded. Every server can
support a maximum number of requests simultaneously. If anything bad
happends, it is limited to that server. 

The cons side of processes model is not the startup time. It is about
kernel resource and context-switch cost. Processes consume much more
kernel resource than threads, and have a much higher cost for context
switch. The scalability of threads model is much better than that of
processes model.

-Junfeng

On Mon, 4 Dec 2000, Thomas Lockhart 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?
> 
> Both. Not all systems supported by PostgreSQL have a standards-compliant
> threading implementation (even more true for the systems PostgreSQL has
> supported over the years).
> 
> But there are performance and reliability considerations too. A
> thread-only server is likely more brittle than a process-per-client
> implementation, since all threads share the same address space.
> Corruption in one server might more easily propagate to other servers.
> 
> The time to start a backend is quite often small compared to the time
> required for a complete session, so imho the differences in absolute
> speed are not generally significant.
> 
>                        - Thomas
> 


In response to

Responses

pgsql-hackers by date

Next:From: Larry RosenmanDate: 2000-12-04 15:33:58
Subject: Re: compiling pg 7.0.3 on sco 5.0.5
Previous:From: pejacDate: 2000-12-04 15:28:47
Subject: Bitmap index

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