[OS] Cyclic deadlock monitoring algorithm

Kieun Kim·2021년 8월 11일

방학 중 Study의 일환으로 지도 교수님의 과제를 하면서 정리하게 된 글 입니다

Homework4 of Operating System, 2020 Spring
from https://github.com/hongshin/OperatingSystem

Compeleted Task in implementation

Cyclic deadlock monitor

  1. Probe part : ddmon.c
    • Overriding pthread_mutex_lock and pthread_mutex_unlock
    • Through named pipe, send runtime information to ddchck
  2. Checker part : ddchchck.c
    • Through named pipe, receive runtime information from ddmon
  3. Target program for deadlock
    • new_target.c
    • deadlock example program of peers

The task to do

  1. Based on the cyclic deadlock monitoring algorithm, draw directly lock graphs
  2. 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
profile
Connecting dots

0개의 댓글