0

I've been writing an application for matrix multiplication.

I've got it done and watched resource monitor for comparison.

First of all

  1. 3000x3000 matrixes multiplied.
  2. Single threaded was slower than multi threaded
  3. When I check Windows resource monitor, I see that multithreading app has more threads than single threaded. I checked "javaw.exe" and even if I write single threaded app, it has more threads than one. That's not about me. That's about "javaw.exe" itself. But long story short, javaw with single thread showed - for example - 16 threads. Multi threaded showed - for example - 24.
  4. While multi threaded app working, CPU use was almost 100%. Most of use belong to "javaw.exe". But in single threaded app, the use was around 30-35%

I've a i5 CPU. Dual core. 4 cores logical.

When I check Windows resource monitor, for multi thread app, CPU 0-1-2-3 use was almost 100%, again.

But in single thread app, CPU 0-1-2-3 was still using. Around same percentages, but not even close to 100%.

Here goes my question. When I was executing single threaded app, who was using the other cores? Of course any other process can use them. Or even "javaw.exe" itself (I told myself, it was multithreaded). But is there any possibility that JVM executes my single threaded process as multi threaded?

2
  • 1
    The JVM always executes multiple threads (e.g. the GC thread). Commented May 15, 2016 at 9:08
  • Yeah I thought that. Thanks for correcting me though. I think there is no way converting single threaded app to multi threaded by JVM, right? Commented May 15, 2016 at 9:21

1 Answer 1

1

But is there any possibility that JVM executes my single threaded process as multi threaded?

No. The JVM will have multiple threads but it won't and can't just decide to multithread your program unless you create the threads yourself (or use some other multithreading mechanism like Executor).

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for your answer. I know it does not make any sense. But I wanted to double check.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.