Re: basic thread issue

From: Michael Borgwardt (brazil_at_brazils-animeland.de)
Date: 01/23/04


Date: Fri, 23 Jan 2004 18:16:58 +0100

jim wrote:
> Do threads make contention to method varaibles? I remember threads can make
> contention to instance variables. In order to protect instance variable
> integrity, I can use synchronized as a method modifier or use synchronized
> block inside method body. For a method, each thread has a different
> allocated memory space. Is this right?

local variables live on the stack, and each thread has its own stack, yes.



Relevant Pages

  • basic thread issue
    ... Do threads make contention to method varaibles? ... contention to instance variables. ... integrity, I can use synchronized as a method modifier or use synchronized ...
    (comp.lang.java.programmer)
  • Re: basic thread issue
    ... > contention to instance variables. ... local variables themselves are not shared across threads. ... you will not have synchronization problems. ...
    (comp.lang.java.programmer)
  • Re: basic thread issue
    ... >> contention to instance variables. ... > can be synchronization problems. ... because they contain no mutable instance variables. ... FirstSQL/J Object/Relational DBMS ...
    (comp.lang.java.programmer)
  • Re: basic thread issue
    ... >> Threads have contention for objects, ... > they contain no mutable instance variables. ... The _reference_ of a local variable will never be changed by another ...
    (comp.lang.java.programmer)
  • Re: basic thread issue
    ... >> Threads have contention for objects, ... > because they contain no mutable instance variables. ... Thanks for pointing out that contention can occur on class variables. ...
    (comp.lang.java.programmer)