操作系统课件5_1.pptVIP

  • 1
  • 0
  • 约9.46千字
  • 约 62页
  • 2017-11-15 发布于河南
  • 举报
操作系统课件5_1

哲学家就餐问题—管程解决方法 Procedure put_down(I:0..4); Begin fork[I]:=free; signal(q[I]) End; Procedure init; Var I:0..4; Begin For I:=0 to 4 Do fork[I]:=free; End; Begin init End; * 哲学家就餐问题—管程解决方法 Var forks:dining_philosophers; I号哲学家活动: Repeat {thinking} with_two_forks:=false; Repeat forks.pick_up(I); If forks.try_pick_up((I+1)mod 5) Then with_two_forks:=true Else forks.put_down(I) Until with_two_forks; {Eating} forks.put_down(I); fork

文档评论(0)

1亿VIP精品文档

相关文档