Re: Using Threads?

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Junfeng Zhang <junfengz(at)cae(dot)wisc(dot)edu>
Cc: Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Using Threads?
Date: 2000-12-09 05:19:27
Message-ID: 200012090519.AAA14517@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
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.

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(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2000-12-09 05:20:33 Re: Using Threads?
Previous Message Tatsuo Ishii 2000-12-09 04:21:39 Re: Re: A mb problem in PostgreSQL