Write a java program that creates 3 threads

Assignment Help JAVA Programming
Reference no: EM13704502

Question: The reader-writer problem can be stated as follows: A shared memory location can be concurrently read by any number of tasks, but when a task must write to the shared memory location, it must have exclusive access.

Write a Java program that creates 3 threads each of them performing 10 reading/writing to the shared location. Use a random number generator to decide if the request is reading or writing (say, 0 for reading, 1 for writing.) Before each action, print out "thread i now ready to read (or write) the shared location", after the action, print out "thread i now finished read (or write) the shared location". Here i could be 0, 1, or 2.

Can you prepare a program to prepare the threads to read and write to a shared location?

Reference no: EM13704502

Questions Cloud

Implement a singly linear linked list : Prepare a C++ using visual studios program to implement a singly linear Linked List - You need to implement singly link list in C++.
Implement assembly language program to find greatest value : Write an assembly language program that will accept two 1-digit numbers (from 0 to 9) from the keyboard, compare the two numbers, and then print out the number of greatest value.
Evaluate the total average of all the inputs : Once the user enters in the desired amount of inputs, they will then select the second button "Calculate".
Create a short assembly program : You need to create a short assembly program named char_int, stored in file char_int.asm, that prompts the user for a character, and then for an integer.
Write a java program that creates 3 threads : Write a Java program that creates 3 threads each of them performing 10 reading/writing to the shared location. Use a random number generator to decide if the request is reading or writing
What is the corresponding key length in bits : What is the size of the key space which can be constructed by such passwords - What is the corresponding key length in bits?
Procedure just prints out the number 10 and returns : Your program will have three procedures. The main procedure (with the asm_main label), will sign on and them call a menu procedure that displays a two line menu:
Perform an attack against the cipher : Perform an attack against the cipher based on a letter frequency count: How many letters do you have to identify through a frequency count to recover the key? What is the cleartext?
Develop a set of six powerpoint : Develop a set of six PowerPoint or MS Word slides or six paragraphs to present the history, current level of usage, typical applications, future prospects and usability for the selected application.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Make a program that show the sales amount

You have to make a program that show the sales amount. Be sure to include comments. Comments should be included in the program to explain your calculations and program.

  Create a gui version of the game mini sudoku.

Each row has the numbers 1 to 6,Each column has the numbers 1 to 6,Each group of 2 rows by 3 columns also has the numbers 1 to 6.

  Lambert''s vacation rentals

Write an application for Lambert's Vacation Rentals. Use separate ButtonGroups to allow a client to select one of three locations, the number of bedrooms

  Return only the rows where the shipdate

Write a SELECT statement that returns these columns from the Orders table:

  Explain where the following method invocations

Explain where the following method invocations are most likely to be found in a program for dealing with census data organized using the Model, View, Controller (MVC) design pattern. Choices are zero or more of Model, View, and Controller. Be sure to..

  Explain the difference between throwing an exception and

question 1. what is the difference between throwing an exception and catching an exception?question 2. how does a

  Class named person with fields for holding a person''s name

Design a class named Person with fields for holding a person's name, address, and telephone number. Write one or more constructors and the appropriate mutator and accessor methods for the class's fields.

  Understand actual communication with an smtp server

Understand actual communication with an SMTP server can be achieved using TCP Sockets and understand the development of a graphical user interface (GUI) and use of event handling.

  Chat monitoring system

The name of the project is chat monitoring system. in the file you will see the screenshot diagram 2A are my design, i want it to be upgrade, to look professional like the diagram 2B. please java, netbeans and GUI. please can I have only the client s..

  Write a server for multiple clients

Write a server for multiple clients. The client sends loan information (annual interest rate, number of years, and loan amount) to the server. The server computes monthly payment and total payment and sends them back to the client.

  Write down a java program which prints out all 92 solutions

write a java program which prints out all 92 solutions of the 8-queen problem but modify the program to display only

  Programming principles please help me doing my assignment i

please help me doing my assignment i have attached my assignment requirement document refer it and send me the solution

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