Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

-- please guys all of these in java by using ubuntu -- NOTE : PLEASE USE THE METHODS ( notifyAll() , wait() ) without use

-- please guys all of these in java by using ubuntu --

NOTE : PLEASE USE THE METHODS ( notifyAll(), wait() ) without use semaphore

image text in transcribed

From what you have learned in lab, construct a multithreaded program to simulate the print jobs of a printer, one job at a time, your program should include the following: - A shared object called a Buffer that is initially empty. - Set1 of threads, to put data in the buffer (Write Jobs) with 1/2 second delay. - Set2 of threads, to read data from the buffer (Read Jobs) with one second delay. - The Buffer should be empty upon exiting the program. - You should not allow reading jobs from the buffer if there is none existing. - You should not allow writing new jobs if the buffer is full (say have a maximum of 20 jobs) - Deal with race conditions. - Avoid deadlocks. cocecoc-virtualBox: $ javac Main. java cocacoc-VLrtualBox: 5 java Matn Writing... number of renatinting unread Jobs in Buffer: 1 Reading.... number of renatining unread Jobs in Buffer: Writing... number of renatnting unread Jobs in Buffer: 1 Reading.... number of renatining unread Jobs in Buffer: Writing.... number of renaining unread Jobs in Buffer: 1 Reading.... number of renatinting unread Jobs in Buffer: 0 Writing... number of renatining unread Jobs in Buffer: 1 Reading.... number of renatining unread Jobs in Buffer: 0 Writing.... number of renatinting unread Jobs in Buffer: 1 Reading.... number of renatining unread Jobs in Buffer: Use the following main class and the sample output as a guide to complete the tasks above, Assignment group: Your choice of working by yourself or in groups of four. Submission: - The source Java files for the classes in your program - A document file that includes your names \& IDs plus a summary explaining what you have done in your program formatted as follows, - Where the race condition is happening in the program and why, - How you dealt with the race condition, - Why and how the deadlock happened and how it was avoided

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions