[1798] in java-interest
Re: Threads don't make sense
daemon@ATHENA.MIT.EDU (Jim Graham)
Sun Sep 17 01:04:58 1995
Date: Wed, 13 Sep 1995 15:54:09 -0700
From: flar@bendenweyr.Eng.Sun.COM (Jim Graham)
To: java-interest@java.Eng.Sun.COM, mpasqui@UOFT02.UTOLEDO.EDU
> So the question is, what good is the synchronization modifier?
> Two threads couldn't be in the same method at the same time anyway
> since the first must specifically and purposefully yeild to any others
> (i.e. the first 'could' yeild inside a synchronized method but that
> seems to detract from the whole idea even further).
A number of cases would make this fail:
Some (future) implementations of Java may preempt threads
within a priority level. Higher priority threads are
guaranteed to preempt, but that does not mean that same
priority threads won't...
If a higher priority thread preempts you in the middle of
the critical method, there is no specification for which
of the threads gets resumed when it is done. You may be
preempted and the next thread at the same priority may
get resumed and then run into the same critical method
unless you use the synchronized modifier.
On multi-processor machines, you may both be running the
critical method at the same time.
...jim
-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com