
If all threads in a program... • obtain locks in the same order, • unlock those...
In this problem, you will complete several classes involving boxes, locks, keys and secrets. Follow the specifications in the starter files for the classes. You can run the javadoc program to generate the API (see Tutorial 2) for the classes. A box has a secret inside it (and maybe a key!) and can be locked. In order to open a box, you need the right key to unlock the lock. Secrets.java will be a program that takes an array of...
Assume that we desire to have deadlock-free mutual exclusion using locks on a shared object implemented via a set of shared registers. Suppose we allow threads to go through the lock method without writing to any of the shared registers? In general, it will be impossible to tell if a thread is in the critical section by examining the shared object. It will result in deadlocks. Both (a) and (b) Neither (a) nor (b) Suppose a thread attempts to lock...
In this problem, you will complete several classes involving boxes, locks, keys and secrets. Follow the specifications in the starter files for the classes. You can run the javadoc program to generate the API (see Tutorial 2) for the classes. A box has a secret inside it (and maybe a key!) and can be locked. In order to open a box, you need the right key to unlock the lock. Secrets.java will be a program that takes an array of...
TRUE-FALSE Basic synchronization principles and multithreading 1. Java user threads can implement both busy-waiting and no-busy-waiting policy. 2. Priority inversion avoids deadlocks. 3. Spinlock mutex can be used as an adaptive mutex. 4. Java RTE can be blocked for Input/Output operation. 5. Interrupted user thread, which executes a method in a monitor, must be rolled back to undo any changes it performed. 6. The synchronization primitive by disabling interrupts can be used by an application program. 7. Bounded-waiting requirement is...
Please follow all the instructions and do all the parts
(a-d)!
Create a Java program which implements Dijkstra’s shortest path
algorithm according to the psueudocode below. Base the design on
the weighted graph implementation used in Problem3.java (provided
at the bottom). Your program should include the following
features:
a. A new method receives a starting vertex index and a target
vertex index (e.g. 0 and 4). It computes the shortest distances to
all vertexes using Dijkstra’s algorithm. The pseudocode is...
Sorting Threads Assignment Overview Write a multithreaded sorting program in Java which uses the merge sort algorithm. The basic steps of merge sort are: 1) divide a collection of items into two lists of equal size, 2) use merge sort to separately sort each of the two lists, and 3) combine the two sorted lists into one sorted list. Of course, if the collection of items is just asingle item then merge sort doesn’t need to perform the three steps,...
You will need those four files: d_node.h, d_nodel.h, d_random.h, and
prg9_1.cpp
Program Definition
1. Create program definition with the following templates and
methods:
// returns the sum of all elements in a single linked list
template <typename T>
int sum(node<T> *front);
// outputs the nodes of a single linked list in reverse
order.
template <typename T>
void outputReverse(node<T> *front);
Main Method: add before the "cout << "\nOutput in
Descending Order: ";" line
call sum() to print sum of all elements...
Palindrome is a word or a phrase when taken in reverse order, gives the same word or phrase. For example, the word “radar” is a palindrome. The phrase "Do geese see God?" is also a palindrome after the removal of the question mark and all the spaces and the conversion of the remaining alphabets to either upper or lower case. Write a program that uses an STL stack to check if an arbitrary string containing multiple words separated by spaces...
1. When using Full and Incremental backups, restoration is performed: a. In the same order starting from the last full backup b. In the reverse order starting from the last incremental backup c. Using mirroring d. None of the above 2. One of the challenges with storing backups for many years is a. Restoring from out dated media b. Protecting the media from theft c. Maintaining the encryption key d. All of the above 3. Database security must be applied...
1. A default constructor takes the same number of parameters as the number of private data members. Select one: True False 2. Select all that are true regarding passing an object to a function. Select one or more: a. A function cannot take multiple objects as parameters b. Passing by value creates a copy of the object c. Passing an object by pointer is not allowed d. Passing by reference allows the function to modify the object e. Passing by...