Re: Using Threads? - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: Using Threads?
Date
Msg-id 200012090519.AAA14517@candle.pha.pa.us
Whole thread Raw
In response to Re: Using Threads?  (Junfeng Zhang <junfengz@cae.wisc.edu>)
List 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.

My question here is how much do we really context switch.  We do quite a
bit of work for each query, and I don't see us giving up the CPU very
often, as would be the case for a GUI where each thread does a little
work and goes to sleep.

Also, as someone pointed out, the postmaster doesn't connect to the
database, so there isn't much COW overhead.  The big win is that all the
text page are already in memory and shared by all backends.  They can't
modify those.

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


pgsql-hackers by date:

Previous
From: Tatsuo Ishii
Date:
Subject: Re: Re: A mb problem in PostgreSQL
Next
From: Bruce Momjian
Date:
Subject: Re: Using Threads?