POSIX Thread Test

 www.partow.net  .: Home :.   .: Links :.   .: Search :.   .: Contact :. 



The Aim Of ThreadTest

ThreadTest was written to demonstrate bugs and inconsistent POSIX behavior that the Cygwin emulation layer was displaying with regards to basic pthreads interface. ThreadTest is written using pure C++ and fully POSIX compliant code, hence can be easily compiled and run on any system that fully supports POSIX.

What Does ThreadTest Do?

As far as any functionality is concerned ThreadTest really does nothing useful. All it does is a series of stress tests, which are intended to break the Threading system of the OS or VM its run on. It does this by creating several hundred threads, each doing a simple task of tokenizing a string into its tokens and then getting the reverse and palindrome of each string. Once the tokenization of the string is complete the thread will out-put to the stdout that it has completed its task. A garbage collection thread cleans up the completed thread and then creates a new thread to do exactly the same thing as the completed Thread. This cycle will continue until the user SIG-INT or the set number of threads to be created is reached.

It is during this cycle that one may observe behavior that is non-compliant to POSIX from the OS's threading infrastructure. The ThreadTest may crash, or may slow down, it may not respond to SIG-INT or a variety of other problems such as zombie threads, accumalating thread handles, memory leaks etc...

What Does ThreadTest Test?

ThreadTest tests the following pthread and system functionality:

  • Stack expansion and stack unwinding
  • Detaching and joining of threads
  • Mutexes and thread-safety of stdio
  • Signal handlers

From external inspection of the ThreadTest one may see:

  • Zombie threads
  • Memory leaks
  • Unexpected over-all system latency
  • Thread handle accumulation

ThreadTest Platforms

ThreadTest has successfully been run and tested the POSIX threading capabilities of the following operating system platforms:

  • OpenBSD 3.5

  • NetBSD(1.62 and 2.0)

  • FreeBSD

  • WasabiBSD

  • Solaris 9.0

  • Linux (kernel 2.6+)

  • Win32 (Cygwin - dll version 1.5+)


Future Directions

I plan to create a series of other threading oriented tests which will combine, sockets, pipes, message queues, shared memory and file IO.


POSIX ThreadTest License

Free use of the POSIX ThreadTest is permitted under the guidelines and in accordance with the most current version of the "Common Public License."


Compatability

The POSIX ThreadTest C++ implementation is compatible with the following C++ compiler:

  • GNU Compiler Collection (3.3.1-x+)
  • Intel® C++ Compiler (8.x+)

Download




Copyright Arash Partow