Develop a java program to simulate the dining philosophers

Assignment Help JAVA Programming
Reference no: EM132270170

Solve the following two problems. Read the submission instructions carefully.

Problem 1: Recall the message-passing based implementation of a file server. Implement this as an Actors-based system using Java with Akka. Particularly, recall that in the solution discussed in class, the file servers share channel open. Because your Actors implementation will not use channels separate from actors, your solution will have to be different.

Problem 1 clarification

1. You should use real files.

2. Assume that each file server is handling a different file (i.e., they don't have to worry about multiple processes accessing the same file.

3. You should test with 5-10 clients and a 3-4 servers

Problem 2: Develop a Java program to simulate the Dining Philosophers problem defined as follows.

Five philosophers sit around a circular table. Each philosopher spends his life alternately thinking and eating. In the center of the table is a large platter of spaghetti. Because the spaghetti is long and tangled -- and the philosophers are not mechanically adept -- a philosopher must use two forks to eat a helping. Unfortunately, the philosophers can afford only five forks among them. One fork is placed between each pair of philosophers, and the agree that each will use only the forks to the immediate left and right of them. The problem is to write a program to simulate the behavior of the philosophers. The program must avoid the unfortunate (and eventually fatal) situation in which all philosophers are hungry but none is able to acquire both forks -- for example, each holds one fork and refuses to give it up.

Your program should have 5 philosopher threads and a class that implements a monitor to synchronize the philosophers. The monitor should have two methods: getforks(id) and relforks(id), where id is an integer between 1 and 5. Have the philosophers eat and sleep for random amounts of time. Add print statements to your program to generate a trace of the activity of the program. Write a brief report summarizing what you observe.

Reference no: EM132270170

Questions Cloud

Construct and communicate a solution to the problem : A statement about a contemporary political problem or issue related to the course that will be discussed in greater detail later in the paper.
Describe in detail what security controls are : 1. Describe in detail what security controls are, how they are chosen, and how they should be managed once implemented.
Compare source routing with hop-by-hop routing : Compare source routing with hop-by-hop routing with respect to (1) packet header overhead, (2) routing size table
Find the sum of the numbers from 100 to 200 inconclusive : 1 Find the sum of the numbers from 100 to 200 inconclusive.
Develop a java program to simulate the dining philosophers : Develop a Java program to simulate the Dining Philosophers problem - implements a monitor to synchronize the philosophers. The monitor should have two methods
Sample code for the three hazards : In CDC6600, describe how the WAR, WAW and RAW are handled by using a sample code for each of the three hazards.
Compare each presidents political principles with his action : The presidential election of 1912 was the most Progressive in US history, with the two frontrunners, Theodore Roosevelt and Woodrow Wilson.
What is the desired field of study : What is the desired field of study(which is Business Administration concentration in Human Resources), specific events
Create an application named arithmeticmethods : Create an application named ArithmeticMethods whose main() has two integer variables. Assign values to the variables. In turn, pass each values methods

Reviews

inf2270170

8/27/2019 3:34:22 AM

I am attaching the notes may be tutor need it 32998953_102-Asynchronous-Message-Passing.pdf The assignment is based on Java please make sure that you follow the requirement carefully.

len2270170

3/30/2019 1:42:01 AM

Create a directory with your nsid as its name. Inside this directory, create separate sub-directories with names like problem1, problem2, etc. for each programming problem. Under each programming problem's folder, place the entire Eclipse project for that problem. You may use other IDEs for your development; however, the submission must be a valid Eclipse project for the versions of Java (and Akka when applicable) introduced in tutorials. 5% of the total mark for each problem is for internal documentation, and another 5% is for testing / report. Include evidence of your testing -- or report as required in Problem 2 -- in a separate file.

Write a Review

JAVA Programming Questions & Answers

  Create a test application that creates a controller object

Create a test application that creates a controller object and play the game! Experiment with changing the game parameters and observe how the game reacts

  Write a program that uses the brute-force approach

Write a program that uses the brute-force approach to count the number of inversions in the array - calculate the total weight and the total value of each subset in the powerset.

  Describe the intent of singleton design pattern

COS70006 - Object Oriented Programming - Describe the Intent of Singleton design pattern and Discuss the problem of sub classing with Singleton

  Explain auto backup for android applications

Explain Auto Backup for Android Applications. After creating a database, how do you access a database?

  Develop a java application program for such a given scenario

This assignment requires you to develop a java application program for such a scenario that a local department store manager wants to use it for calculating monthly commissions for N salespersons.

  Design a java program to accept income from the user

Design a Java program to accept income from the user; compute the income tax to be paid and display the income and the tax payable on the screen

  Display an error message for all other requests

Only display the contents of files that have a ".bat" extension. Display an error message for all other requests that are not for files with the ",bat" extension

  Briefly describe the programs requirements

Briefly describe the program's requirements. Describe the approach/structure of program.What classes/functions were used?

  Create a program that simulates a slot machine

Create a program that simulates a slot machine. To decide which loop structures to use, such as while, do while, and for loop in Java. To use decision structures such as if, if-else, and switch statements in Java

  Create a splash screen for the tgc application

To complete your splash screen please use the information below: Create a splash screen for the TGC application that displays: the application's name.

  Write a program to track their hotel occupancy for hotels

The Paris Hotels Company needs a computer program to track their hotel occupancy for the hotels in their chain. Write a Java program that calculates the occupancy rate for each floor of a hotel.

  Create a stock class to manage the stock activity

Create a GUI that uses JList andJTabbedPanes - Process multiple objects in an ArrayList and Code event handlers for multiple events

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd