Re: IKVM Compiled DLL and multithreading

"Micle, Florin" <[email protected]>
Newsgroups gmane.comp.java.ikvm.devel
Message-ID <[email protected]>
Is the access to the clr.dll from IKVM synchronized? It looks like most of my contentions are in the clr.dll, calls coming from IKVM.OpenJDK.Core.dll. Is the implementation of the OpenJDK synchronized so that only one thread at a time can actually call into the clr.dll? That would basically explain the performance degradation I see with the increased number of threads.

I wrote some simple app that starts a few threads that do a lot of computations and nested loops and they behave as expected. In fact the performance explorer in Visual Studio reports 0 contentions, although obviously clr.dll is heavily used.

Thanks in advance,
Florin


From: Jeroen Frijters [mailto:[email protected]]
Sent: Thursday, April 10, 2014 11:04 AM
To: Micle, Florin; [email protected]
Subject: RE: IKVM Compiled DLL and multithreading

Without actual code I can only guess, but it could be related to synchronization. In HotSpot, synchronization is heavily optimized (because of the brain damaged design of the early days Java collection classes) and .NET synchronization is not very optimized at all.

Regards,
Jeroen

From: Micle, Florin [mailto:[email protected]]
Sent: Thursday, April 10, 2014 17:56
To: [email protected]<mailto:[email protected]>
Subject: [Ikvm-developers] IKVM Compiled DLL and multithreading

Hello everyone,

I used IKVMC to compile a jar into a .NET DLL. The jar does some intensive math computations, maxing out the CPU core on which the thread runs.

In Java each thread will max out at 12.5% CPU (because I have 8 cores, 100% / 8 = 12.5% max CPU per thread). It works fine if I have one thread or 6.

If I use this in the .NET world, one thread will use 12.5% CPU, 2 threads will use about 11% CPU each, 3 threads about 9%, 4 threads about 7% each. The performance of each thread degrades considerably the more threads I have. Doesn't happen if I use the jar from a java app.

It feels like it's something deep inside the compiled .NET DLL there is some serialization that occurs, some resource contention... no idea... I tried setting the apartment option to MTA when compiling the jar and it didn't make a difference.

Any suggestions would be highly appreciated.

Best Regards,
Florin Micle

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech

_______________________________________________
Ikvm-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ikvm-developers
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.