CMSC132 Summer 2018

Project: Concurrency Project

Due Date: July 27, 2018 11:59PM
Assignment Type: Closed (See Policy)

Multithreading

This project consists of simulating the movements of office workers in an office building. Each worker implements Runnable and will be managed by a single thread. Throughout the day, the worker must attend several meetings that occur on different floors of the building. To travel to different floors, the worker must take an elevator. Every time a worker boards, or exits an elevator, a message must be generated and sent to the Logger class. A message must also be generated whenever an Elevator changes direction. This Logger is what we will be using to check the output of your program so it is important that it is correct. Due to the nature of concurrency, the exact order that output is added to the logger is not important. What is important is that output is added in a possible order. How efficient your elevators is not really that important, but you should make sure that each worker is able to visit all of their meetings that day.

 

Getting Started

LogMsg

The output of your program is checked through a series of Log Messages. You're program must generate a valid series of log messages in order to pass the tests. There are four different types of Log Messages.

Worker

The majority of the work you need to do for this project is in the run method for the Worker class. Each worker needs to go to every meeting in their schedule. Each worker has an array of Elevator's that they can use to move between floors. These elevators are shared between multiple workers so operations performed on an elevator will need to be synchronized. To do this, each worker will search for an elevator and call that Elevator's move method, causing it to move to the worker's current floor. When a worker gets on the elevator, the worker must queue which floor their meeting is on. Note: it is not necessary to handle a case where multiple workers get on the same elevator at one time.

Elevator

You will need to implement the move method for this class. This method, when called by a worker, will cause the Elevator to move to the next floor in its queue depending on the elevator's current set direction.

 

Objectives

This project will allow you to practice the principles of concurrency and multithreading.

Grading

Clarifications

Any clarifications or corrections associated with this project will be available at Project Clarifications.

Code Distribution

The project's code distribution is available by checking out the project named ElevatorOperator. The code distribution provides you with the following:

Specifications

Requirements