如何避免死锁? [英] How to avoid deadlock?

查看:105
本文介绍了如何避免死锁?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个进程:一个持有信号量,另一个等待信号量
。当持有信号量的进程死了,

就会发生死锁。我的问题是,无论如何(在信号量或

运行系统中)是为了避免这种情况?谢谢!

I have two processes: one holds a semaphore and the other waits for
the semaphore. When the process which holds the semaphore is dead,
the deadlock occurs. My question is there is anyway (in semaphore or
operating systme) to avoid such situation? Thanks!

推荐答案

ho ****** @ hotmail.com (迪恩史蒂文斯)写在

< 3f ************************ @ posting.google.com>:
ho******@hotmail.com (Dean Stevens) wrote in
<3f************************@posting.google.com>:
我有两个进程:一个持有信号量,另一个等待信号量。当持有信号量的进程死亡时,就会发生死锁。我的问题是,无论如何(在信号量或
操作系统中)都有避免这种情况吗?谢谢!
I have two processes: one holds a semaphore and the other waits for
the semaphore. When the process which holds the semaphore is dead,
the deadlock occurs. My question is there is anyway (in semaphore or
operating systme) to avoid such situation? Thanks!




C编程语言(clc中唯一的主题)不知道任何关于信号量,amphores或者其他任何东西的信息。


所以,请不要把它交叉到clc;谢谢!


-

我希望生活有一个回滚缓冲区。



The C programming language (the only topic in c.l.c) does not
know anything about semaphores, amphores or whatever-phores.

So, please don''t crosspost this to c.l.c; thanks!

--
I wish life had a scroll-back buffer.


Dean史蒂文斯写道:
Dean Stevens wrote:
我有两个进程:一个持有一个信号量,另一个等待信号量。当持有信号量的进程死亡时,就会发生死锁。我的问题是,无论如何(在信号量或
操作系统中)都有避免这种情况吗?谢谢!
I have two processes: one holds a semaphore and the other waits for
the semaphore. When the process which holds the semaphore is dead,
the deadlock occurs. My question is there is anyway (in semaphore or
operating systme) to avoid such situation? Thanks!




如果你使用的是UNIX SysV信号量,你可能想在semget()上使用

SEM_UNDO标志。这告诉内核撤消

如果进程转储核心,所有进程的semops。


Duke



If you''re using UNIX SysV semaphores, you might want to use the
SEM_UNDO flag on your semget(). That tells the kernel to undo
all a process''s semops if the process dumps core.

Duke


Duke Robillard< du ** @ io.com>写在< 3F ************** @ io.com>:

请不要交叉到c.l.c,谢谢; fup2 c.p.t设定。

-

空气是带水洞的水。
Duke Robillard <du**@io.com> wrote in <3F**************@io.com>:
Please do not crosspost to c.l.c, thanks; fup2 c.p.t set.
--
Air is water with holes in it.


这篇关于如何避免死锁?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆