Re: [HACKERS] Threads vs Processes

2003-09-26 Thread Zeugswetter Andreas SB SD
When the address-of operator is applied to a thread-local variable, it is evaluated at run-time and returns the address of the current thread's instance of that variable. An address so obtained may be used by any thread. When a thread terminates, any pointers to thread-local variables in

Re: [pgsql-hackers-win32] [HACKERS] Threads vs Processes

2003-09-26 Thread Merlin Moncure
Tom Lane wrote: Merlin Moncure [EMAIL PROTECTED] writes: All TLS variables *must* be static (or implicitly static through extern, i.e. no 'auto' variables) I assume you mean static as in not-auto, rather than static as in not-global. Otherwise we have a problem here. Yes, you are correct.

Re: [HACKERS] Threads vs Processes

2003-09-26 Thread Shridhar Daithankar
Tom Lane wrote: Shridhar Daithankar [EMAIL PROTECTED] writes: One thing that can be done is to arrange all globals/statics in a structure and make that structure thread local. That's about as far from non-invasive as I can imagine :-( I know. I have following half baked solution. Obviously it

Re: [pgsql-hackers-win32] [HACKERS] Threads vs Processes

2003-09-26 Thread Tom Lane
Merlin Moncure [EMAIL PROTECTED] writes: Tom Lane wrote: Surely the addresses can be assumed constant within a thread. Otherwise we have a problem here too. Quoting from the MSDN: The address of a thread local object is not considered constant, and any expression involving such an address

Re: [HACKERS] Threads vs Processes

2003-09-26 Thread Tom Lane
Shridhar Daithankar [EMAIL PROTECTED] writes: We really don't need threads to replace existing functionality. That would be dog work. No, that's not the point at all. The problem we are facing at the moment with the Windows port is lack of fork(), which means there's no way for

Re: [HACKERS] Threads vs Processes

2003-09-26 Thread Shridhar Daithankar
On Friday 26 September 2003 20:19, Tom Lane wrote: Shridhar Daithankar [EMAIL PROTECTED] writes: We really don't need threads to replace existing functionality. That would be dog work. No, that's not the point at all. The problem we are facing at the moment with the Windows port is lack

Re: [pgsql-hackers-win32] [HACKERS] Threads vs Processes

2003-09-26 Thread Andreas Pflug
Tom Lane wrote: Merlin Moncure [EMAIL PROTECTED] writes: Tom Lane wrote: Surely the addresses can be assumed constant within a thread. Otherwise we have a problem here too. Quoting from the MSDN: The address of a thread local object is not considered constant, and any expression

Re: [HACKERS] Threads vs Processes

2003-09-26 Thread Bruce Momjian
Tom Lane wrote: Shridhar Daithankar [EMAIL PROTECTED] writes: We really don't need threads to replace existing functionality. That would be dog work. No, that's not the point at all. The problem we are facing at the moment with the Windows port is lack of fork(), which means there's no

Re: [HACKERS] Threads vs Processes

2003-09-26 Thread Tom Lane
Bruce Momjian [EMAIL PROTECTED] 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.

Re: [HACKERS] Threads vs Processes

2003-09-26 Thread Bruce Momjian
Tom Lane wrote: Bruce Momjian [EMAIL PROTECTED] 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

Re: [HACKERS] Threads vs Processes

2003-09-26 Thread Dann Corbit
-Original Message- From: Tom Lane [mailto:[EMAIL PROTECTED] Sent: Friday, September 26, 2003 9:27 AM To: Bruce Momjian Cc: Shridhar Daithankar; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [HACKERS] Threads vs Processes Bruce Momjian [EMAIL PROTECTED] writes: One

Re: [HACKERS] Threads vs Processes

2003-09-26 Thread Christopher Kings-Lynne
We really don't need threads to replace existing functionality. That would be dog work. No, that's not the point at all. The problem we are facing at the moment with the Windows port is lack of fork(), which means there's no way for separate-subprocess backends to inherit variable values

[HACKERS] Threads vs Processes (was: NuSphere and PostgreSQL for windows)

2003-09-25 Thread Claudio Natoli
Tom Lane writes: BTW, I've been wondering lately if we'd not be better off to look at using threading in the Windows port, if it'd help us get around the fork/exec data transfer problem. I'm not sure that it would, mind you, but if it would give an answer it might be a lot less painful than

Re: [HACKERS] Threads vs Processes (was: NuSphere and PostgreSQL for windows)

2003-09-25 Thread Tom Lane
Claudio Natoli [EMAIL PROTECTED] writes: FWIW, I've got a threaded version of the WIN32_DEV branch more or less running (it is a terrible hack job, so NO, no patches... yet :-), as a proof of concept. Still a work in progress (ok, I've qualified it enough), but it is showing enough promise to

Re: [HACKERS] Threads vs Processes (was: NuSphere and PostgreSQL for window

2003-09-25 Thread Claudio Natoli
Claudio Natoli [EMAIL PROTECTED] writes: FWIW, I've got a threaded version of the WIN32_DEV branch more or less running (it is a terrible hack job, so NO, no patches... yet :-), as a proof of concept. Still a work in progress (ok, I've qualified it enough), but it is showing enough

Re: [HACKERS] Threads vs Processes (was: NuSphere and PostgreSQL for window s)

2003-09-25 Thread Tom Lane
Claudio Natoli [EMAIL PROTECTED] writes: How are you dealing with the issue of wanting some static variables to be per-thread and others not? To be perfectly honest, I'm still trying to familiarize myself with the code sufficiently well so that I can tell which variables need to be per-thread

Re: [HACKERS] Threads vs Processes

2003-09-25 Thread Shridhar Daithankar
Tom Lane wrote: Claudio Natoli [EMAIL PROTECTED] writes: How are you dealing with the issue of wanting some static variables to be per-thread and others not? To be perfectly honest, I'm still trying to familiarize myself with the code sufficiently well so that I can tell which variables need

Re: [HACKERS] Threads vs Processes (was: NuSphere and PostgreSQL

2003-09-25 Thread Manfred Spraul
Tom Lane wrote: Claudio Natoli [EMAIL PROTECTED] writes: How are you dealing with the issue of wanting some static variables to be per-thread and others not? To be perfectly honest, I'm still trying to familiarize myself with the code sufficiently well so that I can tell which

Re: [HACKERS] Threads vs Processes (was: NuSphere and PostgreSQL for windows)

2003-09-25 Thread Keith Bottner
Momjian; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [HACKERS] Threads vs Processes (was: NuSphere and PostgreSQL for windows) Claudio Natoli [EMAIL PROTECTED] writes: FWIW, I've got a threaded version of the WIN32_DEV branch more or less running (it is a terrible hack job, so

Re: [HACKERS] Threads vs Processes (was: NuSphere and PostgreSQL for

2003-09-25 Thread Bruce Momjian
Keith Bottner wrote: Typically variables that you want to be per-thread are stored in what Microsoft calls Thread Local Storage (TLS). Variables that you want shared you can just treat as globals and statics with the appropriate threading synchronization primitives. With Windows 2000 and later

Re: [HACKERS] Threads vs Processes

2003-09-25 Thread Tom Lane
Shridhar Daithankar [EMAIL PROTECTED] writes: One thing that can be done is to arrange all globals/statics in a structure and make that structure thread local. That's about as far from non-invasive as I can imagine :-( I really, really want to avoid doing anything like the above, because it

Re: [HACKERS] Threads vs Processes

2003-09-25 Thread Merlin Moncure
Both Microsoft and windows compilers support thread local storage. *If* you guys go with the threading model and *if* it does not introduce any serious portability issues with gcc (big ifs, and I'm not familiar with gcc), than IMO TLS is really the way to go. I don't think any reorganization of

Re: [HACKERS] Threads vs Processes

2003-09-25 Thread Keith Bottner
] [mailto:[EMAIL PROTECTED] On Behalf Of Merlin Moncure Sent: Thursday, September 25, 2003 2:49 PM To: Tom Lane Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]; Bruce Momjian; Shridhar Daithankar; Claudio Natoli Subject: Re: [HACKERS] Threads vs Processes Both Microsoft and windows compilers support thread

Re: [HACKERS] Threads vs Processes

2003-09-25 Thread Myron Scott
On Thursday, September 25, 2003, at 10:03 AM, Tom Lane wrote: Shridhar Daithankar [EMAIL PROTECTED] writes: One thing that can be done is to arrange all globals/statics in a structure and make that structure thread local. That's about as far from non-invasive as I can imagine :-( I really,

Re: [HACKERS] Threads vs Processes

2003-09-25 Thread Tom Lane
Merlin Moncure [EMAIL PROTECTED] writes: All TLS variables *must* be static (or implicitly static through extern, i.e. no 'auto' variables) I assume you mean static as in not-auto, rather than static as in not-global. Otherwise we have a problem here. and their addresses can not be assumed

Re: [HACKERS] Threads vs Processes

2003-09-25 Thread Kurt at DBC
Tom Lane wrote: I assume you mean static as in not-auto, rather than static as in not-global. Otherwise we have a problem here. [...] Surely the addresses can be assumed constant within a thread. Otherwise we have a problem here too. [...] Taking addresses of TLS variables should be considered

Re: [HACKERS] Threads vs Processes

2003-09-25 Thread Claudio Natoli
Another option would be to create thread local hashtable or other lookup structure to which you would register a structure for a particular .c file or group of files. You could then define the structures you need locally without affecting other parts of the codebase. Myron Scott

Re: [HACKERS] Threads vs processes - The Apache Way (Re: Path to PostgreSQL

2002-05-10 Thread mlw
Robert wrote: Hi, Win32 threads support are both going to be a lot of work and maybe we'll need in the future one or both - is there any chance Postgres developers look at the Apache experience? Briefly, Apache 2 had the some problems as are discussed here (need to support Win,

Re: [HACKERS] Threads vs processes - The Apache Way (Re: Path to PostgreSQL

2002-05-10 Thread Tom Lane
mlw [EMAIL PROTECTED] writes: Without some buy-in from the core team, I'm not sure I am willing to spend my time on it. If someone would be willing to fund the 100 or so man-hours required to do it, then that would be a different story. You are not going to get any buy-in with such ridiculous

Re: [HACKERS] Threads vs processes - The Apache Way (Re: Path to PostgreSQL

2002-05-10 Thread mlw
Tom Lane wrote: mlw [EMAIL PROTECTED] writes: Without some buy-in from the core team, I'm not sure I am willing to spend my time on it. If someone would be willing to fund the 100 or so man-hours required to do it, then that would be a different story. You are not going to get any