1/24
Looks like no tags are added yet.
MySQL, Apache, Mozilla, OpenOffice
types of bugs exist, focus on four major open-source applications
Non Deadlock Bugs
make up a majority of concurrency bugs
Atomicity Violation Bugs
the desired serializability among multiple memory accesses is violated
Add locks
solution to atomicity violation bugs, simply _ _ around the shared-variable reference
Order Violation Bugs
the desired order between two memory accesses is flipped
Condition Variables
solution to order violation bugs, enforce ordering using _ _
Deadlock Bugs
the presence of cycle
Complex Dependencies
in large code bases, _ _ arise between components, why do deadlocks occur? (1)
Encapsulation
due to the nature of _, why do deadlocks occur? (2)
Mutual Exclusion
threads claim exclusive control of resources that they require
Hold and Wait
threads hold resources allocated to them while waiting for additional resources
No preemption
resources cannot be forcibly removed from threads that are holding them
Circular wait
there exists a circular chain of threads such that each thread holds one more holds one more resources that are being requested by the next thread in the chain
Cannot occur
if any of these four conditions are not met, deadlock _ _
Circular Wait
provide a toral ordering on lock acquisition
Global locking strategies
circular wait, this approach requires careful design of _ _ _
Hold and Wait
acquire all locks at once, atomically
Decrease concurrency
hold-and-wait problem
No Preemption
multiple lock acquisition often get us into trouble because when waiting for one lock we are holding another
Trylock()
used to build a deadlock-free, ordering-robust lock acquisition protocol
Trylock()
grab the lock (if it is available, or return -1: you should try again later)
Livelock
two threads might be running through the code sequence (acquiring the lock) over and over again but failing to acquire the lock
Livelock
progress is not being made through
Random delay
livelock solution, add a _ _ before looping back and trying the entire thing over again
Lock-free, wait free
using powerful hardware instructions (atomic)