Difference in MultiThread aspect between Java and C/C++

Java does provide read-write locks - http://download.oracle.com/javase/6/docs/api/java/util/concurrent/locks/ReadWriteLock.html.

Have a look at the java.util.concurrent package if you haven't already. I suspect Java's support is comparable to C's. There are also a number of web servers written in Java that use either multithreaded or async IO (NIO).


Java is slightly higher level than C/C++ in most aspects, mainly due to the abstraction that the JVM provides. Thus it is less efficient and further from the OS.

synchronized methods are an example of this, the implementation can use different mechanisms depending on the underlying OS.

Due this lower efficiency C/C++ is preferred for some tasks where efficiency is very important, as the ones you mention.

I would consider that (abstraction due to JVM and thus higher level) as the main reason and source of differences between C/C++ and Java, being how threads are handled and other differences just aspects or consequences of this main difference.

Specifically about read-write locks, Java provides the tools to use them (as pointed in previous comments), and most probably any synchronization method you may want to use is available or implementable in Java in some way. How the JVM translates this to OS calls and the efficiency of the result is a different matter.