distributed_systems_MIT/lec05

lec05

dz / distributed_systems_MIT / lec05

Node Tree

Nodes

go
content the Go Progamming language
children goroutines, memory_model, primitives, concurrency (Concurrency primitives in go)

concurrency
content Concurrency
children goroutines, primitives
parents go

primitives
content Primitives
children goroutines, mutexes, periodic_function, channels, closures, condition_variables
parents go, concurrency

goroutines
content Goroutines
children expressivity_not_performance
parents concurrency, primitives, go

expressivity_not_performance
content not used for performance reasons, but expressivity
parents goroutines
flashcard (front) Are goroutines good for performance?
flashcard (back) While goroutines may help with performance, they are primarily used for expressivity

memory_model
content Memory Model in Go
parents go
remarks There was a paper that discussed how the memory model works. The wisdom boiled down here is "don't be clever".

closures
content Closures
children identifier_capture
parents primitives

identifier_capture
content Identifier Capture
children scope_correct
parents closures

scope_correct
content Make sure scope is correct
parents identifier_capture

periodic_function
content Period Function: Run something, sleep, run again, etc.
children periodic_function_variation (variation of periodic function pattern)
parents primitives

periodic_function_variation
content Periodic Function Variation: Periodic Until (Some Conidition)
parents periodic_function

mutexes
content Mutexes (Mutual Exclusion)
children protects_invariants (Mutexes protect against invariants), run_atomically, critical_section
parents primitives

serial
content Serial
parents run_atomically

run_atomically
content Makes blocks of code run atomically
children serial
parents mutexes

critical_section
content Critical Section: region of code inside the mutex. this is guaranteed mutual exclusion The region of code found inside a mutex
parents mutexes
flashcard (front) Critial Section
flashcard (back)

protects_invariants
content Mutexes protect invariants
parents mutexes
remarks Probably would be a good idea to define this better

condition_variables
content Condition Variables
children threads_waiting (CV are used to coordinate when condition comes true), cv_wait
parents primitives

threads_waiting
content Used when threads are wiating for some condition to come true
parents condition_variables
flashcard (front) What is a conidition variable and when should it be used?
flashcard (back) Condition variables are Go primitives used when you have threads are waiting for some condition to come true.

cv_wait
content wait: called when it is waiting
parents condition_variables

cv_broadcast
content broadcast: called when something is changed
children wakes_up

wakes_up
content Wakes up whoever is waiting.
children lost_wakeup_problem
parents cv_broadcast

lost_wakeup_problem
content The lost wakeup problem
parents wakes_up
remarks This was mentioned in the lecture, but I forget what it means. I think it was a vague mention in the lecture.

channels
content Channels
children probably_avoid, synchronous, wait_groups (channels used as an approach for wait groups), channels_useful_for
parents primitives

synchronous
content Synchronous
children blocking
parents channels
remarks Communication Mechanism

blocking
content Blocking behavior
parents synchronous

channels_useful_for
content Useful for
parents channels

producer_consumer
content producer/consumer
remarks vaguely mentioned. not sure?

probably_avoid
content channels should probably be avoided most of the time
parents channels

wait_groups
content Can be used as an approach for wait groups
children threads_to_be_done
parents channels

threads_to_be_done
content Wait Group waits for a certain number of threads to be done.
parents wait_groups

raft
content RAFT
children common_bugs (Common bugs when implementing RAFT), debugging

common_bugs
content Common Bugs
children holding_lock, attempt_election_function
parents raft

holding_lock
content Holding lock through RPC calls causes deadlock
parents common_bugs

attempt_election_function
content Attempt an election
children elected_two_leaders
parents common_bugs

elected_two_leaders
content Bug: elected two leaders, when there should be only one.
children double_check
parents attempt_election_function

double_check
content One Solution: double check that the term is the same, and that they are still a candidate
parents elected_two_leaders

debugging
content Debugging RAFT implementations
children race_flag, where_stuck
parents raft

where_stuck
content Where stuck?
children log_printf, minimize_scope
parents debugging

log_printf
content Log.printf(...)
children dprintf
parents where_stuck

minimize_scope
content Minimize scope of bug
parents where_stuck

dprintf
content dprintf() wrapper
parents log_printf

race_flag
content Using the "-race" flag to check for race coniditions
parents debugging