Tcl Source Code

View Ticket
Login
Ticket UUID: 612513
Title: Detect deadlocks with TCL
Type: RFE Created on: 2002-09-21 14:45:09
Submitter: elfring Assigned to: vasiljevic
Subsystem: 80. Thread Package Severity:
Priority: 5 Medium Last modified: 2004-12-15 02:34:20
Status: Open Closed by: vasiljevic
Resolution: None Closed on: 2004-06-19 19:48:12
Version: None
Description:
I've read under "http://java.sun.com/j2se/1.4.1/changes.html#vm" about a utility that can detect deadlocks 
with the programming language "Java". (Example listing: 
http://java.sun.com/j2se/1.4.1/sample-output.html)

Can a similar tool be offered for the programming language "TCL"?
User Comments:
elfring added on 2002-09-21 22:18:15:
Logged In: YES 
user_id=572001

This tool will need some functions in the thread interface to query the dependencies between the running or 
waiting threads.
A helpful function would be to return a list of identifiers for deadlocked threads.
I suggest to offer the function "thread::is_deadlocked id", too.

elfring added on 2002-12-28 18:39:52:
Logged In: YES 
user_id=572001

The solution will be somewhere in the lock APIs. 
(http://docs.sun.com/db/doc/806-6867/6jfpgdcml?a=view)

vasiljevic added on 2002-12-29 01:40:12:
Logged In: YES 
user_id=95086

Detecting deadlock may be done be wrapping the mutex API 
i.e. providing your own set of mutex operations. 
This would, however, slow down the application.  
I might put this into the TIP I'm preparing about the  
Tcl threading API. This may be then conditionaly compiled 
for debugging purposes.

elfring added on 2002-12-29 04:58:23:
Logged In: YES 
user_id=572001

Damned - The pthread interface does not offer any function to query the 
thread and lock usage.
1. I am wondering now why this was not 
introduced into POSIX 1003.1c after this standard was available for so many 
years.
2. I'm curious for your TIP. I hope that the TCL community will find 
an other function library to retrieve the requested information.

elfring added on 2002-12-29 06:53:46:
Logged In: YES 
user_id=572001

3. Is there anything different with "Java-platform-level deadlocks" compared 
to "Tcl-platform-level deadlocks"?
What are the internal programming 
interfaces?

elfring added on 2002-12-29 19:18:02:
Logged In: YES 
user_id=572001

4. Another solution:
A detection is not needed if a system was created 
deadlock 
free.
(http://groups.google.com/groups?dq=&start=150&hl=de&lr=&ie=UTF-
8&group=comp.hypercube&selm=302%40hubcap.UUCP)

elfring added on 2002-12-30 06:07:11:
Logged In: YES 
user_id=572001

I've posted an article about the topic to some newsgroups.

elfring added on 2002-12-31 04:27:36:
Logged In: YES 
user_id=572001

I add some links to helpful information about algorithms and 
technologies.

4. Can any experiences from "Communicating 
Sequential Processes" (http://www.cs.ukc.ac.uk/projects/ofa/jcsp/csp-
java-model-abstract.html) be applied for TCL?

5. A book 
(http://groups.google.de/groups?selm=12785%40star.cs.vu.nl&rnum=159)
Title: 
    Modern Operating Systems
Author: Andrew S. Tanenbaum
ISBN:   
0-13-588187-0

elfring added on 2003-01-16 16:01:58:
Logged In: YES 
user_id=572001

http://groups.google.de/groups?
group=comp.programming.threads&selm=40ed1d8f.0301150519.
60fc9f36%40posting.google.com

dkf added on 2003-01-21 22:56:41:
Logged In: YES 
user_id=79902

Would you guys want me to set up a mailing list for
discussion of thread-related issues?  It'd come with useful
things like archiving tools too...

elfring added on 2003-01-22 03:44:48:
Logged In: YES 
user_id=572001

Yes. But I would like a newsgroup (interface) 
more...

com.programming.threads.tcl ?

vasiljevic added on 2004-06-20 02:48:12:
Logged In: YES 
user_id=95086

The deadlock prevention using exclusive mutexes is
now handled in the upcomming 2.6 threading extension.
Instead of deadlock, the Tcl error is thrown.
Also, the deletion of sync promitives in use is also 
terminated with Tcl error.

elfring added on 2004-12-15 02:34:20:
Logged In: YES 
user_id=572001

Interesting - But the improvement that you describe is just
the expected error handling.

Can a TCL function be added that will be equivalent or
similar to the method "findMonitorDeadlockedThreads" of the
"Threading MBean"?
Would you like to reuse anything from the article "Using
JConsole to Monitor Applications" by Mandy Chung?
http://java.sun.com/developer/technicalArticles/J2SE/jconsole.html#DeadlockDetection