A multithreading library implemented in C


CthreAd

A multi-threading library for C Programs

Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Usage
  3. Testing
  4. Contributing
  5. Acknowledgements
  6. Authors

About The Project

CthreAd is a multi-threading library which implements POSIX compliant threads in the Linux userland. Primarily, we have implemented two models of multi-threading:

  • One-One

    One-One model of multi-threading maps each user-level thread with a kernel-level thread. All the threads can access the kernel at the same time. Even if a thread makes a blocking system call (i/o, etc.), other threads can continue to run.

    one-one

  • Many-One

    The many to one model maps many of the user threads to a single kernel thread. This model is quite efficient as the user space manages the thread management. The library performs the context-switch and scheduling operations.

    many-one

Usage

To use CthreAd in your projects:

  • Clone the repository using
    $ git clone https://gitlab.com/andipro123/cthread.git
  • Move to the directory and choose the model you want to implement
    # for one-one
    $ cd cthread/one-one
    
    # for many-one
    $ cd cthread/many-one
  • Compile the library
    $ gcc cthread.c -c -Wall
    
    #for many-one, use "cthread2.c"
  • Include the header file in your project
    // Your C program
    
    #include<cthread.h>
    .
    .
    .
  • Compile your project using
    $ gcc <your-project.c> cthread.o - o <your-project>
    
    #for many-one, use "cthread2.o"

Testing

The library comes with an automatic testing package to test all the functionalities of the threading library. Tests cover all areas of multi-threading to ensure that basic functions are working as expected. To run the tests:

$ make run

Contributing

This library is not a production level multi-threading library yet. Please use caution while using it in your production softwares. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

References

Authors

Owner
Chetas Borse
Just getting started
Chetas Borse
Similar Resources

A C++ library of Concurrent Data Structures

CDS C++ library The Concurrent Data Structures (CDS) library is a collection of concurrent containers that don't require external (manual) synchroniza

Jan 3, 2023

OpenCL based GPU accelerated SPH fluid simulation library

libclsph An OpenCL based GPU accelerated SPH fluid simulation library Can I see it in action? Demo #1 Demo #2 Why? Libclsph was created to explore the

Jul 27, 2022

A header-only C++ library for task concurrency

A header-only C++ library for task concurrency

transwarp Doxygen documentation transwarp is a header-only C++ library for task concurrency. It allows you to easily create a graph of tasks where eve

Dec 19, 2022

VexCL is a C++ vector expression template library for OpenCL/CUDA/OpenMP

VexCL VexCL is a vector expression template library for OpenCL/CUDA. It has been created for ease of GPGPU development with C++. VexCL strives to redu

Nov 27, 2022

:copyright: Concurrent Programming Library (Coroutine) for C11

libconcurrent tiny asymmetric-coroutine library. Description asymmetric-coroutine bidirectional communication by yield_value/resume_value native conte

Sep 2, 2022

Simple and fast C library implementing a thread-safe API to manage hash-tables, linked lists, lock-free ring buffers and queues

libhl C library implementing a set of APIs to efficiently manage some basic data structures such as : hashtables, linked lists, queues, trees, ringbuf

Dec 3, 2022

An optimized C library for math, parallel processing and data movement

PAL: The Parallel Architectures Library The Parallel Architectures Library (PAL) is a compact C library with optimized routines for math, synchronizat

Dec 11, 2022

Single header asymmetric stackful cross-platform coroutine library in pure C.

Single header asymmetric stackful cross-platform coroutine library in pure C.

minicoro Minicoro is single-file library for using asymmetric coroutines in C. The API is inspired by Lua coroutines but with C use in mind. The proje

Dec 29, 2022

C++20's jthread for C++11 and later in a single-file header-only library

C++20's jthread for C++11 and later in a single-file header-only library

jthread lite: C++20's jthread for C++11 and later A work in its infancy. Suggested by Peter Featherstone. Contents Example usage In a nutshell License

Dec 8, 2022
🧵 Fast and easy multithreading for React Native using JSI
🧵 Fast and easy multithreading for React Native using JSI

react-native-multithreading ?? Fast and easy multithreading for React Native using JSI. Installation npm install react-native-multithreading npx pod-i

Dec 31, 2022
Parallel algorithms (quick-sort, merge-sort , enumeration-sort) implemented by p-threads and CUDA

程序运行方式 一、编译程序,进入sort-project(cuda-sort-project),输入命令行 make 程序即可自动编译为可以执行文件sort(cudaSort)。 二、运行可执行程序,输入命令行 ./sort 或 ./cudaSort 三、删除程序 make clean 四、指定线程

May 30, 2022
Rpmalloc - Public domain cross platform lock free thread caching 16-byte aligned memory allocator implemented in C
Rpmalloc - Public domain cross platform lock free thread caching 16-byte aligned memory allocator implemented in C

rpmalloc - General Purpose Memory Allocator This library provides a public domain cross platform lock free thread caching 16-byte aligned memory alloc

Jan 5, 2023
Bolt is a C++ template library optimized for GPUs. Bolt provides high-performance library implementations for common algorithms such as scan, reduce, transform, and sort.

Bolt is a C++ template library optimized for heterogeneous computing. Bolt is designed to provide high-performance library implementations for common

Dec 27, 2022
oneAPI DPC++ Library (oneDPL) https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/dpc-library.html

oneAPI DPC++ Library (oneDPL) The oneAPI DPC++ Library (oneDPL) aims to work with the oneAPI DPC++ Compiler to provide high-productivity APIs to devel

Dec 29, 2022
ArrayFire: a general purpose GPU library.
ArrayFire: a general purpose GPU library.

ArrayFire is a general-purpose library that simplifies the process of developing software that targets parallel and massively-parallel architectures i

Dec 27, 2022
A C++ GPU Computing Library for OpenCL

Boost.Compute Boost.Compute is a GPU/parallel-computing library for C++ based on OpenCL. The core library is a thin C++ wrapper over the OpenCL API an

Jan 5, 2023
C++React: A reactive programming library for C++11.

C++React is reactive programming library for C++14. It enables the declarative definition of data dependencies between state and event flows. Based on

Dec 22, 2022
A library for enabling task-based multi-threading. It allows execution of task graphs with arbitrary dependencies.

Fiber Tasking Lib This is a library for enabling task-based multi-threading. It allows execution of task graphs with arbitrary dependencies. Dependenc

Dec 30, 2022
The C++ Standard Library for Parallelism and Concurrency

Documentation: latest, development (master) HPX HPX is a C++ Standard Library for Concurrency and Parallelism. It implements all of the corresponding

Jan 3, 2023