File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes C / C++ and the fly likes C++ vs Java Concurrency performance Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Languages » C / C++
Bookmark "C++ vs Java Concurrency performance" Watch "C++ vs Java Concurrency performance" New topic
Author

C++ vs Java Concurrency performance

Robert Heath
Ranch Hand

Joined: Aug 11, 2010
Posts: 94

How do the performance criteria vary between C++ and Java for concurrency primitives like semaphores, time from relinquishing control to the time the next process takes control?
Anthony Aj Williams
author
Ranch Hand

Joined: Jun 10, 2011
Posts: 56
Robert Heath wrote:How do the performance criteria vary between C++ and Java for concurrency primitives like semaphores, time from relinquishing control to the time the next process takes control?


There aren't any performance criteria required by either standard as far as I am aware. However, in both cases I expect the writers of the runtime to attempt to minimize such transition time. I expect C++ to be at least as fast as Java in that respect since the C++ runtime will directly use the most appropriate OS primitive, whereas the Java code may have to go through an intermediate layer (which may be omitted if the runtime has compiled that section of code to native code).


Author of C++ Concurrency in Action http://www.stdthread.co.uk/book/
just::thread C++11 thread library http://www.stdthread.co.uk
Just Software Solutions Ltd http://www.justsoftwaresolutions.co.uk
15 Carrallack Mews, St Just, Cornwall, TR19 7UL, UK. Company No. 5478976
Robert Heath
Ranch Hand

Joined: Aug 11, 2010
Posts: 94

I wonder if there would be a scheduler for Java to be in the JVM in addition to the scheduler for the native OS. Plus where do the concurrency primitives live for Java, in the JVM or the native OS? In C++ I would expect to see the only scheduler to be in the OS. But I really don't know.

Has anyone seen performance benchmarks to measure the time from suspending one process, because of concurrency primitives (like semaphores), and beginning the next process in C++ and Java.
Anthony Aj Williams
author
Ranch Hand

Joined: Jun 10, 2011
Posts: 56
Robert Heath wrote:I wonder if there would be a scheduler for Java to be in the JVM in addition to the scheduler for the native OS. Plus where do the concurrency primitives live for Java, in the JVM or the native OS? In C++ I would expect to see the only scheduler to be in the OS. But I really don't know.

Has anyone seen performance benchmarks to measure the time from suspending one process, because of concurrency primitives (like semaphores), and beginning the next process in C++ and Java.


The details will clearly depend on the JVM, the C++ compiler and runtime, and the OS.

I am not aware of any such benchmarks.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: C++ vs Java Concurrency performance
 
Similar Threads
Synchronization and Performance
How to control concurrency??????
Object pooling
Important?
Interview question about synchronization in threads