[Yazlist] Threads versus Proceses

Adam Dickmeiss adam at indexdata.dk
Fri Oct 5 18:05:32 CEST 2001


Rondon,

I've uploaded a version of YAZ that supports both POSIX threads and GNU
threads. To enable GNU threads, AKA pth, use the following configure:

  ./configure --enable-pth <other options>

Note that --enable-threads enables POSIX threads - not GNU threads
(perhaps that option should be renamed to --enable-pthreads). I added a
new option so that YAZ programmers can select which threads to use for
systems that supports both.

GNU threads were a little bit tricker to support than I thought initially.
This is due to the fact that GNU threads are non-preemptive which means
that it is up to the application to force a thread switch (like WIN16).
For networked I/O that works, but it means that the applications on every
blocking call should use a special form of call (say read or write) instead
the one provided by the C library. The only place where the YAZ frontend
server blocks is when it calls select(2), since all calls to read / write
are non-blocking. So when I called the GNU thread wrapper of select
(pth_select) it worked.

This doesn't mean that your application works as well as you thought it
would. In particular if your backend thread is not prepared to let other
threads get CPU time, it means that the whole YAZ server will block as long
as your backend is busy.. In short, it operates as it would in static mode
(option -S for the YAZ server). Read the man page for GNU threads
carefully - man pth on my GNU Debian system.

BTW: what UNIX system are you using? Most systems these days support
POSIX threads.

We haven't updated Zebra to support this yet. 

Cheers,
  Adam

On Wed, Oct 03, 2001 at 06:42:51PM -0300, Rondon Andrade wrote:
> Thank you!! Adam.
> 
> We're gonna be waiting for your feedback ok.
> 
> Thanks in advance.
> 
> Rondon.
> 
> Ps.: As I'm using also Zebra, would it be incorporated inside the package?
> 
> ----- Original Message -----
> From: "Adam Dickmeiss" <adam at indexdata.dk>
> To: "Jason MacDonald" <jasonm at compusult.nf.ca>
> Cc: "Rondon Andrade" <rondon.andrade at uol.com.br>; <yazlist at indexdata.dk>
> Sent: Wednesday, October 03, 2001 2:14 PM
> Subject: Re: [Yazlist] Threads versus Proceses
> 
> 
> > On Wed, Oct 03, 2001 at 10:39:13AM -0230, Jason MacDonald wrote:
> > > Hi,
> > >     I have downloaded and compiled the pthreads library from GNU as you
> > > mentioned and then I linked the library (libpth.a) into my program but I
> > > still get the same message "Threaded mode not available". I compiled YAZ
> > > using ./configure --enable-threads
> >
> > YAZ supports POSIX - not GNU threads. Some systems may support both GNU
> > threads and POSIX threads, however. We'll be happy to add support for
> > GNU threads. I expect it to be easy to make - especially when reading
> > this on http://www.gnu.org/software/pth/ :

[snip]

-- 
Adam Dickmeiss  mailto:adam at indexdata.dk  http://www.indexdata.dk
Index Data      T: +45 33410100           Mob.: 212 212 66



More information about the Yazlist mailing list