This set of questions is involving multithreading in C++ and are multiple choice, choose the best answer
1) Which action will not recover a process from deadlock?
Terminate threads holding onto resources
Terminate user process and restart
Wait for the resource to be released by other threads
None of the others
2) In a boss-worker thread model, the boss must keep in constant communication with the workers to make sure they are functioning correctly.
True
False
3) Process aging is?
Decreasing the priority of a process each time the process gets to run
Increasing the priority of a process if it sits in the ready state
for a long time.
decreasing the priority of a process as it gets older regardless of the queue
Increasing the priority of a resource if it becomes deadlocked
4) A race condition is _____________________
When one thread is trying to beat another to execute a region of code
When a thread cannot make progress because another one is blocking
it.
When the outcome of multiple threads is dependent on the order of execution among them
A form of locking where processes coordinate for exclusive access to a critical section.
1) Which action will not recover a process from deadlock?
a) Terminate threads holding onto resources
--> Not correct
--> Because when you terminate threads one by one resources
locked will
be released which results in recovering from
deadlock.
b) Terminate user process and restart
--> Not correct
--> Because when you terminate the user process whole resources
will be released
which results in deadlock removal.
c) Wait for the resource to be released by other
threads
--> Correct
--> Because deadlock is the situation where a thread is depend
on the resources used by other threads and at the same
time other threads are depend on the resources used by
this thread.
if you do nothing then the threads will always be
waiting for one another.
d) None of the others
--> Not correct.
Answer : Wait for the resource to be released by other threads
2) In a boss-worker thread model, the boss must keep in constant
communication with the workers to make sure they are functioning
correctly.
a) True
b) False
Answer: False
Explanation: In Boss Worker Model boss assigns works to each worker
, after assigning the work boss checks if worker is available to do
next task.
here boss checks if worker is ready or not to do next task but not
is he working correctly.
So answer is False.
3) Process aging is?
a) Decreasing the priority of a process each time the process gets to run
b) Increasing the priority of a process if it sits in the ready state for a long time.
c) decreasing the priority of a process as it gets older regardless of the queue
d) Increasing the priority of a resource if it becomes deadlocked
Answer: Increasing the priority of a process if it sits
in the ready state for a long time.
Explanation: Aging is the technique used to solve the Starvation
problem in processes.
Starvation is the situation in Priority Scheduling
algorithm in which a Process
is ready to run in the CPU but have to wait long
time(may be infinite) because of
low priority of that process.
So your answer is b.
4) A race condition is _____________________
a) When one thread is trying to beat another to execute a region of code
b) When a thread cannot make progress because another one is blocking it.
c) When the outcome of multiple threads is dependent on the order of execution among them
d) A form of locking where processes coordinate for exclusive access to a critical section.
Answer: When the outcome of multiple threads is
dependent on the order of execution among them
Explanation : A race condition is a situation where you have a data
modifying code which uses by multiple thread
and that data modified by the earlier threads
overwritted by the latest thread that executes it.
let us consider:
thread 1 executes that code updates
the value to 1
again thread 2 executes the same
code and updates it to 2.
.... and so on.
Hence your answer is c).
This set of questions is involving multithreading in C++ and are multiple choice, choose the best...
Write a C program for:
One technique for dealing with deadlock is called “detect and
recover.” In this scheme, some procedure is used
to identify when a deadlock occurs, and then another procedure
is used to deal with the blocked processes. One technique to
identify a deadlock is to maintain a resource graph that identifies
all processes, all resources, and the relationships between them
(that is, which processes exclusively own which resources, and
which processes are blocked waiting for which...
PART I: Multiple Choice Write all answers to the following questions. No partial credit available. Consumption utility is composed of price and convenience. True or False? A firm reduces inefficiencies by making trade-offs. True or False? A firm can increase its profitability by: A. increasing costs and reducing price. B. moving away from the efficient frontier. C. increasing inefficiencies. D. reducing inefficiencies. Operations comes from the Latin word "opus," which means: A. activity. B. helping people. C. improvement. D. work....
TRUE OR FALSE/ MULTIPLE CHOICE and word response
questions.
C. a more permanent government involvement in the banking system, even creating a pational banking system that owns and operates most of the global and regional banks. Deshort-term increases in government spending to stimulate the economy. 20. When describing the state of the U.S. economy, reporters often refer to the nation's GDP, its unemployment rate, and the CPI. Explain what each of these terms means and why each measure is significant....