[SLUG] SMP-friendly scripting

From: Eben King (eben01@verizon.net)
Date: Thu May 24 2007 - 00:43:59 EDT


I got a dual-core CPU (etc) a month or so ago. I need to rewrite some of my
scripts to take advantage of the second CPU. Is there a relatively easy way
of doing that? I've thought about:

- generating a Makefile on the fly, and then calling "make -j
   2". This requires learning enough about Makefiles to twist it to do my
   nefarious deeds. I know very little of Makefiles, so the learning curve
   is a definite downside.

- "xargs -n 2"; what it'll do is run pairs at a time, and if one of the two
    takes longer than the other, tough noogies; it won't run the next pair
    until _both_ current processes exit. So it's better than serial
    execution, but not optimal.

- all get backgrounded. This works, but uses a _lot_ of RAM, maybe more
   than I have, which will make it swap and maybe take longer than if I had
   run one after the other.

So what's a dual-core-havin' scripter to do?

-- 
-eben   QebWenE01R@vTerYizUonI.nOetP   royalty.mine.nu:81

He who will not reason is a bigot; he who cannot is a fool; and he who dares not is a slave. -Sir William Drummond ----------------------------------------------------------------------- This list is provided as an unmoderated internet service by Networked Knowledge Systems (NKS). Views and opinions expressed in messages posted are those of the author and do not necessarily reflect the official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 16:32:00 EDT