开发者

Alternatives to JNI->MonitorEnter

I came across a JNI Native code which uses JNI->MonitorEnter and JNI->MonitorExit JNI calls to synchronize a piece of native code. But this has now become a bottleneck and affecting the system throughput badly. I am considering any synchronization mechanisms alternate to JNI's MonitorEnter and MonitorExit.

Do you know 开发者_运维知识库of any alternate design?

[Some links http://java.sun.com/docs/books/jni/html/other.html , http://download.oracle.com/javase/6/docs/technotes/guides/jni/spec/functions.html#wp5256 ]


Is it the time spent taking the monitor that's the problem. Or (more likely in my view) the time spent while the lock is held? If you need to protect a piece of JNI code, then you single thread there so it's likely to become a bottleneck.

Can you minimise the critical section in any way? Can you rewrite the code to be thread-safe?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜