Parallel Computing Week 3

0.0(0)
studied byStudied by 1 person
full-widthCall with Kai
GameKnowt Play
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/19

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

20 Terms

1
New cards

A BLANK is a lock for critical code

A mutex is a lock for critical code

2
New cards

What does a mutex help control/manage

a mutex helps control/manage an OS’s clock cycling

3
New cards

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

4
New cards

What is an operation with a mutex lock called colloquially?

An operation with a mutex lock is called an atomic operatin

5
New cards

True or False, functions that are called from, but remain outside of, a locked function are unlocked to other threads

True

6
New cards

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

7
New cards

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

8
New cards

What is an atomic variable?

An atomic variable is a mutexed variable

9
New cards

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

10
New cards

What is a try lock?"

A mutex lock that checks the lock status, and returns true (allows access to the lock)

11
New cards

A mutex provides a BLANK mechanism for your source codes’ BLANK sections

a mutex provides a synchronization mechanism for your source codes’ critical section

12
New cards

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

13
New cards

describe the process of a thread trying to attain a lock (held by another thread of process)

  1. transitions to a blocked state

  2. thread with lock will signal when lock is free

  3. blocked thread will transition to resume state and acquire the lock

  4. continues to run

14
New cards

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)

15
New cards

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

16
New cards

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

17
New cards

A try lock is commonly referred to as a BLANK lock method for a mutex

a non blocking mutex method

18
New cards

true or false, a mutex is NOT very efficient if you have multiple threads to read

True

19
New cards

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

20
New cards

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