방학 중 Study의 일환으로 지도 교수님의 과제를 하면서 정리하게 된 글 입니다
Homework4 of Operating System, 2020 Spring
from https://github.com/hongshin/OperatingSystem
Compeleted Task in implementation
Cyclic deadlock monitor
- Probe part : ddmon.c
- Overriding pthread_mutex_lock and pthread_mutex_unlock
- Through named pipe, send runtime information to ddchck
- Checker part : ddchchck.c
- Through named pipe, receive runtime information from ddmon
- Target program for deadlock
- new_target.c
- deadlock example program of peers
The task to do
- Based on the cyclic deadlock monitoring algorithm, draw directly lock graphs
- Devise how ddchck detect deadlock through cycles of graph for acquiring and releasing lock
Cyclic deadlock monitoring algorithm
- Monitor lock acuires and releases in runtime
- Lock graph ( N, E_N)
- When a thread acquire lock X, a node n_x is created
- When a thread holding lock X acuire lock Y, a edge ( n_x, n_y ) is created
- When a thread releases lock X, ( *, n_x ) edges are removed and if there are no threads which had acquired X, a node n_x is removed
- When the graph has any cycle, the deadlock is reported
Today I Implemented
- Lock graph
- Based on struct Node and struct Edge, I devised member functions for initializing them, inserting them to list, deleting them to list
- Directly drawing lock graphs, I thought and discussed about different cases for dead lock considering number of lock and number of thread
- Through several testing from example program of deadlock, I found what needs to be improved and I supplemented them in implementing lock graph