Concurrent Programming Flashcards

1
Q

Concurrent programming

A

Multiple tasks running and completing during overlapping periods of time. Threading library. One CPU. Reqs at least two tasks. Executes all tasks by switching tasks simultaneously. Juggle between tasks.

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

Parallelism

A

simultaneously have multiple tasks or separate parts of the same task running using MULTIPLE CPUs. Needs hardware with multiple CPUs. Reqs one task. Assigns each task for a core to execute. Do multiple things at once. Multiprocessing library

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

Asynchronous programming

A

Have a wait queue but tasks aren’t completed in order. Asyncio library

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

Process

A

an abstraction representing the program when it’s running. Created when program is executed. Building blocks of OS. Generally operate independently and don’t share data. Each process contains at least one thread

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

Lifecycle of Process

A

New, Ready, Running, Blocked, Finished

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

When process is initialized, its layout has 4 sections:

A
  1. text section for compiled code. 2. data section for initialized variables. 3. stack for local variables defined within the functions. 4. heap for dynamic memory allocation.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Thread

A

represents the actual sequence of processor instructions that are actively being executed

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

Multithreading

A

with use of blocking and context switching a single CPU core can execute multiple threads at once

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

Deadlock

A

multiple threads all attempt to wait for each other and freeze the system

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

Determinism

A

Same operation performed across different nodes should return the same result with the underlying machine always passing through the same sequence of states.

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

Preemption

A

Act of temporarily interrupting an executing task with the intention of resuming it at a later time. Interrupt is done by an external scheduler with no assistance or cooperation from the task.

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

Kernel Preemption

A

CPU can be interrupted in the middle of executing kernel code and assigned other tasks from which it later returns to finish its kernel tasks. Scheduler is permitted to forcibly perform a context switch on a driver or other part of kernel during its execution, rather than cooperatively waiting for the driver or kernel function to complete its execution and return control of the processor to the scheduler when done.

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

Kernel Thread

A

thread built into the existing process. Kernel within the OS is fully aware of these threads and directly manages their execution.

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

User threads

A

exist solely in userspace and, while fully functionally identical, are not known or controlled by the kernel. Allows more fine-grained control by developers.

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