thread scheduling mechanism in SUN's VM

I've the problem, that n threads share a resource

(sharedObject).

The synchronization is done in an synchronized

Block:

synchronized( sharedObject )

{

// do something with sharedIbject

}

I would like to know in which order the thread scheduler

of SUN Solaris VM of the JDK 1.3 or in general,

gives the lock of the sharedObject to one of the thread, which

are waiting for the lock of the sharedObject.

Is there something like FIFO, so that it's safe, that all waiting

threads will get the sharedObject in the right order,

or do i have to implement a queueing mechanism with wait and

notify.

thanks

[716 byte] By [frankki] at [2007-9-26 10:14:58]
# 1

If you're writing a Java program that uses threads, the thing to do is to follow the rules that Java provides, not the rules of a particular thread scheduler.

There is no guarantee about which order the threads will get access to the sharedObject without writing explicit code for it.

schapel at 2007-7-1 22:17:20 > top of Java-index,Java HotSpot Virtual Machine,Specifications...