Coder Social home page Coder Social logo

yxu1183 / concurrency Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 1.0 193 KB

Parallel Programming (can handle up to 50 threads simultaneously) to help professor schedule his office hours for two different classes.

C 100.00%
threads professor-schedule office-hours parallel-programming

concurrency's Introduction

Concurrency

Operating System/Assignment-2: Created by Dr. Trevor Bakker

Descirption

Parallel Programming to help professor schedule his office hours for two different classes- class A and B.

Funtionality

  • Use of multiple threads and parallel programming to impose several restrictions in office hours.
  • No more than 3 students are allowed to simultaneously enter the professor's office.
  • If students from class A are in the office, no students from class B are allowed to enter, and the other way around.
  • Professor takes break after helping 10 students in a row.
  • Professor will answer questions to atmost 5 consecutive students from a single class.
  • If there is no student in the office and professor is not taking break, students should not be forced to wait.
  • Code should not deadlock.
  • Total students arriving to the office is read in from the file with three columns.
  • First column is the number specifying whether the student is from class A(1) or B(2).
  • Second column is the time between the arrival of a student and the previous student.
  • Third column is the number of seconds student spends time with professor asking questions.

Things I learned

  • Handling multiple threads in an effective way.
  • Correct use and placement of mutex.
  • Locking and unlocking the threads as per given conditions.

Compilation Instructions

The application is built in an omega server at UTA. In terminal:

gcc officehours.c -o officehours -lpthread
officehours sample.txt

Acknowledgements

concurrency's People

Contributors

yxu1183 avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

suman2020

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.