Quiz 3 Flashcards

1
Q

What is a race condition?

A

A condition that occurs when two concurrent programs interfere with each other

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is a critical section?

A

A portion of code that shouldn’t be interrupted while its running.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are the three requirements for a solution to the critical section problem?

A

Mutual Exclusion
Progress
Bounded Waiting

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is Mutual Exclusion?

A

A requirement that a solution for the critical section problem must have. If a process is in its critical section then no other processes can be executing their critical section.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is Progress?

A

A requirement that a solution for the critical section problem must have. If no process is executing its critical section and another process wishes to enter their critical section then it cannot be postponed indefinitely.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is Bounded Waiting?

A

A requirement that a solution for the critical section problem must have. A bound must exist on the number of times other process are allowed to enter their critical section.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the Interrupt based solution?

A

The entry section disables interrupts for the program while the exit section enables interrupts for the program.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is Peterson’s Solution?

A

You have a variable called turn that indicates who turn it is to enter the critical section as well as a flag that indicates if a process is read to enter into the critical section.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Why is it that Peterson’s Solution may not work on modern hardware?

A

Modern Hardware may reorder operations to make thee program more efficient resulting in a skewed result.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is a memory barrier?

A

Memory guarantees a computer architecture makes to application programs.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the difference between a strongly ordered memory model and a weakly ordered memory model?

A

A strongly ordered memory model is one where a memory modification of one processor is visible to all other processors. A weakly ordered memory model is where a modification of one processor may not be immediately visible to all other processors.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What are the two forms of hardware support for synchronization?

A

Hardware instructions
Atomic Variables

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What are atomic variables?

A

Variables that are guaranteed to not be able to interrupted in their operations

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What are the two Hardware Instructions that can be used to insure syncronization?

A

Test and Set and Compare and Swap

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What does Test and Set do?

A

It takes in a Boolean target, sets a return value equal to target sets target to true and then returns the return value
It is executed atomically

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What does the compare and swap function do?

A

Returns the original value of the passed parameter and sets the variable value to the value of the passed parameter only if value equals the expected variable.

17
Q

What are Mutex Locks?

A

A way to protect critical sections by acquiring locks then releasing them

18
Q

What is a downside of Mutex Locks?

A

It requires something called busy waiting which means that the threads that are waiting on the lock are consuming reasources

19
Q

What are Semaphores?

A

Integer variables that are incremented and decremented atomicly.

20
Q

What are Condition Variables?

A

Variables that can be suspended and woken up by signaling and waiting

21
Q

What is liveness?

A

A set of properties that a system must satisfy to ensure processes make progress (i.e. no indefinite waiting)

22
Q

What is a deadlock?

A

When two or more processes are waiting indefinitely for an event that can be caused by only one of the waiting processes

23
Q

What is the bounded-buffer synchronization problem?

A

You have n buffers, each of which can hold one item, a semaphore mutex initialized to the value 1 and a semaphore full initialized to the value 0 and a semaphore empty initialized to the value n. The producer produces something to place into the buffer while the consumer consumers what is placed in the buffer.

24
Q

What is the readers-writers problem?

A

The readers only read the data, they do not perform any updates, while the writers can both read and write. The problem involves how to have multiple readers to read at the same time.

25
Q

What is the difference between named and unnamed Semaphores?

A

Named semaphores can be used by unrelated processes, while unnamed semaphores cant.

26
Q

What is a memory transaction?

A

A sequence of read-write operations to memory that are performed atomically.