On Thursday, December 6, 2012 3:18:42 AM UTC+1, 長島徹 wrote:
>
> Thanks for the response.
>
> Can I avoid or lessen that worker threads delay the JavaScript main thread?
> 4 CPU cores exists and HT supported.
> (I think ... the priority of main thread set to higher, ...?)
>

The main thread can get pre-empted if you saturate all the cores in your 
machine. (And yes, it would be possible in theory to ramp up the priority 
of the main thread with pthread_setschedparam; you'll have to hack node or 
create a compiled addon to do that though.)

That however is not the "problem" that you are seeing here. Your seem to 
assume that "reading and compressing a file" is executed as a single 
operation in a thread pool thread. That's not how it works; node will first 
read a small chunk of data in the thread pool, then compress it, then write 
out the compressed data while reading in a new chunk of data in parallel, 
etc. Effectively, each of your "compress-a-file" operations are broken up 
in small chunks that are interleaved and partly run in parallel on the 
thread pool; that's why you see them complete all at the same time.

- Bert

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to