From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11643 invoked from network); 6 Jan 2000 12:04:27 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 6 Jan 2000 12:04:27 -0000 Received: (qmail 2315 invoked by alias); 6 Jan 2000 12:04:12 -0000 Mailing-List: contact zsh-users-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 2834 Received: (qmail 2306 invoked from network); 6 Jan 2000 12:04:10 -0000 Message-ID: <3874847D.A2ED4AE3@u.genie.co.uk> Date: Thu, 06 Jan 2000 12:03:09 +0000 From: Oliver Kiddle X-Mailer: Mozilla 4.7 [en] (Win95; I) X-Accept-Language: en MIME-Version: 1.0 To: Andre Pang CC: zsh-users@sunsite.auc.dk Subject: Re: Prompt expansion, multi-job for References: <20000106194432.A488@bozar.ihug.com.au> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Andre Pang wrote: > 2) Is there any way to emulate make's -jn option in the for command? > This would be *really* useful for SMP systems. Currently, doing something > like "for i in ***/***.wav; do l3enc $i; done" doesn't take advantage of > multiple CPUs (on a Linux system, at least); hacking the for command to > accept a 'make -j'-like parameter (eg: for -j2 i in *; do l3enc $i; done) > would allow us lucky ones who have SMP systems to do many things similar to > the above without going mad and writing silly Makefiles simply so we can > utilise make -j. If someone's written a function to do this already (Bart? > ;) it'd be *very* cool. If I'm not mistaken, you should be able to do this by running l3enc as a background process, i.e. for i in *.wav; do l3enc $i& done. I haven't got an SMP system available to me to test but I'd assume that it would allocate different l3enc processes to different processors. Putting the process in the background means that zsh will get control back straight-away and can run the next l3enc. The trouble with this is that it will attempt to run all the l3encs together. If you have say 4 processors, it may be most efficient to run a maximum of 4 l3encs at once. This would be a bit messy to implement in Zsh (compared to something like Ada) but can be done. Oliver Kiddle