BackOff Alg functionality Flashcards

1
Q

What does a higher number of unsuccessful tries mean in a lock? what should it do incase of a backoff?

A

There is high contention
backoff longer

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

Lock-step

A

When all threads backs off the same amount of time

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

How should lock-step be avoided

A

threads should back off for a random amount of time

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

What should a thread do if i tries and fails to get a lock?

A

double back-off time, up to a fixed max

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

how does the lock look of the Backoff lock?

A

public void lock() {
int delay = MIN_DELAY;
while (true) {
while (state.get()) {}
if (!lock.getAndSet(true))
return;
sleep(random() % delay);
if (delay < MAX_DELAY)
delay = 2 * delay;
}}

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