Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Re: Do you use a garbage collector (java vs c++ difference in "new")

Reply
Thread Tools

Re: Do you use a garbage collector (java vs c++ difference in "new")

 
 
Roedy Green
Guest
Posts: n/a
 
      04-12-2008
On Sat, 12 Apr 2008 10:18:12 -0700, "Chris Thomasson"
<(E-Mail Removed)> wrote, quoted or indirectly quoted someone who
said :

>Roedy! Not Reedy... CRAP!


Don't worry. Nearly everyone gets it wrong. Even my mother sometimes
called me "Roger".
--

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
 
Reply With Quote
 
 
 
 
Roedy Green
Guest
Posts: n/a
 
      04-12-2008
On Sat, 12 Apr 2008 10:08:31 -0700, "Chris Thomasson"
<(E-Mail Removed)> wrote, quoted or indirectly quoted someone who
said :

>to increment a pointer location off of common base memory.


The initial discussion was about how Object.hashCode could be
implemented. That COULD be done with a global counter. You would
need simple synchronisation (e.g. an atomic memory increment)
instruction to share it among threads.

In a similar way you can do a fast object allocation simply by
incrementing the free space pointer, either one per thread with
separate pools or with a synchronised global one.

The two discussions became muddled and intertwined. I think also there
was confusion between what you might write IN Java vs assembler code
inside the JVM to handle to low level details of object allocation.
--

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
 
Reply With Quote
 
 
 
 
Roedy Green
Guest
Posts: n/a
 
      04-12-2008
On Sat, 12 Apr 2008 13:31:12 GMT, Mark Thornton
<(E-Mail Removed)> wrote, quoted or indirectly quoted
someone who said :

>(Ignoring for now that there isn't one Java allocator), typically there
>is a per thread area so these counters do not need locks.


Also consider the JVM does not have to use heavyweight Java-type
object locks. It can get away with much more light-weight techniques.
It can "cheat". This object allocation code has to be blindingly fast,
and all sorts of techniques you would never dream of using in
application code become legit.

All you have to do is read one GC paper to see this IS rocket science.
We can only scratch the surface in these discussions.
--

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
 
Reply With Quote
 
Mark Thornton
Guest
Posts: n/a
 
      04-12-2008
Roedy Green wrote:
> On Sat, 12 Apr 2008 13:31:12 GMT, Mark Thornton
> <(E-Mail Removed)> wrote, quoted or indirectly quoted
> someone who said :
>
>> (Ignoring for now that there isn't one Java allocator), typically there
>> is a per thread area so these counters do not need locks.

>
> Also consider the JVM does not have to use heavyweight Java-type
> object locks. It can get away with much more light-weight techniques.
> It can "cheat".


JVM's often use highly optimised locking techniques even for regular
objects (e.g. synchronized methods). In some cases they can even
eliminate a lock altogether via escape analysis. This gets done even for
a newbies code whereas a junior programmer trying to achieve similar
locking performance in C++ is unwise at best. Even 10 years ago, JVMs
adapted locking to suit the machine at run time (faster locking on
single processors than multi cpu systems).

Mark Thornton
 
Reply With Quote
 
Mirek Fidler
Guest
Posts: n/a
 
      04-14-2008
On Apr 13, 7:42 pm, "Chris Thomasson" <(E-Mail Removed)> wrote:

OFFTOPIC: Chris, I have tried to send you an email concerning AppCore.
Have you got it?

Mirek
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Do you use a garbage collector (java vs c++ difference in "new") Juha Nieminen Java 10 04-13-2008 08:35 PM
Re: Do you use a garbage collector (java vs c++ difference in "new") Arne Vajh°j Java 12 04-13-2008 12:13 AM
Re: Do you use a garbage collector (java vs c++ difference in "new") asterisc Java 6 04-12-2008 12:09 AM
Re: Do you use a garbage collector (java vs c++ difference in "new") Ian Collins Java 2 04-11-2008 09:24 AM
Re: Do you use a garbage collector (java vs c++ difference in "new") Ian Collins Java 0 04-11-2008 02:41 AM



Advertisments