chapter 6 Flashcards
deadlock (Verklemmung)
passive waiting and semaphores introduce deadlocks, which is a situation where 2 or more processes are stuck, each waiting for the other to release a resource, leading to a standstill
in this case, processes enter a state of passive waiting, where they are blocked and cannot proceed. the processes remain in the BLOCKED state until the deadlock is resolved.
- they can be identified
livelock
processes are caught in busy waiting, where they are running but make no actual progress. despite being in RUNNING state, they dont make any progress
- more evil than deadlocks
4 conditions for a deadlock to occur
1- mutual exclusion: only one process can use a resource at any given time
2- hold and wait: a process thats holding at least one resource can request additional resources without releasing its current ones
3- no preemption
4- circular waiting: a circular chain of processes, where each process is waiting for a resource thats being held by the next process in the chain
operating resources (OR) (Betriebsmittel)
1- consumable OR: produced and consumed during runtime, such as interrupts, signals. they use unilateral synchro, meaning consumed/handled by one process
A deadlock can happen when 2 processes are waiting for a COR to be produced by the other. Both processes call wait( )
2- reusable OR: are allocated by processes for a certain period of time and then released, such as CPU, main and second mem, I/O devices, files. They use multilateral synchro or mutual exclusion
A deadlock can happen when 2 processes compete for a ROR, for example allocating mem
resource allocation graphs (RAGs) (Betriebsmittelbelegungsgraphen)
nodes are processes and resources
edge are requests or occupation
deadlock prevention -vorbeugung (most relevant)
- indirect methods: focus on invalidating one of the 3 deadlock conditions
- direct methods: aim to invalidate the last condition
deadlock avoidance - vermeidung (less relevant)
- ongoing resource requirement analysis, which continuously monitors and analyses resource usage to eliminate the possibility of circular waiting
- system must always maintin a safe state where processes are guaranteed to get their resources.
- avoid entering the unsafe state by
deadlock detection (less relevant)
some deadlocks cannot be prevented.
system creates a waiting graph where nodes represent processes and edges represent resources, cycles in the graph represent deadlocks
deadlock recovery
after detecing it:
1- terminate deadlocked processes one by one
another approach would be to revoke OR from one or more of the deadlocked processes
virtualisation
used to mitigate deadlocks by allowing processes to use logical OR instead of directly interacting with physical OR.