Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6194521
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T03:18:36+00:00 2026-05-24T03:18:36+00:00

I have a quad core processor and the ThreadPoolExecutor is set to 4 core

  • 0

I have a quad core processor and the ThreadPoolExecutor is set to 4 core threads, but when I submit my callables (hundred or so) to the ThreadPoolExecutor, Java never uses more than 25% CPU. Why does it not use all of them?

Code in question:

static class Sum implements Callable{
    private double bigarray[];
    public Sum(double [] bigarray){
        this.bigarray = bigarray;
    }
    @Override
    public Double call(){
        double sum = 0;
        for (int i = 0; i < bigarray.length; i++){
            sum += bigarray[i];
        }
        return sum;
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T03:18:37+00:00Added an answer on May 24, 2026 at 3:18 am

    In general, currently there is no interface in Java to control cores and processors affinity so your code (and threads) is scheduled by OS as it finds right. You might not like it.
    As it was said well Running multiple threads on multiple CPU cores?

    In general that is not a job for the JVM; it is the OS that allocates
    a core for a thread, the JVM is just a program. If you’re running this
    on an MS Windows machine you can try to set the ‘affinity’ for the
    JVM, i.e. tell the scheduler (task manager) what CPUs (cores) the JVM
    is allowed to use.

    But I do not think this is a way to go.

    See the answer to Stack Overflow question How does Java makes use of multiple cores?.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a quad core machine and would like to write some code to
This sample code compares serial method with threaded method, on Quad core processor. The
I recently updated my computer to a more powerful one, with a quad-core hyperthreading
I've got a reasonably pumped processor (Core 2 Quad) benching around 1/3rd of the
Currently we have developed application using Java 6 based on windows 32bit(Dual core &
I have a LAMP server (Quad Core Debian with 4GB RAM, Apache 2.2 and
I have server with two quad core processors, installed windows 2003 standard edition. I
I have a quad core system with third party application that once in a
If I have a class like this: typedef union { __m128 quad; float numbers[4];
I have a simple load test that is using one TestMethod on a quad

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.