[1725] in java-interest

home help back first fref pref prev next nref lref last post

Re: Threads don't make sense

daemon@ATHENA.MIT.EDU (mpasqui@UOFT02.UTOLEDO.EDU)
Fri Sep 15 06:37:59 1995

Date: Thu, 14 Sep 1995 14:24:00 -0400 (EDT)
From: mpasqui@UOFT02.UTOLEDO.EDU
To: java-interest@java.sun.com


I received several responses  to my earlier post but I'm still not too
happy about the multithreading. (My earlier post questioned the need
for the 'syncronization' modifier given that same priority threads
don't preempt). Some excellent points were brought to my attention
that certainly validate the need for the synchronization modifier.
This includes threads which block in their critical sections (allowing
other threads (regardless of priority) to attempt entry into the
critical section - i.e. syrnchonization stops them). This case 
is undeniably a factor. Other factors include multiprocessor machines
which do have true simultaneous processes.

I think my annoyance comes from the fact that I can't produce a classic
'critical section' that will become violated with Java threads - i.e.

 public void run() {
   a = instvar;         // instvar is an object instance variable
                        // and 'a' is a static class var (shared resource)
   a = a + 5;
   System.out.println(a);
 }

Of course the dream of all good mutex programmers is that 'a' will get 
more than one 5 added to it before it prints (several threads running)
adding yield or sleep doesn't help since that is a static point of 
yielding control to other threads.

-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post