For this problem you must use Java’s semaphore class. Your implementation for this problem must only use the semaphore methods to control the concurrency of your solution (IE. acquire and release). Consider a shop system that is open 24 hours/7 days a week that has four server process that own a private resource area (IE. Each server has their own items in an infinite supply to assemble a product). Additionally, there is a shared cash register and a shared waiting area that can accommodate up to 15 customers (maximum customer capacity of 15). A customer cannot enter the shop if it is filled to capacity. If the there is room in the shop a customer will gain access to the shop and waiting area. Each customer will enter the shop with an order of one to 25 products. As soon as a server is free, the customer that has the shortest order is served next by a specific server (the customer must leave the waiting area and approach the specific server area to receive product service). A server is either servicing a customer or waiting. Each server will make a specific number of products at an instance of service (server 1: max of two; server 2: max of four; server 3: max of three; and server 4: max of two). Once a server has obtained all items from the product requirements, a final product can be made that satisfies one product of the current customer’s entire order. In the event that a customer’s entire order has not been filled by the server at the completion of the current server visit the customer must reenter the waiting area. The waiting area is organized by the shortest order next. When a customer’s entire order is finished, the customer pays a cashier and leaves the shop. Since there is only one cash register, only one customer may pay at a time. Implement a solution to this problem as a Java application using the Java semaphore class for synchronization. Your zip file must expand into a single directory and your application must compile at the command prompt using javac *.java. Output must include the arrival of each customer and each state transition: leaving full shop, entering shop with an order of m products, customer standing, getting service from server n, paying, and leaving. Each customer must be designed and implemented as a unique separate thread and each server in your implementation is also represented by a unique Java thread. All customers and servers exist within a single application.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

For this problem you must use Java’s semaphore class. Your implementation for this
problem must only use the semaphore methods to control the concurrency of your solution
(IE. acquire and release).

Consider a shop system that is open 24 hours/7 days a week that has four server process
that own a private resource area (IE. Each server has their own items in an infinite supply
to assemble a product). Additionally, there is a shared cash register and a shared waiting
area that can accommodate up to 15 customers (maximum customer capacity of 15).

A customer cannot enter the shop if it is filled to capacity. If the there is room in the shop a
customer will gain access to the shop and waiting area. Each customer will enter the shop
with an order of one to 25 products. As soon as a server is free, the customer that has the
shortest order is served next by a specific server (the customer must leave the waiting
area and approach the specific server area to receive product service).

A server is either servicing a customer or waiting. Each server will make a specific number
of products at an instance of service (server 1: max of two; server 2: max of four; server 3:
max of three; and server 4: max of two). Once a server has obtained all items from the
product requirements, a final product can be made that satisfies one product of the current
customer’s entire order. In the event that a customer’s entire order has not been filled by
the server at the completion of the current server visit the customer must reenter the
waiting area. The waiting area is organized by the shortest order next. When a
customer’s entire order is finished, the customer pays a cashier and leaves the shop.
Since there is only one cash register, only one customer may pay at a time.

Implement a solution to this problem as a Java application using the Java semaphore class
for synchronization. Your zip file must expand into a single directory and your application
must compile at the command prompt using javac *.java. Output must include the arrival of
each customer and each state transition: leaving full shop, entering shop with an order of
m products, customer standing, getting service from server n, paying, and leaving. Each
customer must be designed and implemented as a unique separate thread and each
server in your implementation is also represented by a unique Java thread. All customers
and servers exist within a single application. 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps with 1 images

Blurred answer
Knowledge Booster
Adjacency Matrix
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education