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

  Write a java applet not application

Ask user enter the three pieces of information below and compute the result by using the following formula:

  Implement polymorphism and dynamic binding

We are going to implement Polymorphism and dynamic binding by creating generalized methods that accept generalized Employee objects to collect input and display information. However, in the main method we will pass derived objects of the Employee ..

  Improve the word jumble game

Improve the Word Jumble game presented in this chapter so that each word is paired with a hint. If the player enters hint, then the program should show the corresponding hint.

  Implement an iterative method with a for loop

Different scientists have developed Predator-Prey models to try to understand the interactions and foresee the evolution of the populations.

  Complete the design details of the classes in the package

The design phase of the SRS project is in full swing and every developer on the team is assigned a group of packages to work on and to complete the design details of the classes in the package. To help speed up the design process, you-as the softw..

  Write a program using java script to convert a currency

Write a program using Java Script to convert a currency from dollars onto euro. If the rate of conversion is for each Euro 1.8 dollars. The use shall continue to convers as long as he/she desire to do so. Also print output via a message box

  What are the main differences between java programming

question 1 what are the major differences between java programming language and any other language? list and discuss

  Propose the interaction and failure models for system

Propose the interaction and failure models for this system. Discuss the pros and cons of your design - Simulate this entire environment in C++ or Java using threads. Allow the simulation to reach a steady-state, i.e., run the program for a large nu..

  Write a java sorting application with two classes

Write a Java Sorting Application with two classes, JavaSort and JavaSortTest. Your JavaSort Class, as a minimum must contain sorting methods for BubbleSort, InsertionSort, ShellSort, MergeSort, and QuickSort.

  Principles of object-oriented programming

Develop, test, and execute a graphic application for simulations using Java - Create a Java application.

  Design a class named pet

Design a class named Pet, which should have the following fields: Name - The name field holds the name of a pet. Type - The type field holds the type of animal that is the pet. Example values are "Dog", "Cat", and "Bird".

  Question 1when you use the mvc pattern the controller

question 1when you use the mvc pattern the controller directs the flow of control toa. the browser and the modelb. the

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