TM - Distributed Systems Flashcards
What is a Distributed System
Several Distributed components under a single system.
Features of a Distributed System
Can communicate with a message. Typically executed concurrently and autonomously. Coordinated through a computer network. Physically close or geographically distant. Memory can be shared or individual. Communication slow and unreliable.
Examples of a Distributed System
The WWW, Online Games, An Office Network.
Why build a Distributed System
Some problems are distributed by nature. Cost, Performance, Availability (Fault tolerant), Physical/Geographic Reasons.
Multithreading
Multiple threads of execution in a single app. Threads =/= cores.
Example of why use multithreading
UI apps can block while waiting for user input, this blocked work can execute on another thread.
Also video games use multithreading to render frames.
Fork-Join Model
Parallel Programming Paradigm. Threads can be executed separately but logic is not always independent and can cause interleavings.
Fork (Fork-Join)
Divides the task into smaller subtasks, creating parallel threads or processes to handle them
Join (Fork-Join)
Gathers results from parallel threads or processes and combines them for the final result.
Restricting possible interleavings
Race Condition. Atomic Actions. Critical Sections. Mutual Exclusion.
Race Condition
Occurs when the app behaviour depends on the timing of execution sequences in a multithreaded environment.
Atomic Action
An action to be executed as one unit
Critical Section
Group of instructions to be executed atomically. Executed by a single process at a time (Mutually exclusive).
Mutual Exclusion
One thread of execution never enters its critical section at the same time that another thread in execution is entering its critical section.
Lock
A synchronization tool used to control resource access from multiple threads of execution. Relies on using lock() and unlock().