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

  The sixth amendment allows the due process right to council

The Sixth Amendment allows the due process right to council. Several Supreme Court cases have clarified this right for those who cannot afford their own attorneys. Discuss the right to an attorney for indigent defendants. What are the three main syst..

  Presell a limited number of cinema tickets

Write an application to presell a limited number of cinema tickets. each buyer can buy as many as 4 tickets. No more than 100 tickets can be sold. Implement a program called TicketSeller that prompts the user for the desired number of tickets and the..

  Initialized the array of words by an assignment statement.

modify the following program . The program from Lab 4 initialized the array of words by an assignment statement.

  Determines and displays the smallest and largest

Create a method that determines and displays the smallest and largest of the ten values. Then, pass the array to the method - Create a GUI application whose button's Click() method accepts ten integer values from a TextBox and stores them in an arra..

  Write a program called word guessing game.

Write a program called Word Guessing Game. Open the file FourLetterWords.txt and write the contents into an array of Strings (the file has 87 words in it).

  Creates an array of six divsales objects

Write a program that creates an array of six DivSales objects. The program should ask the user to enter the sales for four quarters for each division.

  Write a program to simulate the behavior of the philosophers

Write a program to simulate the behavior of the philosophers, where each philosopher is a thread and the chopsticks are shared objects.

  Prepare an app that calculates the product of a series

Prepare an app that calculates the product of a series of integers that are passed to method   product using a variable-length argument list.

  Design a boolean function named isprime,

A prime number is a number that is only evenly divisible by itself and 1. For example, the number 5 is prime because it can only be evenly divided by 1 and 5. The number 6, however, is not prime because it can be divided evenly by 1, 2, 3, and 6. Des..

  Write the methods used in section two of main

Write the constructor for the SortTraversableLinkedList. It should create the head and tail nodes, and set the size of the list to 0, as in a typical linked list.

  Create java program to simulate the operation of a bank atm

write a Java program to simulate the operation of a bank ATM (cashpoint) system for payment and deposit on an account. In order to make the system fairly simple there is only one bank account and there are 5 cards that can be used to deposit or wi..

  Reverse the array, and find the largest element

find the max block of an array by splitting it into three parts: left, middle, right. And then reverse the array, and find the largest element.

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