Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

True or false and choices Please answer all thank you <3 16. Data race occurs when a thread is unable to gain access to a

True or false and choices

Please answer all thank you <3

16. Data race occurs when a thread is unable to gain access to a necessary resource, and is therefore unable to make progress.= T/F

17.Which of these scenario describes the best use case for using a ReadWriteLock?

A. Lots of threads need to read the value of shared variable, but only a few thread need to modify its value.

B. Lots of threads need to modify the value of a shared variable, but only a few thread need read its value.

C. Only a few thread need to both and modify the value of a shared variable.

D. Lots of threads need to both and modify the value of a shared variable.

18. The reader-writer lock is useful especially when there are lots of threads that only need to be read.= T/F

19. A maximum of 2 threads can possess the WriteLock of ReadWriteLock at the same time.= T/F

20.Having too many concurrent threads may still not lead to starvation. = T/F

21. Protecting a critical section of code with mutual exclusion means preventing multiple threads from concurrently executing in the critical section. = T/F

22. When the threads in the program are not making progress, you can determine if it is due to a deadlock or a livelock waiting to see if the problem eventually resolves itself. = T/F

23. The best use case for using a ReadWriteLock is when lots of threads need to read the value of a shared variable, but only few thread need to modify its value. = T/F

24. Data races can be hard to identify because data races are cause by hardware errors and cannot be debugged in software.= T/F

25. A ReentrantLock can be locked______.

A. Once by multiple threads at the same time

B. Multiple times by the same thread

C. Multiple times by different threads

D. None of the mentioned

26. Unlike during a deadlock, the threads in a livelock scenario are___.

A. Stuck in a blocked state waiting onother threads

B. None of the mentioned

C. Still making progress towards their goal

D. Actively executing without making useful progress

27. When the threads in the program are not making progress, you can determine if it is due to a deadlock or a livelock by randomly guessing between deadlock and livelock.= T/F

28. Unlike during a deadlock, the threads in a livelock scenario are stuck in a blocked state waiting on other threads.= T/F

29.Which of these scenarios does NOT have the potential for a data race?

A. Two threads are both writing to the same hared variable.

B. Two threads are both reading the same shared variable.

C. Two threads are both reading and writing the same shared variable.

D. One thread is reading a shared variable while other thread writes to it.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle 11G SQL

Authors: Joan Casteel

2nd Edition

1133947360, 978-1133947363

More Books

Students also viewed these Databases questions