1/19
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
A BLANK is a lock for critical code
A mutex is a lock for critical code
What does a mutex help control/manage
a mutex helps control/manage an OS’s clock cycling
How does a mutex function (I.e. how does it block threads)?
A thread using a resource or completing processes with a mutex lock dictates that only a single thread can utilize that resource/process
What is an operation with a mutex lock called colloquially?
An operation with a mutex lock is called an atomic operatin
True or False, functions that are called from, but remain outside of, a locked function are unlocked to other threads
True
True or False, it is completely acceptable and not in poor practice to have lengthy mutex-locked code segments
False; You should always strive to have many shorter locked segments of code than one big locked segment of code
Can a data race occur on more than just single variable access?
Yes, data races apply to anything involving memory resources, such as processes, variables, and buffers
What is an atomic variable?
An atomic variable is a mutexed variable
what might an example of a deadlock be, using mutexes as part of the example
If a critical section of code is locked that recursively calls the same function, the critical section of code will remain locked and the system will deadlock waiting for the critical section to occur
What is a try lock?"
A mutex lock that checks the lock status, and returns true (allows access to the lock)
A mutex provides a BLANK mechanism for your source codes’ BLANK sections
a mutex provides a synchronization mechanism for your source codes’ critical section
true or false, an atomic operation CAN be interrupted by other concurrent threads/processes
False, an atomic operation cannot be interrupted by other concurrent threads/processes
describe the process of a thread trying to attain a lock (held by another thread of process)
transitions to a blocked state
thread with lock will signal when lock is free
blocked thread will transition to resume state and acquire the lock
continues to run
what causes critical section code to be slowed by mutexes?
If your critical section contains code that performs evaluation, analyzing, or decision making
program also starts to run multiple threads (not good)
what is a reentrant mutex?
a mutex that allows a single thread to lock a mutex again, where only the original lock can lock the mutex
true or false, a re-entrant mutex must be unlocked as many times as it was originally locked
True; for each lock on a re-entrant mutex, it must be met with an unlock to be used
A try lock is commonly referred to as a BLANK lock method for a mutex
a non blocking mutex method
true or false, a mutex is NOT very efficient if you have multiple threads to read
True
Describe a read-write lock (what does it do for read, what does it do for write)
Shared Read: Allows multiple threads at once for read-only access
Exclusive Write: Allows only one thread at a time for read/write access
True or False, a Shared Lock is not only shared for reading (allows multiple threads to read and write)
False, a shared lock allows only the shared access of a variable when reading only