[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Thread.stop, suspend and resume deprecation in 1.2
Dear Oyvind,
It is very sensible of Sun to remove Thread.stop(), Thread.suspend(), and
Thread.resume(). These methods are dangerous to use and you don't need
them! With the CJT and JCSP libraries there are no dangerous methods such
as resume, suspend and stop! The CJT library only uses the Java monitor -
synchronized(this), wait(), and notify() - construct (I belief this is the
same for the JCSP library).
I wish they also remove the Thread.setPriority(i) and Thread.getPriority().
These methods make priorities in Java absolute; a thread (i.e. process
object) has priority 5 or 6. The programmer has a lot of responsibility to
take care of priorities. Relative priorities are much simpler; a process
has a lower priority than that process and a higher priority than this
process. This is where the PriParallel comes in. With the PriParallel a
process itself has no priority, but the thread executing the process has a
priority assigned by the PriParallel. These threads are encapsulated within
the Parallel and PriParallel objects.
At the moment we are developing a PriParallel construct which implements an
embedded scheduler. The PriParallel is a process itself and enables nesting
PriParallels. With a nested PriParallel construct you will have a scheduler
running within a scheduler. Each PriParallel supports 8 priorities, 7
priorities available for processes and the lowest priority is reserved for
the idle task, skip task, or for a "real-time" garbage collector task. Our
prototype PriParallel works for our simple test scripts. Now we are testing
the PriParallel for more complex compositions and we are implementing an
Interrupt Service Routine framework that simulates external interrupts to
our scheduler. The embedded scheduler is written in 100% Java and simulates
a context switch with suspend() and resume(). These methods are faster than
resp. wait() and notify(). The context switch method could be written in
native code for very fast context switching. For JDK 1.2 we have found a
workaround (which would decrease the context switch time a bit) to create a
context switch method without suspend() and resume() in Java.
Cheers,
Gerald.
Oyvind Teig wrote:
Dear all
Thread.stop, Thread.suspend and Thread.resume will
be deprecated in 1.2
I believe the CSP libraries that have been written
at the moment depend on them at a very few places.
See
http://java.sun.com/products/jdk/1.2/docs/guide/misc/
threadPrimitiveDeprecation.html
Cheers,
Oyvind Teig, Autronica, Trondheim, Norway
Oyvind.Teig@xxxxxxxxxxxx
Tel.: +47 73 58 12 68
Fax.: +47 73 91 93 20