プリエンプションを使用してデッドロックを回避するプロセスを理解していますが、コードに入れるのは苦労しています。デッドロックを回避するためのプリエンプション
であるY スレッドT1、T2とリソースW、X、使用してデッドロックを回避するためにプリエンプションの私の理解:
thread t1 -> has resource X. request resource W
thread t2 -> has resources W, Y. request resource X
t1 checks if resource W is free. if it's not free, don't acquire resource X or release it.
をt2 executes. Releases resources W, Y, X
t1 executes
どのように私はCで、上記のようなものを実装については行くべき++?どんな助けもありがとうございます。