Code Monkey home page Code Monkey logo

sleeping_teaching_assistant-project's Introduction

Sleeping Teaching Assistant

A Classical Inter-process Communication and Synchronization problem in Operating Systems

From the description of the problem we implement two threads -

  1. studentsThread() - which can either get tutored or will leave the office if there is no free chair
  2. teachingAssistantThread() - which can either tutor students or go to sleep

The TA has three actions. To check for a student, sleep if no one's waiting and wake up when a student arrives, we run a wait() operation on the student semaphore. When a student arrives, the TA starts tutoring her, and then there is one less student in the waiting room. After the tutoring, the TA checks for a student and the cycle repeats.

The student also has three actions but, unlike the TA, the student only performs her actions once. When a student arrives, she checks to see if there's a chair available in the waiting room. If there isn't, the student leaves. Otherwise the student waits, and the number of students in the waiting room increases. To wake up the sleeping TA, the student runs an post() on the students semaphore, and then a wait() on the TA semaphore, waiting to be tutored. The modification of the number of chairs is protected using mutex lock and unlock mechanisms.

sleeping_teaching_assistant-project's People

Contributors

tusharkailash avatar

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.