parallel processing - Does Clojure (or JCE, or JVM, or...?) introduce parallelism automatically? -


i running cpu-intensive clojure code within intellij idea (i don't think that's important - seems spawn process). according both htop , top, using 4 cores (well, 2 + hyperthreading) on laptop. despite me not having explicit parallelism in code.

a little more detail: top shows single process ~380% cpu use, while htop shows "parent" process , 4 "children", each 1/4 time , ~100% cpu.

is normal? or mean have got wrong somewhere? code involves many lazy sequences, @ core modifies mutable data structure (a mutable - not clojure data structure - hash accumulates results). i not using explicit parallelism.

a significant amount of time (i haven't profiled) spent in jca/jce (crypto lib) - using multiple aes ciphers in ctr mode, each stream of secure random bytes (code here), implemented lazy seqs. perhaps parallelized?

more random ideas: related io? i'm running on encrypted ssd , program processing data disk, lot of reading. htop shows system time red, , these green.

sorry such vague question. can post more info if required. clojure 1.4 on 64bit linux (jdk 1.7.0_05). code being executed here it's pretty messy (more apologies) , spread across various files (most cpu time spent in nearest-in-dump in code there). note - please don't waste time trying run code reproduce, expects pre-existing data-dump on disk (which isn't in git).

debugger running in debugger (thanks, a-m) shows 4 threads (if understand debugger correctly), 1 executing program. labelled finalizer, main (the program), reference handler, , signal dispatcher. finalizer + ref handler in wait state; signal dispatcher has no frames available. tentatively think means parallelism @ lower level, perhaps in crypto implementation?

aha think it's parallel gc (java has concurrent collector). @ start, cpu use jumps way when actual process pauses (it prints out regular tick). , since it's churning through lots of data it's generating lot of short-lived objects (confirmed using -xx:+useserialgc reduces cpu use 100%)

ok, feel bit dumb posting looks pretty obvious, seems parallel gc. processing lot of data (sucking in ssd) , generating lots of short-lived objects. , appears jvm has parallel gc. see http://blog.ragozin.info/2011/12/garbage-collection-in-hotspot-jvm.html

it may sign of problem - what going on java gc? permgen space filling up? - investigate tomorrow (i didn't mention - although in retrospect should have - borderline running out of memory).

update: running -xx:+useserialgc reduces total cpu use 100% (ie 1 core). didn't mean 2 explanations above exclusive, better configuration and/or code reduce amount of gc.


Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -