From: | "Dann Corbit" <DCorbit(at)connx(dot)com> |
---|---|
To: | "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Bruce Momjian" <pgman(at)candle(dot)pha(dot)pa(dot)us> |
Cc: | "Shridhar Daithankar" <shridhar_daithankar(at)persistent(dot)co(dot)in>, <pgsql-hackers(at)postgresql(dot)org>, <pgsql-hackers-win32(at)postgresql(dot)org> |
Subject: | Re: [HACKERS] Threads vs Processes |
Date: | 2003-09-26 18:12:06 |
Message-ID: | D90A5A6C612A39408103E6ECDD77B829408BCA@voyager.corporate.connx.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-hackers-win32 |
> -----Original Message-----
> From: Tom Lane [mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us]
> Sent: Friday, September 26, 2003 9:27 AM
> To: Bruce Momjian
> Cc: Shridhar Daithankar; pgsql-hackers(at)postgresql(dot)org;
> pgsql-hackers-win32(at)postgresql(dot)org
> Subject: Re: [HACKERS] Threads vs Processes
>
>
> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > One solution is for me to continue with this in the Win32
> CVS version
> > until I have fork/exec() working on Unix, then test on
> Win32. I think
> > that could be done in a few weeks, if not less.
>
> > Another solution, already mentioned, is to use threads and
> TLS. This
> > is what SRA's code uses. I know SRA wants to contribute that code
> > back to the community, so I can ask them to see if they are
> ready to
> > release it.
>
> If you are willing to expend the effort, I think it would be
> worth the time to pursue both approaches. We don't yet have
> enough info to decide which one will be cleaner, so we need
> to push forward on both until we can make a realistic comparison.
I think the ideal situation would be a server that both threads and
forks.
Sometimes, we want the server to take on a new personality (with the
rights of the attaching user). In such a case, threading is not a
sufficient answer. Also, a forked process is a bit safer (though you
can put a try/catch around threads).
For performance with multiple queries from a single user, threads are
going to be faster than forking. I think that the best model will be a
server that does both.
I know that there is some aversion to using C++, but the ACE framework
offers a consistent threading model that works for just about every
computer under the sun.
http://www.cs.wustl.edu/~schmidt/ACE.html
The license is basically BSD (it is called ACE, but it works exactly
like a BSD license). With ACE, you program to a single API, and the
code works the same on every platform with a simple recompile. It might
even be worthwhile to use the ACE higher level components to create a
server that supports multiple models of connection and threading.
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2003-09-26 18:12:39 | Re: initdb failure (was Re: [GENERAL] sequence's plpgsql) |
Previous Message | Bruce Momjian | 2003-09-26 18:10:25 | Re: 2-phase commit |
From | Date | Subject | |
---|---|---|---|
Next Message | Christopher Kings-Lynne | 2003-09-27 05:20:22 | Re: [HACKERS] Threads vs Processes |
Previous Message | Bruce Momjian | 2003-09-26 16:35:40 | Re: [HACKERS] Threads vs Processes |