Concurrency and Parallelism Flashcards

1
Q

What is concurrency in computing?

A

Concurrency in computing refers to the ability of a system to execute multiple tasks or processes simultaneously making progress on more than one task during the same time period.

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

Define parallelism in the context of computing.

A

Parallelism is the simultaneous execution of multiple tasks or processes to achieve faster computation typically by utilizing multiple processors or cores.

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

Explain the difference between concurrency and parallelism.

A

Concurrency is about managing multiple tasks at the same time while parallelism is about executing multiple tasks simultaneously.

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

What is a thread?

A

A thread is the smallest unit of execution within a process. Multiple threads within a process can run concurrently sharing the same resources.

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

Define a race condition in the context of concurrent programming.

A

A race condition occurs when the behavior of a program depends on the relative timing of events and the outcome is unpredictable and depends on which thread arrives first.

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

Explain the concept of a critical section.

A

A critical section is a part of a program where shared resources are accessed and only one thread is allowed to execute at a time to avoid conflicts and maintain data consistency.

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

What is a deadlock in concurrent programming?

A

A deadlock is a situation where two or more threads are unable to proceed because each is waiting for the other to release a resource leading to a standstill.

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

Define parallel computing.

A

Parallel computing involves breaking down a problem into smaller sub-problems and solving them simultaneously often by distributing the tasks across multiple processors or computing nodes.

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

Explain the concept of a mutex (mutual exclusion).

A

A mutex is a synchronization mechanism used to control access to a shared resource by multiple threads ensuring that only one thread can access the resource at a time.

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

What is the difference between task parallelism and data parallelism?

A

Task parallelism involves executing different tasks concurrently while data parallelism involves distributing data across multiple processors and performing the same operation on each data element simultaneously.

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