Mod 2: Sync Problems Patterns Flashcards

1
Q

What are the most common issues with synchronization?

A

(1) Race Condition
(2) Deadlock
(3) Livelock
(4) Starvation

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

How can synchronization be done?

A

(1) Mutual Exclusion
(2) Condition Synchornization

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

When does a race condition typically happens?

A

When more than one threads get access to a shared resource at the same time

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

What can a race condition cause?

A

Faulty and corrupt data

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

What can we solve race conditions?

A

Execute the critical section in an atomic operation to ensure thread safety

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

What is “starvation”?

A

When an action in a concurrent programming situation never get executed, i.e when a thread is unable to gain access to a shared resource

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

When does “starvation” occur?

A

When shared resources are made unavailable for long period of time by “greedy” threads

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

How do we avoid starvation?

A

By letting every thread get a fair amount of time, something that is usually a task for the OS scheduler and not something we neccessarily can affect

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

What is “deadlock”?

A

When two or more threads are blocked forever, waiting “deadly” for each other

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

What is “livelock”?

A

Livelock occurs when two or more threads is spinning while waiting for a condition that will never become true

eg. threadA is waiting for threadB, and threadB are waiting for threadA

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

What is the difference between livelock and deadlock?

A

Thread in deadlock are in a waiting-state and threads in livelock are in a running-state

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

What is a “barrier”?

A

Synchronization points that processes/threads must reach before any of them are allowed to proceed

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

What does a safety property mean?

A

That each process/thread should never enter a bad state, i e. state in which some variables have faulty values, to avoid corrupt shared data

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

What does a liveness property mean?

A

That each process/thread should have liveness property, i e. process/thread eventually enter a good state, in which variables have correct values

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

What are examples of safety propeties?

A

Mutual exclusion and absence of deadlock

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

What is the liveness property?

A

A property that requires something good eventually happens, eg starvation, deadlock and livelock