Re: Threads vs Processes
От | Dann Corbit |
---|---|
Тема | Re: Threads vs Processes |
Дата | |
Msg-id | D90A5A6C612A39408103E6ECDD77B829408BCA@voyager.corporate.connx.com обсуждение исходный текст |
Список | pgsql-hackers |
> -----Original Message----- > From: Tom Lane [mailto:tgl@sss.pgh.pa.us] > Sent: Friday, September 26, 2003 9:27 AM > To: Bruce Momjian > Cc: Shridhar Daithankar; pgsql-hackers@postgresql.org; > pgsql-hackers-win32@postgresql.org > Subject: Re: [HACKERS] Threads vs Processes > > > Bruce Momjian <pgman@candle.pha.pa.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.
В списке pgsql-hackers по дате отправления: