Concurrency Flashcards

1
Q

What’s the main difference between threads and processes?

A

Threads of the same process share the same address space

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

Allowing multiple threads within the same process to share the same address space allows the threads to be…

A

independent of each other

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

What do the threads within a process share?

A

Process ID
Address space
Open files
Other resources

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

What does each thread within a process have, that it doesn’t share?

A

Thread ID
Set of registers - including PC
Stack

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

Give the definition:
A thread where an API specifies the behaviour of its library

A

POSIX thread - Pthread

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

What sort of results can concurrency lead to?

A

Non-deterministic results - different results despite the same input

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

Give the definition:
When multiple threads of execution update the shared data structure, and the final result depends on the execution order

A

Race condition

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

Give the definition:
An operation that completes in its entirety without worrying about interruption by any other potentially conflict-causing threads

A

Atomic operation

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

What do we call the problem that is to ensure that when one thread is executing in its critical section, no other thread is allowed to execute in that critical section?

A

The critical section problem

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

Give the definition:
A piece of code that accesses a shared resource, usually a variable or data structure

A

Critical section

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

What is the solution to the critical section problem?

A

Mutual exclusion

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

Give the definition:
A part of the solution to the critical section problem where only one thread is allowed in the critical section at a time

A

Mutual exclusion

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

Give the definition:
A part of the solution to the critical section problem where if there are several simultaneous requests from threads, must allow one to proceed

A

Progress

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

What sort of “freedom” does the progress part of the solution to the critical section problem give?

A

Deadlock-free

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

Give the definition:
A part of the solution to the critical section problem where one must eventually allow each waiting thread to enter

A

Bounded

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

What sort of “freedom” does the bounded part of the solution to the critical section problem give?

A

Starvation-free