Clojure (or JCE, or JVM, or ...?) Introduces parallelism automatically?

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%)

+5
1

, , , , GC. ( SSD) . , JVM GC. . http://blog.ragozin.info/2011/12/garbage-collection-in-hotspot-jvm.html

- java GC? PermGen ? - ( , - ).

. -XX: + UseSerialGC 100% (.. 1 ). , , / GC.

+4

All Articles