If you want to make an apple pie from scratch, you must first create the universe.
- Carl Sagan

Cogs is a highly-parallel, lock-free, cross-platform, C++ template class library and application framework developed by Colen M. Garoutte-Carson.

Cogs is my own codebase that I have been developing as a process of self-education, research, and a creative outlet, for the past 15+ years. Having been involved in a number of projects professionally in which code was not reused, and finding myself having to write generally the same types of things repeatedly, I decided to try to 'keep my code alive' in a project that captures my best practices and known-good solutions. It has evolved to also capture certain purist design goals.

Guiding Design Principles

C++, Templates

C++ is a compiled, native language, which (arguably) means better runtime performance. C++ templates facilitate reusability/genericness. Template meta-programming allows some computational work to be accomplished at compile time. Inline template code provides the compiler with good opportunity for optimization. C++ is also supported across the vast majority of platforms, and is not controlled by a platform vendor.

Cogs is not yet updated to C++11, and includes some functionality similar to what is now standard in C++11.

Parallel, Lock-Free, Asynchronous

Performance, Performance, Performance.

Even in a single-threaded system, asynchronousity can improve performance. Using asynchronous file IO calls, for example, can free up the UI thread to process user input more responsively.

Even in a single-core multi-threaded system, lock-free algorithms can improve performance, by avoiding thread scheduling overhead such as kernel mode transitions when stalling threads.

Traditional software development methodologies are rooted in imperitive programming languages and single-threaded thinking. In a multi-threaded system, thread synchronization such as mutexes or critical sections are used to block out a portion of code to be treated as single-threaded. Under heavy thread contention, this could effectively reduce a multi-core system to a single core. In a future of "Many" core processors (or super computers today), that approach could become be a significant bottleneck. Various "new paradigm" methodologies have been proposed to better take advantage of parallel processing. Cogs approach is to build parallelism, lock-freedom, thread-safety, atomicity, and asynchronousity, as the primary interfaces to standard objects and algorithms, from the ground up. Parallelism is assumed.

Cogs API Documentation

API Documentation generated with Doxygen can be found here. I'm currently in the process of writing documenation, and so far very little is online.


This project is available under the GPL, for non-commercial purposes. For commercial licensing, please contact me.


Send to: