GNU Pth support

Werner Koch wk at gnupg.org
Fri Aug 10 12:45:56 CEST 2007


On Fri, 10 Aug 2007 03:44, andrewbass at gmail.com said:

> Is there any advantage building GPG with GNU Pth support?

You can't build gpg with Pth support.  The GnuPG-2 package however
requires Pth for several modules (gpg-agent, scdaemon).  Expect more
modules to take advantage of this.  It is required because these modules
are running as a server and thus need to be able to handle multiple
requests.

> Is it true that without Pth, GPG will operate in a single-threaded mode?
> (Seems so for me after looking into code, but I may be mistaken.)

Why should it need to be multi-threaded if it does not act as a server?

> Why doesn't GPG have support for the standard POSIX threads (if host OS 
> does support pthreads)?

For security reasons.  Getting multi-threaded programs right is a tough
job.  You can easily find bugs in the majority of multi-threaded
applications (unless the threads don't need to interact with each
other).

Pth mitigates the problem as it is a userland thread implementation with
well defined preemption points (i.e. system calls).  For auditing
purposes it is better to implement servers using such a userland thread
model than for example an event/continuation based model.


Shalom-Salam,

   Werner





More information about the Gnupg-devel mailing list