• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

C++ vs Java Concurrency performance

 
Robert Heath
Ranch Hand
Posts: 94
C++ Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).
 
Robert Heath
Ranch Hand
Posts: 94
C++ Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic