Skip to content

rax85/LinuxPthreadExtensions

Repository files navigation

=========================
Linux PThread Extensions.
=========================

This library provides some functionality that I thought would be a nice
addition to the stock pthread library. 

I. NEWS!
    - Nov 18 2011 : Wow, it's been a while. Added hooks to pin and unpin pools in RAM
      to prevent it from getting swapped out when the machine is low on memory. This has
      both advantages and disadvantages, so be careful with it.
    - Jan 23 2011 : Updates after a long break. Added the capability to create memory 
      pools inside of already allocated memory blocks. Fixed up the makefile so to 
      enable running the tests using gcov.

    - Aug 12 2010 : Implemented a producer consumer style queue with both blocking and 
      timed versions of the enqueue and dequeue operations.

    - Aug 09 2010 : The big refactoring! I've changed all the external interfaces into the
      library to use underscore naming style instead of camel case consistently. I have no
      particular bias towards either, the internal stuff still uses camel case. Earlier it 
      was a big mess of both conventtions so I just wanted to make it consistent once now 
      so that when I use it elsewhere, the refactoring exercise will be a lot less painful.
      Needless to say, all the tests still pass with 0 memory leaks.

    - Aug 08 2010 : Ran the test code under valgrind to check for memory leaks. As of now, 
      valgrind does not report any memory leaks.

II. This is a list of currently available and planned functionality:
    1. Thread Pools.
        - Fixed sized thread pools are minimally tested.
        - Variable sized thread pools are minimally tested.
        - Group execution of threads. Same callback, multiple threads [Planned].
        - Barriers are implemented and minimally tested.
    
    2. Semaphores.
        - The blocking semaphore is implemented and minimally tested. This is
          built entirely using pthread routines and not posix semaphores.
        - Timed semaphores are implemented and minimally tested.
    
    3. Memory pools
        - Memory pools with support for fixed sized allocation are implemented and minimally tested.
        - Memory pools with support for variable sized allocation is now coded and minimally tested.
        - Memory pools can be created from blocks of memory or directly, where they the
          create methods internally call malloc.
        - Memory pools can be pinned in RAM if desired.

    4. Producer Consumer Queue.
        - A general purpose queue that can be used in producer consumer situations is now
         implemented and minimally tested. The timed enqueue and dequeue probably need some work
         to be more accurate about timeouts.

    5. Reader Writer Locks

    6. Treemap

    7. Arraylist

III. Building.
    - 'make' builds the library.
    - The default build has debug symbols on. You might want to switch that off before
      doing anything serious. To build without debug symbols, remove the '-g' flag from
      COPTS in the Makefile. 
    - 'make documentation' builds doxygen documentation. You need doxygen for this
      target to build.
    - 'make test' builds test.out a binary that runs a few simple tests.

IV. Linking notes.
    - While linking against your program, be sure to also link against -lpthread and -lrt

Keep checking back for developments!

About

Contains a set of extensions that I thought that might be useful while coding with pthreads. Semaphores & Thread Pools for example.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages