Skip to content

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

Notifications You must be signed in to change notification settings

yxu1183/Concurrency

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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

About

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

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages