multiprocessing and synchronization Flashcards

1
Q

What is Symmetric Multiprocessing system

A

Symmetric Multiprocessing (SMP) is a computer architecture in which multiple identical processors are connected to a single shared main memory and are controlled by a single operating system, allowing them to work cooperatively on tasks, thus increasing overall system performance.

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

What is the “Bus Arbiter” ?

A

Bus Arbiter is the hardware that ensures that only one hart accesses Main Memory / MMIO at a time

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

What is Cache?

A

Cache is a specialized, relatively small and fast type of computer memory that stores frequently accessed data or instructions

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

What is a “Race Condition” ?

A

A race condition is a phenomenon in computing where the behavior of a program depends on the relative timing or interleaving of multiple threads or processes executing concurrently. In a race condition, the outcome of the program depends on which thread or process completes its execution first, leading to unpredictable or unintended behavior.

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

How to avoid Race conditions?

A

To avoide race conditions, programs utilising concurrent threads are usually
written in such a way that only one of the multiple execution threads can access
a shared data object at a time. This is called mutual exclusion (of threads)

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

What is the “Critical Section” ?

A

Critical section is a piece of code (or a group of several related pieces of code in different parts of the program code) that manipulates some shared resource and can be exeucted by only one thread at a time.

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

What does Atomicity mean?

A

Atomicity means that if multiple harts try to perform this instruction simultaneously, only one of them will perform this swap at a time.

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

What is a “Dead Lock” ?

A

Deadlock is a situation when
no hart can proceed because
the other is holding the lock it
needs

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

How to avoid Deadlocks?

A

Deadlocks can be avoided if we ensure that all harts acquire locks in the
same order (and release in the opposite order), but due to if statements and
loops in the code, it could be hard to ensure!

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

What is the concept of “Monitor”?

A

Programs written with synchronisation primitives like locks are easy to get wrong
The idea of monitor is to hide all synchronisation work inside a class or a set of functions that can be called care-free by application programs

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

How do Race Condtions arise?

A
  1. there are two or more distinct streams of instructions that share the same resource, and
  2. memory accesses from these streams intermix in time.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Context switch

A

A context switch is when the operating system saves the state of a running process or thread to switch to another, allowing multitasking. In multitasking, race conditions can occur if multiple processes access shared resources simultaneously, especially if a context switch happens at the wrong time, potentially leading to unpredictable behavior or data corruption.
AN EXAMPLE; RESULTING IN INTERLEAVED PRINTING.

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

How can we ensure
that each process
finishes printing its
message before
CPU hart switches
over to the other
process?

A

Disable
interrupts while
printing a
message!

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

How is critical sections implemented on single cpu hart?

A

On a single multitasking CPU hart, this is achieved by disabling interrupts when the hart enters a critical section, and re-enabling interrupts when it exits the critical section.

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