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

  • SEARCH
  • Home
  • 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 7775253
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T17:35:00+00:00 2026-06-01T17:35:00+00:00

While trying to debug why my multi threaded Java application is consuming large amount

  • 0

While trying to debug why my multi threaded Java application is consuming large amount of CPU I found that each thread executes an external command which is not at all CPU intensive but when Java runs it, I find Java runtime taking 100% of my CPU.

To further debug, I’ve replaced that external process with simple Linux “ls” command. here is how I am running it-

String[] commands = new String[]{"/bin/sh", "-c", "ls"};
            try {
                Process p = Runtime.getRuntime().exec(commands);
             } catch (IOException ex) {
               //
}

Still, I see Java using all of the CPU.

I am not even reading any output from process, nor opening any sort of stream.

What could be wrong? How come a simple ls command when run externally from Java is causing Java runtime to consume large CPU?

Instead of running external command, to simulate thread processing, I tried putting Thread.Sleep() and it works fine- no more CPU hog

  • 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-06-01T17:35:02+00:00Added an answer on June 1, 2026 at 5:35 pm

    Looks like a known issue, I guess I would need to use this- https://github.com/axiak/java_posix_spawn

    Update:

    After using java_posix_spawn, problem is gone!

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

Sidebar

Related Questions

Today I experienced a weird problem while trying to remotely debug an application built
I'm trying to debug an application that download a lot of resources from internet.
While I trying to debug a 'C' program with gdb, I always get the
While trying to generate classes from a xsd, i got this error: java.lang.IllegalArgumentException: Illegal
While trying to connect to a database that's set to read only, the connection
While trying to verify to myself, that C# Equals for IEnumerables is a reference
While trying out an experimental UINavigationController-based iPhone application, I ran into a problem when
Im trying to debug application on Acer Iconia but the usb Debugging mode wont
While trying to debug my program in Xcode 4.2, I turned on breakpoints and
While trying to configure eclipse, tomcat to debug a maven project I am getting

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.