473,836 Members | 2,079 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to avoid deadlock?

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!
Nov 13 '05
20 10872
ho******@hotmai l.com (Dean Stevens) wrote in
<3f************ **************@ posting.google. com>:
Moron Irrwahn Grausewitz, please get a life!

*PLONK*
--
Sic transit gloria mundi.
Nov 13 '05 #11
"Arthur J. O'Dwyer" <aj*@andrew.cmu .edu> wrote in message news:<Pi******* *************** **************@ unix50.andrew.c mu.edu>...
On Tue, 2 Sep 2003, Dean Stevens wrote:

(August Derleth) wrote...
ho******@hotmai l.com (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!

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


This is false, of course. The C paradigm is not threaded, nor
oriented to deal with multiple processes. I would venture to say
that between embedded systems, MS-DOS and variants, and command-line
utilities, the vast majority of C programs do not have any *use*
for threading.


I wanted an experienced C programmer to answer my question. Any
non-trivial C programs have fork, signal, socket, or pthread. I don't
know what C grograms you are talking about?
I certainly don't expect you know them.


Then why on earth did you ask in comp.lang.c? Go ask somewhere
where threading is topical.


What a logic! Not every C programmer processes command-line utilities
like you. People have built large distributed system by using C. I
didn't expect you to answer my question. What can I expect you who
even do not have any "use" for threading?
Or, before all else fails (as it will, if you keep being so rude),
try the World Wide Web. It's the part of the Internet with the
pretty pictures. A lot of people put information there. There is
a neat little company called "Google" that can search for things
on the World Wide Web for you.


Stop raving! Go to a bookstore and pick up the Advanced Programming
in the UNIX Environment before talking about programming.
Nov 13 '05 #12
ho******@hotmai l.com (Dean Stevens) wrote in message news:<3f******* *************** **@posting.goog le.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!


Who are you? What's wrong for someone to post a question in this
group? If you cannot answer the question, just keep it quite. You
don't have the right to determine what should be asked and what
shouldn't. Are you Nazi from Germany? Or are you KKK from white
trash?
Nov 13 '05 #13
In article <e4************ **************@ posting.google. com>,
di********@yaho o.com says...
ho******@hotmai l.com (Dean Stevens) wrote in message news:<3f******* *************** **@posting.goog le.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!


Who are you? What's wrong for someone to post a question in this
group? If you cannot answer the question, just keep it quite. You
don't have the right to determine what should be asked and what
shouldn't. Are you Nazi from Germany? Or are you KKK from white
trash?


You've just invoked Godwin's Law. Too bad. Look it up. Google
is a good place to start.

It's silly season again. I.e., a new batch of CS101 students have
arrived on campus, been assigned homework problems, and granted
internet accounts.

FYI: There are thousands of Usenet groups. My particular ISP's NNTP
server currently lists 30266 of them. In order to not have them all turn
into an AOL chatroom w/the associated chaos, many technical groups try
to stay focused on a particular topic or set of topics.

comp.lang.c is for the discussion of programming in STANDARD C.
That is to say, the C language that is guaranteed to work on
all platforms with a conforming C implementation.

comp.programmin g.threads is where people discuss threaded programming.
The scope is a bit broader there, as discussions of Windows threading,
POSIX threads, and pretty much any other threading model you care to
mention is considered on topic there.

Platform-specific questions are handled in other groups. There is a long
list of groups specific to various platforms. Most good newsreaders
will allow you to search the list of all available groups for a particular
string, such as "msdos", "windows", "win32", "linux", "unix", etc.

--
Randy Howard _o
2reply remove FOOBAR \<,
_______________ _______()/ ()_____________ _______________ _______________ ___
SCO Spam-magnet: po********@sco. com
Nov 13 '05 #14
In article <3f************ **************@ posting.google. com>, howto800
@hotmail.com says...
Any non-trivial C programs have fork, signal, socket, or pthread.
A very large number of non-trivial C programs have none of the above. I
suspect a nice neural network backprop algorithm or cascade-correlation
network implementation might throw a lot of experienced C programmers into
the ditch. No strict need for any of the above, yet far, far from
trivial. The same thing can be said for a lot of types of programs. An
encryption program might be another good example.
What a logic! Not every C programmer processes command-line utilities
like you. People have built large distributed system by using C.
True they may use the C language, plus platform specific extensions.
There are newsgroups where that is very much on topic.
What can I expect you who even do not have any "use" for threading?
I don't know about the person you refer to above, but I have a lot of
"use" for threading, every day. In fact, 90% of the software I've
written in the last two years has been threaded. It's also portable
across quite a few platforms, but can not be written in standard c.
So, I just don't talk about it in this newsgroup because it is
inappropriate here. Walk down the hall to comp.programmin g.threads
for that.
Stop raving! Go to a bookstore and pick up the Advanced Programming
in the UNIX Environment before talking about programming.


I'd guess that at least 75% of the regulars have that book already.
Unfortunately, a lot of what's in the book is discussed in other
newsgroups, not this one.

Your behavior here is no different than if you walked into a bakery and
demanded that someone sell you a Bridgeport milling machine, followed by
you screaming at the teller behind the counter for "being too stupid" to
be able to assist you with one. Even if the teller was married to a
machine shop supply salesman and knew a great deal about them, I doubt she
would feel it was appropriate to hold up those wanting to buy bread to
discuss it with you for a few hours.

--
Randy Howard _o
2reply remove FOOBAR \<,
_______________ _______()/ ()_____________ _______________ _______________ ___
SCO Spam-magnet: po********@sco. com
Nov 13 '05 #15
ho******@hotmai l.com (Dean Stevens) wrote in message news:<3f******* *************** ****@posting.go ogle.com>...
li************* **@yahoo.com (August Derleth) wrote in message news:<b6******* *************** ***@posting.goo gle.com>...
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.


Heh.

Heh heh heh.

HAW HAW!

You just can't /buy/ comedy like that, folks!
Nov 13 '05 #16
Dean Stevens wrote:
Stop raving! Go to a bookstore and pick up the Advanced Programming
in the UNIX Environment before talking about programming.


*plonk*


Brian Rodenborn
Nov 13 '05 #17
On 2 Sep 2003 19:24:07 -0700, in comp.lang.c , ho******@hotmai l.com
(Dean Stevens) wrote:
"Arthur J. O'Dwyer" <aj*@andrew.cmu .edu> wrote in message news:<Pi******* *************** **************@ unix50.andrew.c mu.edu>...
On Tue, 2 Sep 2003, Dean Stevens wrote:

This is false, of course. The C paradigm is not threaded, nor
oriented to deal with multiple processes. I would venture to say
that between embedded systems, MS-DOS and variants, and command-line
utilities, the vast majority of C programs do not have any *use*
for threading.
I wanted an experienced C programmer to answer my question. Any
non-trivial C programs have fork, signal, socket, or pthread. I don't
know what C grograms you are talking about?


Probably because you apparently have no clue at all what C is, or what
an expert C programmer is either. Clue: its nothing to do with unix.
Then why on earth did you ask in comp.lang.c? Go ask somewhere
where threading is topical.


What a logic! Not every C programmer processes command-line utilities
like you.


And this relevant how? clue: its not. the topic of CLC is C, not
system specific extensions to C.
Stop raving! Go to a bookstore and pick up the Advanced Programming
in the UNIX Environment before talking about programming.


Read your post. See that word in all-caps? Is that word spelt "C"? No?
Well, then what the fsck has it got to do with C then? Free clue no 3:
all the C world is not a unix box. In fact only a very very small
fraction of it is.

--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.c om/ms3/bchambless0/welcome_to_clc. html>
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 13 '05 #18
Would you like to use the class library "http://mdthread.org/"
(Message-Driven Thread API for the Java Programming Language)?
The FAQ contains the following statement.
"A major advantage of the mdthread API over Doug Lea's utilities is
that a program based on the mdthread API is automatically
deadlock-safe.
...."
Nov 13 '05 #19

"Markus Elfring" <Ma************ @web.de> wrote in message
news:40******** *************** ***@posting.goo gle.com...
Would you like to use the class library "http://mdthread.org/"
(Message-Driven Thread API for the Java Programming Language)?
The FAQ contains the following statement.
"A major advantage of the mdthread API over Doug Lea's utilities is
that a program based on the mdthread API is automatically
deadlock-safe.
..."


What cracks me up the most is their comparison to Win32 UI threads. They
say their implementation is portable because it's "written entirely in
Java". But that means it's portable across platforms but tied to one
language. Win32 UI threads work in any language but aren't protable across
platforms. Whether that makes one more portable than the other is a tricky
question, but it's not a "yes/no" bullet item.

DS
Nov 13 '05 #20

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
6080
by: Robert Brown | last post by:
I have a deadlock that's happening on one oracle instance but cannot be reproduced on any other. It is always caused by the same SQL statement colliding with itself and only happens under very high load. The statement is DELETE from userlogins WHERE numlogins <= 0 the schema for the userlogins table is
1
4004
by: dawatson833 | last post by:
I want to set an alert for a specific table whenever an event has caused a deadlock to occur on the table. I understand how to set up an alert. But I don't know which error number to use for the New Alert error number property for a deadlock. Or how to specify a deadlock on a specific table. Thanks, DW
7
9236
by: Andrew Mayo | last post by:
Here's a really weird one for any SQL Server gurus out there... We have observed (SQL Server 2000) scenarios where a stored procedure which (a) begins a transaction (b) inserts some rows into a table (c) re-queries another table using a subquery which references the inserted table (correlated or not)
3
7632
by: Nigel Robbins | last post by:
Hi There, I'm getting a deadlock when I have two clients running the following statement. DELETE FROM intermediate.file_os_details WHERE file_uid = ? AND obj_uid There is a compound index on file_uid / obj_uid. The isolation level is UR and I have set DB2_RR_TO_RS=YES. Any thoughts why I'm getting the deadlock ?
1
4246
by: Rohit Raghuwanshi | last post by:
Hello all, we are running a delphi application with DB2 V8.01 which is causing deadlocks when rows are being inserted into a table. Attaching the Event Monitor Log (DEADLOCKS WITH DETAILS) here. From the log it looks like the problem happens when 2 threads insert 1 record each in the same table and then try to aquire a NS (Next Key Share) lock on the record inserterd by the other thread. Thanks Rohit
15
10019
by: Zeng | last post by:
Hi, The bigger my C# web-application gets, the more places I need to put in the tedious retrying block of code to make sure operations that can run into database deadlocks are re-run (retried) 3-4 times and give up if after that it's still in deadlock. I'm very sure that many experienced people out there already deal with this issue somehow. Is there an alternative to it? Thanks for your comments and suggestions.
2
8971
by: Sumanth | last post by:
Hi , I am trying to acquire a lock on a table A in exclusive mode, and this statement gives an error indicating a deadlock or timeout has been detected. The lock timeout value is set to 0 which I understand is to wait for however long it takes to acquire a lock. Also there are other processes that have acquired row level exclusive locks on the table A when this error happened.Is DB2 throwing this error as a pre-emptive measure.
0
11710
by: cwho.work | last post by:
Hi! We are using apache ibatis with our MySQL 5.0 database (using innodb tables), in our web application running on Tomcat 5. Recently we started getting a number of errors relating to java.sql.SQLException: Deadlock found when trying to get lock; Try restarting transaction message from server: "Lock wait timeout exceeded; try restarting transaction"; We get such errors generally on inserts or updates while applying a
0
1961
by: halex | last post by:
Hello, I am having deadlock problem when I have a lot of visitors on my website at the same time. I am using NetTiers templates to generate C# classes for accessing DB layer and problem is in my custom Store Procedure. I have Article table and ArticleLanguage table. One record from Article (Id, Position, StatusId) table is the same for all languages and in ArticleLanguage (Id, LanguageId, ArticleId, Name) table I have only article names...
0
9818
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9668
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10590
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10254
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9374
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6979
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5649
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5825
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3113
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.