I use some CPU intensive Clojure code from Intellij Idea (I don't think this is important - it seems to just spawn the process). According to both htop and top, it uses all 4 cores (well, 2 + hyperthreading) on โโmy laptop. This is despite the fact that I do not have explicit parallelism in the code.
A little more detailed: in the upper part one process with ~ 380% CPU usage is shown, and htop shows the "parent" process, and then 4 "children", each of which has 1/4 time and ~ 100% CPU.
This is normal? Or does it mean that I have something very bad? The code includes a lot of lazy sequences, but inherently modifies a mutable data structure (a mutable data structure without changes Clojure is a hash that accumulates results). I do not use explicit parallelism.
A significant amount of time, probably (I did not profile), spent in JCA / JCE (crypto lib) - I use several AES ciphers in CTR mode, each as a stream of safe random bytes (the code here ), implemented as lazy seqs. Perhaps this is parallelizing?
More random ideas: Could this be related to IO? I work on an encrypted SSD, and this program processes data from disk, so it reads a lot. But htop shows the system time as red, and they are green.
Sorry for such a vague question. If necessary, I can post additional information. This is Clojure 1.4 on 64-bit Linux (JDK 1.7.0_05). The executable code is here , but it is rather dirty (more apologies) and spreads over various files (most of the processorโs time is spent on nearest-in-dumpthe code there). Note. Do not waste time trying to run the code to play, as it expects a pre-existing data dump to be on disk (which is not in git).
. (, A-M) ( ), . , (), . Finalizer + ref ; . , , parallelism , , ?
Aha , GC ( Java ). CPU , ( ). , ( -XX: + UseSerialGC, 100%)