logo Hurry, Grab up to 30% discount on the entire course
Order Now logo

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Alan DuderMarketing
(5/5)

622 Answers

Hire Me
expert
Pragun SangwanTechnical writing
(5/5)

872 Answers

Hire Me
expert
William BellBusiness
(5/5)

653 Answers

Hire Me
expert
Elis PanaseykooHistory
(5/5)

654 Answers

Hire Me
Java Programming

you with the creation and execution of threads, and with the use of the Thread’s class methods. In order to synchronize the threads you will have to use run( ), start( )

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

The project must be done individually with no other source(s). No exceptions.

Read the Academic Integrity link one more time.

Through its implementation, this project will familiarize you with the creation and execution of threads, and with the use of the Thread’s class methods. In order to synchronize the threads you will have to use (when necessary), run( ), start( ), currentThread( ), getName( ), join( ), yield( ), sleep(time), isAlive( ), getPriority( ), setPriority( ), interrupt( ), isInterrupted( ), and maybe synchronized methods.

In synchronizing threads, DO NOT use any semaphores. DO NOT use wait( ), notify( ) or notifyAll();

Tourists go to Ellis Island to learn about the beginnings of America, and sometimes to try to find out about their ancestors who immigrated to this country.

Every half hour a documentary movie is presented. If the movie is in session, visitors busy wait in the lobby of the movie theatre. When the previous session ends (announced by a clock thread), visitors hurry up to enter the theater and take one of the available seats (simulate this by increasing the priority of the visitor; after a sleep of random time, set its priority to its default value; use getPriority() and setPriority() methods)

If there are no free seats, visitors leave the room, and will wait to see the next presentation (you can implement the mutual exclusion over the shared variable free seats by having it access through a synchronized method, or by declaring it as volatile. Make sure that if you use synchronized methods you never have a thread sleep inside of them). On their way out, they want to be polite at the door, so visitors yield to each other (use yield() twice). Once the movie starts, no visitor can enter and disturb it.

While the movie is on visitors sleep for a long time (the only way to get out of sleep will be by an interrupt).

Your display should clearly show who got in the theater, who left, and who was able to see the current presentation.

When the movie ends (announced by a clock), a speaker will wake up the visitors by sending an interrupt to each visitor in the theater (use the interrupt() method. To check that it works, have a message part of the catch block).

Next, as a reward, the speaker gives out sets of party_tickets for a future movie. The audience will gather into groups of party_tickets size (maybe you want to use a Boolean

 

array/vector) and busy wait to be called. The speaker will call each group at once and distribute the tickets. After that, the speaker will busy wait for the end of the next movie.

Next the visitors will browse around for a while and eventually leave the theater. They leave in the order of their ID (let’s say in the theater you have T3, T5, T2 and T1. The order in which they leave is T1, T2, T3, T5. Use the isAlive() and join() methods.

In order to keep track of the time, we need an additional thread, named clock. The clock will signal the start time of the next movie and the end time of the previous movie, (between sessions the clock will sleep for a fixed time).

Throughout the day, they are four movie presentations. The speaker will terminate after the visitors of the last presentation leave the theater. The visitors terminate after they leave the theater or if they didn’t have the chance to see a presentation, when the museum closes.

Shortly after the four presentations end, the clock announces the closing of the museum, and terminates.

Initial values: numVisitors = 23

theaterCapacity = 5

party_ticket =3

The numVisitors should be an argument to the program.

Using the synchronization tools and techniques learned in class, synchronize the visitor threads, speaker and clock threads – in the context of the problem described above.

In order to simulate different actions you must pick reasonable intervals of random time. Make sure that the execution of the entire program is somewhere between 40 seconds and 90 seconds.

Related Questions

. The fundamental operations of create, read, update, and delete (CRUD) in either Python or Java

CS 340 Milestone One Guidelines and Rubric  Overview: For this assignment, you will implement the fundamental operations of create, read, update,

. Develop a program to emulate a purchase transaction at a retail store. This  program will have two classes, a LineItem class and a Transaction class

Retail Transaction Programming Project  Project Requirements:  Develop a program to emulate a purchase transaction at a retail store. This

. The following program contains five errors. Identify the errors and fix them

7COM1028   Secure Systems Programming   Referral Coursework: Secure

. Accepts the following from a user: Item Name Item Quantity Item Price Allows the user to create a file to store the sales receipt contents

Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip

. The final project will encompass developing a web service using a software stack and implementing an industry-standard interface. Regardless of whether you choose to pursue application development goals as a pure developer or as a software engineer

CS 340 Final Project Guidelines and Rubric  Overview The final project will encompass developing a web service using a software stack and impleme