ndato.com
Menu
Links
libtuberia
Created: 2025-08-16

This project is also available at Savannah: https://savannah.nongnu.org/projects/libtuberia/.

About libtuberia

libtuberia is a library in C to implement a pipeline.

A pipeline would be:

[Source] -> [queue_1] -> [Stage_1] -> [Queue_2] -> [Stage_2] -> [...] -> [Sink]

Each source, stage, and sink runs in a thread, reads from its input queue, processes the element, and write the result to the output queue.

Motivation

A few years ago I learned about the pipeline in the CPU, and superscalar processors. Including interesting topics like Tomasulo's algorithm. I thought it was a good idea to do something similar in software.

When to use libtuberia

You can benefit from this library when you have a several tasks than can run in parallel (or 1 task that you can split), and the output of one task is the input of the next task.

Instead of running them sequentially, you can run them in parallel with libtuberia. This way, as long as there are elements to be processed, all tasks will be running in parallel without waiting. While the second stage (task) of the pipeline is working on some input, the first stage can work on the next input. If this were done sequentially, the next item would have to wait until the previous item finishes the whole process.

With libtuberia you don't have to worry about threads nor queues, libtuberia does it for you.

Get it

v0.1.0

Git

How to use libtuberia

Documentation

You can read a quick guide in the "about" page of my git, which is the README.md file. There you will find how to compile it, and a quick guide.

Also, the tuberia.h file has every structure and function documented.

And finally, if you had Doxygen when installing libtuberia, a man page tuberia.h is also installed (you can read it with man tuberia.h) and a .html is installed in /usr/doc/libtuberia/doxygen_html/index.html

Examples

There are two examples:

Both examples are installed in /usr/doc/libtuberia/example/

Bugs

You can submit bugs at Savannah: https://savannah.nongnu.org/projects/libtuberia/.

Future work

  • Implement more complex pipelines
    • A stage can choose the next stage
    • More than one thread per stage