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

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

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