Skip to content

chetasborse/CthreAd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


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

About

A multithreading library implemented in C

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published