• Post Reply Bookmark Topic Watch Topic
  • New Topic

Multithreading and JNI  RSS feed

 
MarkS Johnson
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a puzzling problem.

We have a Java application that starts multiple threads - each of which uses JNI to call native ioctls in order to work on a hardware device. Here's the question: What happens to the thread when the native method blocks for I/O? Is it considered blocked in the usual way, which should allow one of the other threads to go do its thing?

The question arises because it doesn't look like we get ANY parallelism out of our algorithm - it looks like each native method invocation runs all the way to completion before another thread gets to run at all - which isn't what we wanted, of course.

Thanks for any help!
Mark S. Johnson
 
Natarajan Shankar
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Johnson,
Is it possible to buffer the data then write to the original space. Let's say if your native method copying file from one server to another, so instead of copying directly if your using buffer to copy the content first and later to original space it might have a kind of parallelism?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!