Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > How to avoid deadlock?

Reply
Thread Tools

How to avoid deadlock?

 
 
Dean Stevens
Guest
Posts: n/a
 
      09-01-2003
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!
 
Reply With Quote
 
 
 
 
Irrwahn Grausewitz
Guest
Posts: n/a
 
      09-01-2003
http://www.velocityreviews.com/forums/(E-Mail Removed) (Dean Stevens) wrote in
<(E-Mail Removed)>:

>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!


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.
 
Reply With Quote
 
 
 
 
Oliver S.
Guest
Posts: n/a
 
      09-01-2003
> 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?


When you're under Win32, this is quite easy; just do a WaitFor
MultipleObjects on the semaphore as well as the process handle.
 
Reply With Quote
 
Duke Robillard
Guest
Posts: n/a
 
      09-02-2003
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!


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

 
Reply With Quote
 
Irrwahn Grausewitz
Guest
Posts: n/a
 
      09-02-2003
Duke Robillard <(E-Mail Removed)> wrote in <(E-Mail Removed)>:
Please do not crosspost to c.l.c, thanks; fup2 c.p.t set.
--
Air is water with holes in it.
 
Reply With Quote
 
August Derleth
Guest
Posts: n/a
 
      09-02-2003
(E-Mail Removed) (Dean Stevens) wrote in message news:<(E-Mail Removed) m>...
> 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!


<Fixed meaningless crosspost.>

Semaphores, threads, and the very concept of processes (and,
therefore, IPC) are not part of the C standard. Therefore, asking
about it in comp.lang.c is not a very good way to get good answers.
Next time, stick to a newsgroup focused on your specific topic and
don't scatter your posts to the wind. It's better that one experienced
person who knows what he's talking about see your post than a thousand
irritated Usenetters who don't know the answer but do know about the
etiquette of our fine medium.
 
Reply With Quote
 
Dean Stevens
Guest
Posts: n/a
 
      09-02-2003
(E-Mail Removed) (August Derleth) wrote in message news:<(E-Mail Removed) om>...
> (E-Mail Removed) (Dean Stevens) wrote in message news:<(E-Mail Removed) m>...
> > 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!

>
> <Fixed meaningless crosspost.>
>
> Semaphores, threads, and the very concept of processes (and,
> therefore, IPC) are not part of the C standard. Therefore, asking
> about it in comp.lang.c is not a very good way to get good answers.
> Next time, stick to a newsgroup focused on your specific topic and
> don't scatter your posts to the wind. It's better that one experienced
> person who knows what he's talking about see your post than a thousand
> irritated Usenetters who don't know the answer but do know about the
> etiquette of our fine medium.


An expert C programmer has to deal with multi-process and
multi-thread. I certainly don't expect you know them. You are just
too stupid to be embarrassed.
 
Reply With Quote
 
Dean Stevens
Guest
Posts: n/a
 
      09-02-2003
Irrwahn Grausewitz <(E-Mail Removed)> wrote in message news:<(E-Mail Removed)>. ..
> Duke Robillard <(E-Mail Removed)> wrote in <(E-Mail Removed)>:
> Please do not crosspost to c.l.c, thanks; fup2 c.p.t set.


Moron Irrwahn Grausewitz, please get a life!
 
Reply With Quote
 
Irrwahn Grausewitz
Guest
Posts: n/a
 
      09-02-2003
(E-Mail Removed) (Dean Stevens) wrote in
<(E-Mail Removed) >:
<SNIP>
>An expert C programmer has to deal with multi-process and
>multi-thread.

Which does not make it topical here.

--
If you don't care where you are, then you ain't lost.
 
Reply With Quote
 
Alex
Guest
Posts: n/a
 
      09-02-2003
Dean Stevens <(E-Mail Removed)> wrote:
> (E-Mail Removed) (August Derleth) wrote in message news:<(E-Mail Removed) om>...
>> (E-Mail Removed) (Dean Stevens) wrote in message news:<(E-Mail Removed) m>...
>> > 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!

>>
>> <Fixed meaningless crosspost.>
>>
>> Semaphores, threads, and the very concept of processes (and,
>> therefore, IPC) are not part of the C standard. Therefore, asking
>> about it in comp.lang.c is not a very good way to get good answers.
>> Next time, stick to a newsgroup focused on your specific topic and
>> don't scatter your posts to the wind. It's better that one experienced
>> person who knows what he's talking about see your post than a thousand
>> irritated Usenetters who don't know the answer but do know about the
>> etiquette of our fine medium.


> An expert C programmer has to deal with multi-process and
> multi-thread. I certainly don't expect you know them. You are just
> too stupid to be embarrassed.


Congratulations. You have just drastically decreased your chances of
getting any kind of help from this newsgroup.

There is a newsgroup dedicated to the subject that you want to discuss.
comp.lang.c is not it. Read the FAQ before posting here again.

Alex

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Avoid having a SQL express for web parts and avoid personalization Roger23 ASP .Net 2 10-12-2006 10:54 PM
Airlink101 PCI cards, AVOID!! Piece of Garbage!! lasurfer25@yahoo.com Wireless Networking 0 07-22-2005 02:44 AM
Avoid wasting time or how to avoid initialization Alexander Malkis C++ 8 04-13-2004 11:23 PM
avoid sending pictures within email Zhang Weiwu (family name first) Firefox 1 09-11-2003 02:00 PM



Advertisments