Git Product home page Git Product logo

threadlibforc's Introduction

ThreadLibForC

Warning: Your implementation would be very specific to the underlying hardware. You are required to comply with x86_64

Getting started:

Have a look at the main.c file. In that you have two blocks of code, enabled based on whether or not you have set the TESTING mode or not. It is recommended that you start work in the TESTING mode once you have done the development, undefine the TESTING flag and make sure the other block of code works. When marking your submissions we will run the same main file with the TESTING flag undefined.

Background:

You will be implementing user-level, cooperating threads. Where user-level means that kernel does not know that there exists more than one thread; so these threads will not be running in parallel even if you have multiple CPUs which can accommodate multiple threads at a time. The threads will be cooperating by releasing the CPU voluntarily. They do this by calling the yield() function. So we make use of this yield() function to implement the illusion of multiple parallel threads. For a C-function, something called the calling convention defines who to pass arguments, how to get the results and what registers are preserved and what registers can be changed. This calling convention is defined for a language and architecture pair; for example C-calling convention in x86_64 is different to C-calling convention in ARM. For this lab, we will test your code on x86_64 so make sure you test and develop on ``x86_64``.

If the calling convention is preserved, the calling function does not care if another thread ran before yield() return. It will see as if yield() function returned, but after a long time.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.