Code Monkey home page Code Monkey logo

422s_project3b's Introduction

Partners

  1. David Ayeke
  2. Edwin Munguia
  3. Joseph Woodson

Project 3B: XV6 Threading

Code Explanation

Following with what fork() and wait() do, clone() and join() make use of most of that architecture to create a threadable function that makes use of XV6's lock system.

#clone() Located in proc.c, clone() will direct the thread to point to the user stack, receive the fcn to the appropriate register and pass the arguments of that fcn as well. The PC is also given a fake address of 0xFFFFFFFF. It finally sets the state of that thread's PID to RUNNABLE while using the acquire() and release() lock functions.

#join() Located in proc.c, join() mimics wait(), while making sure that the thread will release itself and kill the process.

#Thread Library The threadLibrary was built in ulib.c. thread_create(), thread_join() make use of the system calls clone() and join(). thread_create creates a new user stack, and supplies it to the clone() function. There is a struct of threadTable array that stores all the threads we create. As the join() begins, the threads are removed from the array.

#Test assets The MAKEFILE was modified to add two test assets: testUserCalls.c and testThreadLib.c.

testUserCalls will directly test clone() and join() system calls by simply keeping a volatile global counter that should be incremented by '1' by our fcn addToCounter(). It will create 10 threads, and then join them.

testThreadLib will make use of the threadLibrary built in ulib.c and add the value of our counter to itself 10 times through a for loop.

#Qemu: Compiling yields no errors or warnings. The following XV6 files were modified:

  1. MAKEFILE

  2. defs.h

  3. user.h

  4. ulib.c

  5. usys.S

  6. syscall.h

  7. syscall.c

  8. sysproc.c

  9. proc.c

  10. proc.h

  11. testUserCalls.c

  12. testThreadLib.c

422s_project3b's People

Contributors

daiokaio avatar

Watchers

 avatar

Forkers

rjsdn1120

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.