1 ____ _ _ 2 | _ \| |_| |__ 3 | |_) | __| '_ \ ``Only those who attempt 4 | __/| |_| | | | the absurd can achieve 5 |_| \__|_| |_| the impossible.'' 6 7 GNU Pth - The GNU Portable Threads 8 Version 2.0 9 10 Pth is a very portable POSIX/ANSI-C based library for Unix platforms 11 which provides non-preemptive priority-based scheduling for multiple 12 threads of execution (aka "multi-threading") inside event-driven 13 applications. All threads run in the same address space of the server 14 application, but each thread has its own individual program-counter, 15 run-time stack, signal mask and errno variable. 16 17 The thread scheduling itself is done in a cooperative way, i.e., the 18 threads are managed and dispatched by a priority- and event-driven 19 non-preemptive scheduler. The intention is that this way both better 20 portability and run-time performance is achieved than with preemptive 21 scheduling. The event facility allows threads to wait until various 22 types of internal and external events occur, including pending I/O on 23 file descriptors, asynchronous signals, elapsed timers, pending I/O 24 on message ports, thread and process termination, and even results of 25 customized callback functions. 26 27 Pth also provides an optional emulation API for POSIX.1c threads 28 ("Pthreads") which can be used for backward compatibility to existing 29 multi-threaded applications. 30 31 NEW IN PTH 2.0 32 33 Pth 2.0 provides more strict POSIX.1-2001/SUSv3 compliant wrapper 34 functions in its high-level I/O API. Most notable, the implementations 35 of pth_poll(3) and pth_select(3) were completely worked off in order 36 to achieve POSIX semantics. A Pth variant of the new POSIX pselect(2) 37 function was introduced, too. 38 39 Pth now has support for arbitrary (usually higher than the default) 40 FD_SETSIZE values to support larger-scale server applications. 41 42 A new environment attribute PTH_ATTR_DISPATCHES allows the application 43 to query the total number of machine context dispatches Pth performed 44 since the last attribute reset. 45 46 Pth's internal machine context implementation is now exported in a 47 sub-API pth_uctx in order to allow applications to use raw user-space 48 context switching. This can be used to implement co-routines, 49 exception handling or even an alternative multi-threading environment 50 with the help of Pth. 51 52 The "hard syscall mapping" functionality was completely rewritten 53 from scratch. Previously, the internal system call exit points were 54 based on syscall(2) only. This was problematic because it by-passed 55 the C library glue code which often performs necessary glue code in 56 order to call the code in the kernel correctly. Now the internal exit 57 points are based on a by-system-call dynamically selected combination 58 of RTLD_NEXT+dlsym(2), dlopen(2)+dlsym(2) and the known syscall(2) (in 59 this fallback order). This way the "hard syscall mapping" became a lot 60 more portable and flexible. 61 62 Optional support for OSSP ex based exception handling was added which 63 allows ISO C applications to use fully multi-threading aware ISO C++ 64 style exception handling. 65 66 Finally, the Pth build environment was upgraded to be now based on GNU 67 autoconf 2.57, GNU shtool 1.6.2 and GNU libtool 1.4.3. 68 69 MORE INFORMATION 70 71 More details about Pth can be found at the following locations from 72 the GNU and OSSP projects: 73 74 o GNU: http://www.gnu.org/software/pth/ 75 o GNU: ftp://ftp.gnu.org/gnu/pth/ 76 o OSSP: http://www.ossp.org/pkg/lib/pth/ 77 o OSSP: ftp://ftp.ossp.org/pkg/lib/pth/ 78 79 Ralf S. Engelschall 80 rse@engelschall.com 81 www.engelschall.com 82 83