[concurrency-interest] questions regarding object creation

Rémi Forax forax at univ-mlv.fr
Sun Mar 2 21:37:04 EST 2008


Yechiel Feffer a écrit :
>
>    1. is the "new" operation concurrent ? i.e. assuming the class has
>       already been introduced to the jvm, is the object creation
>       concurrent to other objects creation ?
>
Yes, because GCs are copying-collectors, new is performed using a CAS .
Moreover, some VMs use  a heap by thread.
see http://openjdk.java.net/groups/hotspot/docs/HotSpotGlossary.html 
(search TLAB).
>
>   1.
>
>
>    2. is creation of an object that implements an interface more
>       expensive than creation of , say the same object  which does not
>       implement one ?
>
no.
>
>   1.
>
>
>    2. same goes for inheritance- how extra-costly is it ?
>
no.
see http://en.wikipedia.org/wiki/Virtual_table
>
>   1.
>
>
>  
>
>  
>
> Thanks,
>
> Yechiel     
>
cheers,
Rémi


More information about the Concurrency-interest mailing list