Code Monkey home page Code Monkey logo

computer-room-access-management's Introduction

Computer Room Access Management

Description

A computer room contains 20 computers numbered from 1 to 20. The users who can access the room are as follows:

  • Professors: they need to occupy the entire room.
  • Thesis Students: they have their data saved on a specific computer $i$ and can only use that computer.
  • Regular Students: they occupy a randomly selected computer.

Furthermore, in case there are multiple users who want to enter the room, the priority is as follows: Professors > Thesis Students > Regular Students.

Implementation

The program is implemented in Java. A PriorityBlockingQueue is used to manage the queue of users waiting to enter the room. This queue is filled by a thread that generates random users and adds them to the queue. Another thread is responsible for removing users from the queue and creating another thread to execute them. In the created threads, it is determined which type of user it is and access to the room is granted along with the relevant action. The computers in the room are implemented as an array of booleans, where true indicates that the computer is free, and false indicates that it is occupied. The room is managed by a monitor that synchronizes access to the room to avoid resource conflicts. The program terminates when a user of type UtenteTerm is recognized, which triggers the program to exit.

computer-room-access-management's People

Contributors

lorenzobandini avatar

Watchers

 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.