Josef “Jeff” Sipek

Interactivity During nightly(1)

Every so often, I do a nightly build of illumos on my laptop. This is a long and very CPU intensive process. During the build (which takes about 2.75 hours), the load average is rarely below 8 and most of the time it hovers in the low twenties. (This is a full debug and non-debug build with lint and all the other checking. If I need a build quickly, I can limit it to just what I need and then we’re talking minutes or seconds.)

Anyway, as you might imagine this sort of load puts some pressure on the CPUs. As a result, some interactive processes suffer a bit. Specifically, Firefox doesn’t get enough cycles to render the modern web (read: JavaScript cesspool). Instead of suffering for almost three hours, I just change Firefox’s scheduling class from IA (interactive) to RT (real time):

# priocntl -s -c RT `pgrep firefox`

This allows Firefox to preempt just about everything on my laptop. This works because Firefox actually yields the CPU properly. This will probably bite me sometime in the future when I end up on a page with such a busted JavaScript turd that it takes over a CPU and won’t let go. Till then, I have a pretty good workaround.

2 Comments »

  1. Does that mean I can link you to a page with while(true) { } and hang your machine? :D

    Guess what this does! https://jsfiddle.net/h3cbcosq/

    (On my machine it'll eventually prompt to stop an unresponsive script, but where's the fun in that? I assume Chrome / Chromium will behave differently due to having separate processes.)

    Comment by Steve — June 2, 2015 @ 19:37

  2. Heh. Firefox does have some "kill unresponsive script" functionality/dialog. So, worst case Firefox can chew up 1 core - more or less preventing many system threads from running on it. The good news is, I have 3 other cores (or 7 hyperthreads if your into that sort of thing) to pick up the slack.

    The link didn't do anything very interesting. It took a couple of seconds, but it did eventually load with a while-true type snippet. I decided to leave promptly. ;)

    Comment by JeffPC — June 4, 2015 @ 18:56

Atom feed for comments on this post.

Leave a comment

Powered by blahgd