Re: Threads vs Processes - Mailing list pgsql-hackers

From Shridhar Daithankar
Subject Re: Threads vs Processes
Date
Msg-id 200309262028.00180.shridhar_daithankar@persistent.co.in
Whole thread Raw
In response to Re: Threads vs Processes  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Friday 26 September 2003 20:19, Tom Lane wrote:
> Shridhar Daithankar <shridhar_daithankar@persistent.co.in> 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 separate-subprocess backends to inherit variable values
> from the postmaster.  Bruce has been trying to fix that by having the
> subprocesses somehow reload or re-deduce all those variables; which
> is messy, bug-prone, and probably race-condition-prone too.  In a
> threaded implementation it would maybe be relatively easy to initialize
> a new thread's TLS by copying the postmaster thread's TLS, in which case
> a whole pile of as-yet-unwritten Windows-only code won't be needed.

Umm.. I understand child process created by createProcess does not inherit
variable values from parent process. That's where problem originates..

We can simply create a registry key that would contain shared memory id from
where a child process should get the variable values.

And that would need initialization function I talked about earlier.  And since
anyways TLS->TLS copy is still needed anyways, I think this approach can
still save us dealing with threads.

God.. it doesn't get any less messy..I hope this is of some value..

 Shridhar


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [ADMIN] postgres 6.2 vacuum
Next
From: Tom Lane
Date:
Subject: initdb failure (was Re: [GENERAL] sequence's plpgsql)