Intel® Moderncode for Parallel Architectures
Support for developing parallel programming applications on Intel® Architecture.

What is "deadlock-safe"?

ClayB
New Contributor I
616 Views
I received an announcement in my email for Message-Driven Java Threads API this morning. Apparently, Java threads can send and receive message between themselves with this API.

Perusing the few paragraphs of the announcement I came across the term "deadlock-safe" which I didn't understand. I know what "deadlock-free" would imply. Since I'm unfamiliar with Java Threads and may not be up-to-date on the most current lingo in that area, I went to the proffered website and still didn't find anything.

Can anyone give me a definition/description of "deadlock-safe"? How is this important to Java Threads, especially for those that can pass messages? Examples would help this old, tired brain grasp any new-fangled concepts.

Thanks.

-- clay
0 Kudos
3 Replies
Intel_C_Intel
Employee
616 Views
> Perusing the few paragraphs of the announcement I
> came across the term "deadlock-safe" which I didn't
> understand.

Lock-free is deadlock-free. Java is using some lock-free algos. RCU... They have classes for atomic primitives that can implement many lock-free algos.

If a piece of code is holding a complex set of locks, and calls an API which uses its own locking schema... Sometimes you can deadlock yourself. I think there is a link on MSDN somewhere about this issue.


This is an example of a lock & deadlock-free algo

Message Edited by intel.software.network.support on 12-09-2005 01:41 PM

0 Kudos
Intel_C_Intel
Employee
616 Views
> I'll buy the lock-free is deadlock-free. I assume
> that you can get rid of one or more of the conditions
> for deadlock by doing this?

Yep.


> If the Java primitives do use
> lock-free methods to achieve a deadlock-free
> implementation

Java uses lock-free algos in it new dictionary:

Java Runtime Improvements

And its event multi-caster. Maybe RCU?


> For example, two
> threads both execute a blocking receive expecting the
> other thread to do the send operation first.

INFINITE blocking will deadlock for sure, if your not safe.


> Does the Java thread message passing API
> implementation not have blocking operations?

Not sure. I don't use Java.


> Perhaps
> each operation is timed and this could break the
> deadlock cycle.

That would do it.


P.S.

Is this similar to the message you got?

Deadlock Safe Java API?
0 Kudos
ClayB
New Contributor I
616 Views
> P.S.
>
> Is this similar to the message you got?
>
> Deadlock Safe Java API?

Yes, that is the product I was sent information about.

I don't use Java, either, so I'm not sure about some of the Java specific questions I posed. (I think we had one admitted Java Threads user in the Forum at one time. I was hoping they could have given some insights.)

--clay
0 Kudos
Reply