Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Mac OS X > Dual processor use by piped Unix commands?

Dual processor use by piped Unix commands?
Thread Tools
Mac Elite
Join Date: Jul 2000
Location: Dallas, TX, USA
Status: Offline
Reply With Quote
Sep 28, 2003, 10:59 AM
 
If I do this:

longCommand < in | longCommand2 > out

on a dual processor machine, I would expect that longCommand would run on one processor and its output would be fed into longCommand2 on the other processor.

Has anyone verified that such actually happens?


(Yes, I am not sitting on a dual processor machine right now. But I am suddenly curious.)
     
Mac Enthusiast
Join Date: Oct 2000
Status: Offline
Reply With Quote
Sep 28, 2003, 11:10 AM
 
Tell me what to enter in the Terminal and I'll do it for you. I just don't know with what command to feed my Dual 1.25 G4 long enough to watch `top` long enough...
     
Mac Enthusiast
Join Date: Oct 2000
Status: Offline
Reply With Quote
Sep 28, 2003, 12:22 PM
 
Yes, it does use the second CPU. No wonder actually, it's just two processes which are scheduled by the OS no matter if they have a pipe in between or not.

I let a 400 MB text file full of nonsense run through a series of `sed` single-character replacement while watching `top` besides. Completely meaningless, but uses some CPU for a while:

sed -e s/a/b/ bigfile.txt | sed -e s/x/y/ | sed -e s/q/r/ | sed -e s/r/w/ | sed -e s/b/v/ > /dev/null
     
kennedy  (op)
Mac Elite
Join Date: Jul 2000
Location: Dallas, TX, USA
Status: Offline
Reply With Quote
Sep 29, 2003, 08:42 AM
 
Originally posted by danengel:
Yes, it does use the second CPU. No wonder actually, it's just two processes which are scheduled by the OS no matter if they have a pipe in between or not.
Thanks. That's what I thought; and that's how it should be. But I wanted to verify it... but didn't have a dual to run the test.

Thanks!
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 03:47 AM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2