Next: 18.3 POSIX Threads Reference
Up: 18 POSIX Threads: liboskit_threads.a
Previous: 18.1 Introduction
The sample kernels in the examples/threads directory (see Section
1.6.1), contain several sample kernels demonstrating the
use of the POSIX threads module.
- dphils:
A computational example that tests basic POSIX threads
operations such as thread creation, mutexes, and conditions.
Solves the classic Dining Philosophers problem.
- disktest:
A contrived disk thrashing program that tests the interaction
between POSIX threads and the NetBSD filesystem (see section
25). A number of threads are created, where each one
creates and copies files in varying block sizes.
- disknet:
Another contrived program that builds on the disk thrashing program
above. Also tested is the interaction bewteen POSIX threads and
the BSD network interface. Half of the threads created thrash the
disk and the other half connect to a server process and send and
receive data blocks. This program achieves reasonable interleaving
of work.
- http_proxy:
A simplified HTTP proxy daemon that tests the interaction between
POSIX threads and the BSD network interface. For each new
connection request, three threads are created to manage that
connection and forward data between the client and the server.
This small set of test programs clearly does not test every possible
combination of components. A larger set of test program is in the works. In
addition, not all of the thread-safe adaptors are implemented, so some
components cannot be used in a multithreaded environment. For now, the
POSIX threads module should be used with caution. Note that these
examples are compiled and linked against the multithreaded version of the
FreeBSD C library (see Section 13), rather than the minimal
C library (Section 9).
University of Utah Flux Research Group