Explains the overview and the structure of your program

Assignment Help JAVA Programming
Reference no: EM131267260

Program 1

Requirements:

i. You can write an application program which shows process/thread synchronization using:

1. Semaphore
2. Monitor
3. Java Synchronized feautre

ii. Among the above synchronization methods, I hope you would pick one method and apply your application program which requires process/thread synchronization.

iii. In case of Java, please refer to the reference found at the bottom.

iv. Final result should be organized as a document which explains the overview and the structure of your program, real code, execution results (including captured image), and the conclusion including justification of your program, lessons you've learned, comments, etc.

Reference 1: Concurrent/Multithreaded Programming in Java

Java is known as one of the first languages to make multithreading easily available to developers. A thread is assigned code through Thread subclass (start() and run() method) or Runnable interface implementation.

from Java Concurrency/Multithreading by Jakob Jenkov

(1) Critical Section in Java

- Every method declared with the synchronized keyword is a critical section.
- Only one execution thread will access one of the methods of an object declared with the synchronized keyword.
- Only one execution thread will access one of the static method declared with the synchronized keyword, but another thread can access other non-static methods of an object of that class.
- Two threads can access two different synchronized methods if one is static and the other one is not.
- If both methods change the same data, you can have data inconsistency errors.

(2) Bank Synchronization Program

- Description

o Account class : using the synchronized keyword, we guarantee correct access to shared data in
concurrent applications

- tmp, to store the value of the account's balance.

o Bank class : makes 100 calls to the subtractAmount() method that decrements the balance by 100 in
each call.

o Company class : makes 100 calls to the addAmount() method that increments the balance by 1000 in
each call.

o TestBank class

- Remark: Only a thread can access the methods of an object that use the synchronized keyword in their declaration. If a thread (A) is executing a synchronized method and another thread (B) wants to execute other synchronized methods of the same object, it will be blocked until the thread (A) ends.

But if thread (B) has access to different objects of the same class, none of them will be blocked.

from Java 7 Concurrency Cookbook by Javier Fernandez Gonzalez (2012)

(3) Blocking Queues

o Java comes with blocking queue implementations in the java.util.concurrent package.

(4) Thread Pools

o Java comes with built in thread pools in the java.util.concurrent package.

(5) Reference

o Java Concurrency/Multithreading Tutorial by Jakob Jenkov

Program 2

• Requirements:

i. We have learned many kinds of CPU scheduling methods:

1. First-Come, First-Served Scheduling
2. Shortest-Job-First Scheduling
3. Priority Scheduling
4. Round-Robin Scheduling
5. Multilevel Queue Scheduling

ii. Among the above scheduling scheme, I hope you would pick one method and simulate the CPU scheduling procedure.

iii. First, you are supposed to implement CPU scheduler.

iv. Next, you need to populate multiple processes. The processes should be managed by your system from the viewpoint of the Operating Systems. This requires that you maintain the corresponding PCBs. Before the creation of processes, it would be better to design the behavior scenario of each process.

v. The scheduler should show the (concurrent) sequence how the prcesses are selected to run their tasks and release (return) their turn to the other processes.

vi. Most importantly, you have to combine the CPU scheduler with the synchronization mechanism in order to prevent multiple processes from accessing the shared resources including system timer, counter on the queue, etc. The scenario should include a certain situation which show that you included the synchronization scheme on the CPU scheduler.

vii. Final result should be organized as a document which explains the overview and the structure of your program, real code, execution results (including captured image), and the conclusion including justification of your program, lessons you've learned, comments, etc.

Reference no: EM131267260

Questions Cloud

Identifies and explains the strong points of the managers : Identifies and explains the strong points of the managers. Identifies and explains areas in which improvements are needed
Find out at least one modulation technique : Find out at least one modulation technique used in 1. Ultrasound and 2. ADSL. Explain these techniques in detailed manner and explain the history and uses of Centrex with suitable environment diagram. Discuss how Centrex differs from PSTN in communi..
Find the rotor resistance : Find the maximum torque, slip at maximum torque and the corresponding rotor speed
Describe the factors that affect the promotional mix : Describe the factors that affect the promotional mix.- Explain the difference between a "pull" and a "push" promotional strategy.
Explains the overview and the structure of your program : Final result should be organized as a document which explains the overview and the structure of your program, real code, execution results (including captured image), and the conclusion including justification of your program.
Discuss the differences between formulas and functions : Discuss the differences between formulas and functions. Pick a function in Excel and discuss how that function is used to calculate results in your worksheets. Review your classmates' posts to make sure that you're not duplicating formulas or func..
Describe what is meant by the term issue link : Describe how the spotlight is shining squarely on the incident in Stage One. What are the key characteristics of this stage, and how are they manifested in both the traditional, mainstream, and social media? Include two recent examples to illustra..
Customer name on a screen in the supermarket : A supermarket wants to reward its best customer of each day, showing the customer's name on a screen in the supermarket. For that purpose, the customer's purchase amount is stored in an arraylist and the customer's name is stored in a correspondi..
Advantages and disadvantages of binary search tree structure : Explain the advantages and disadvantages of binary search tree structures. Discuss ways to quantify performance.

Reviews

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