Concurrency & Multithreading Flashcards

(19 cards)

1
Q

Thread

A

smallest unit of execution in a process;
can run independently on CPU cores.

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

Process

A

isolated program instance with its own memory space

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

Parallelism

A

Executing multiple operations simultaneously to improve throughput.

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

Concurrency

A

Structuring a program to manage multiple tasks that may overlap in time.

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

Synchronization

A

coordinating access to shared resources

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

Thread Pool

A

fixed set of threads used to execute multiple tasks;
reduces overhead of creating threads repeatedly.

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

Mutex

A

Mutual exclusion object to protect shared data;
ensures only one thread accesses critical section at a time.

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

Spinlock

A

Busy-wait lock;
low-latency for short critical sections, but wastes CPU cycles.

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

Semaphore

A

Controls access to a resource with a counter;
useful for producer-consumer patterns.

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

Condition Variable

A

Allows threads to wait for a condition;
used in combination with mutexes.

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

Atomic Operations

A

Lock-free operations on single variables
avoid mutex overhead.

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

Thread-local Storage
(TLS)

A

Data unique to each thread;
avoids sharing and contention.

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

Race Condition

A

Multiple threads accessing shared data without proper synchronization

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

Deadlock

A

Two or more threads waiting indefinitely on each other’s locks

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

std::async

A

Launches a function asynchronously (potentially on a separate thread) and returns a future representing the eventual result

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

std::future

A

A read-only placeholder for a result that will become available later.

17
Q

std::promise

A

Sets a value or exception that a future can retrieve.

18
Q

scheduling

A

process by which the operating system decides which threads or processes run on CPU cores and for how long

19
Q

context switching

A

process by which the CPU saves the state of the currently running thread or process and loads the state of another to resume execution