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 8209487
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T09:44:20+00:00 2026-06-07T09:44:20+00:00

I am running some CPU-intensive Clojure code from within Intellij Idea (I don’t think

  • 0

I am running some CPU-intensive Clojure code from within Intellij Idea (I don’t think that’s important – it seems to just spawn a process). According to both htop and top, it is using all 4 cores (well, 2 + hyperthreading) on my laptop. This is despite me not having any explicit parallelism in the code.

A little more detail: top shows a single process with ~380% CPU use, while htop shows a “parent” process and then 4 “children”, each with 1/4 the time and ~100% CPU.

Is this normal? Or does it mean I have got something very wrong somewhere? The code involves many lazy sequences, but at its core modifies a mutable data structure (a mutable – not a Clojure data structure – hash that accumulates results). I am not using any explicit parallelism.

A significant amount of time is likely (I haven’t profiled) spent in JCA/JCE (crypto lib) – I am using multiple AES ciphers in CTR mode, each as a stream of secure random bytes (code here), implemented as lazy seqs. Perhaps that is parallelized?

More random ideas: Could this be related to IO? I’m running on an encrypted SSD and this program is processing data from disk, so does a lot of reading. But htop shows system time as red, and these are green.

Sorry for such a vague question. I can post more info if required. This is Clojure 1.4 on 64bit Linux (JDK 1.7.0_05). The code being executed is here but it’s pretty messy (more apologies) and spread across various files (most CPU time is spent in nearest-in-dump in the code there). Note – please don’t waste time trying to run code to reproduce, as it expects a pre-existing data-dump to be on disk (which isn’t in git).

debugger Running in the debugger (thanks, A-M) shows four threads (if I understand the debugger correctly), but only one is executing the program. They are labelled finalizer, main (the program), reference handler, and signal dispatcher. Finalizer + ref handler are in wait state; signal dispatcher has no frames available. I tentatively think this means the parallelism is at a lower level, perhaps in the crypto implementation?

Aha I think it’s parallel GC (Java now has a concurrent collector). At the start, CPU use jumps way up when the actual process pauses (it prints out a regular tick). And since it’s churning through lots of data it’s generating a lot of short-lived objects (confirmed by using -XX:+UseSerialGC which reduces CPU use to 100%)

  • 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-07T09:44:22+00:00Added an answer on June 7, 2026 at 9:44 am

    OK, I feel a bit dumb posting this as it now looks pretty obvious, but it seems to be parallel GC. I am processing a lot of data (sucking it in from an SSD) and generating lots of short-lived objects. And it appears that the JVM has parallel GC. See http://blog.ragozin.info/2011/12/garbage-collection-in-hotspot-jvm.html

    It may also be a sign of a problem – What is going on with java GC? PermGen space is filling up? – which I will investigate tomorrow (I didn’t mention it – although in retrospect I should have – but this is borderline running out of memory).

    Update: Running with -XX:+UseSerialGC reduces the total CPU use to 100% (ie 1 core). But I didn’t really mean that the two explanations above were exclusive, only that with better configuration and/or code I could reduce the amount of GC.

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

Sidebar

Related Questions

I'm writing some pretty CPU-intensive, concurrent numerical code that will process large amounts of
I was running some code that did a printout in a swingworker. I was
I have some Clojure code that is simulating and then processing numerical data. The
I am running some C code, compiled to 32bit x86 on Linux. And I
I'm running some code through FxCop and am currently looking at clearing all of
For my current job I am writing some long-running (think hours to days) scripts
if (reader.is_lazy()) goto tldr; I have a background thread that does some I/O-intensive background
I have some scripts that use a ton of cpu is it possible to
I have mainly CPU intensive operation which is running on a thread pool. Operation
Some CPU intensive routines get dramatically slower when run through a debugger. Why is

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.