Skip site navigation (1) Skip section navigation (2)

Re: Using Threads?

From: The Hermit Hacker <scrappy(at)hub(dot)org>
To: "Ross J(dot) Reedstrom" <reedstrm(at)rice(dot)edu>
Cc: Myron Scott <mscott(at)sacadia(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Using Threads?
Date: 2000-12-04 18:59:52
Message-ID: Pine.BSF.4.21.0012041458220.1558-100000@thelab.hub.org (view raw or flat)
Thread:
Lists: pgsql-hackers
if we were to do this in steps, I beliee that one of the major problems
irght now is that we have global variables up the wazoo ... my
'thread-awareness' is limited, as I've yet to use them, so excuse my
ignorance ... if we got patches that cleaned up the code in stages, moving
towards a cleaner code base, then we could get it into the main source
tree ... ?

 On Mon, 4 Dec 2000, Ross J. Reedstrom wrote:

> Myron - 
> Putting aside the fork/threads discussion for a moment (the reasons,
> both historical and other, such as inter-backend protection, are well
> covered in the archives), the work you did sounds like an interesting
> experiment in code redesign. Would you be willing to release the hacked
> code somewhere for others to learn from? Hacking flex to generate
> thread-safe code is of itself interesting, and the question about PG and
> threads comes up so often, that an example of why it's not a simple task
> would be useful.
> 
> Ross
> 
> On Mon, Dec 04, 2000 at 12:20:20AM -0800, Myron Scott wrote:
> > I maybe wrong but I think that PGSQL is not threaded mostly due to
> > historical reasons.  It looks to me like the source has developed over
> > time where much of the source is not reentrant with many global variables
> > throughout.  In addition, the parser is generated by flex which
> > can be made to generate reentrant code but is still not thread safe b/c
> > global variables are used.
> > 
> > That being said, I experimented with the 7.0.2 source and came up with a
> > multithreaded backend for PGSQL which uses Solaris Threads. It seems to
> > work, but I drifted very far from the original source.  I
> > had to hack flex to generate threadsafe code as well.  I use it as a
> > linked library with my own fe<->be protocol. This ended up being much much
> > more than I bargained for and looking back would probably not have tried
> > had I known any better.
> > 
> > 
> > Myron Scott
> > 
> 

Marc G. Fournier                   ICQ#7615664               IRC Nick: Scrappy
Systems Administrator @ hub.org 
primary: scrappy(at)hub(dot)org           secondary: scrappy(at){freebsd|postgresql}.org 


In response to

pgsql-hackers by date

Next:From: Jan WieckDate: 2000-12-04 19:04:51
Subject: Re: [SQL] Rules with Conditions: Bug, or Misunderstanding
Previous:From: Thomas LockhartDate: 2000-12-04 18:09:28
Subject: Re: redundancy and disk i/o

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group