Jason
Jason

Reputation: 1129

Ruby on Rails and multi-core CPUs

I have been doing some test on my Pentium D (an old dual core CPU). As far as I understood Ruby was single threaded, so I have a hard time understanding why both cores are utilized ot the max (100%) when crating new Rails projects, etc. In addition, the tests were done on Ruby 1.8.7 i386, known to be a slow implementation of the runtime and Ruby is anyway known for not being heavily multi-threaded.

Any ideas what is going on here? Would Rails benefit from a quad processor?

enter image description here

Upvotes: 1

Views: 1289

Answers (1)

sled
sled

Reputation: 14625

It's OS related.

When you run a single-threaded application on a multi-core CPU both cores can be affected because:

  • Your OS (Windows in your case) does its job at the same time.
  • Multiple other Processes (Threads) are requesting CPU time constantly (multiple times per seconds). If your OS and the processes have no thread affinity this will cause your threads to swap from one CPU to the other and vice-verse.

Upvotes: 3

Related Questions