Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Use renice to give DropStuff a speed boost Apps
The UNIX renice command controls how much CPU "attention" a given application will receive. The default value is 0, and the "lowest" priority is 20 while the "highest" priority is -20 (yes, it seems backwards). Up until 10.1, renice wasn't functional in OS X. Since the release of 10.1, though, we've run a few hints involving renice to speed certain processes.

Today, I stumbled across another use that made a huge difference for me. I was using DropStuff to stuff iMovie 2.1.1 (which I had kept around, just in case, when iMovie3 came out). The process was going slowly, especially since I had about 15 other apps open, and DropStuff was in the background. If I moved it to the foreground, it sped up notably, but I wanted to work on other stuff ... so I thought I'd try renice to see what impact it had. In the Terminal, I typed ps ax | grep DropStuff to find out the "process ID" of the DropStuff application:
 2295  ??  S      0:00.51 /Applications/Utils/DropStuff 7.0.....
 2300 std  R+     0:00.00 grep DropStuff
In order to run renice, you need the process ID, which is the first item output from (in this case, 2295). With that information, I could now renice the process by typing sudo renice -20 2295. Within a second of hitting return (after entering my admin password), the DropStuff operation sped up by an amazing amount -- files were now clicking by at more than two or so per second, and the time estimate dropped by 50%. More importantly, though, iTunes kept chugging right along without a skip, and the system remained responsive, and DropStuff's speed didn't change much at all, regardless of whether it was in the foreground or background.

So if you've got a task lumbering along in the background, try throwing a renice at it. If you don't like the results, just repeat the command with a 0 value instead of -20 to return to the default.

If you prefer to use the GUI over the command line, VersionTracker lists a few candidates. I haven't tried any of those applications, however, so you're on your own...
    •    
  • Currently 3.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (2 votes cast)
 
[15,910 views]  

Use renice to give DropStuff a speed boost | 15 comments | Create New Account
Click here to return to the 'Use renice to give DropStuff a speed boost' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
WARNING: Only `renice` to -10
Authored by: DouglasDD on Jun 18, '03 12:22:52PM
Yes, `renice` will allow you to set the priority of any process all the way up to the absolute max (-20).

BUT, by doing so you risk crippling your machine, here's why:
If the process that you set to pri -20 were to get stuck in tight infinite loop, it would hog 100% of your CPU time, and prevent all other process with lower priorities from running (even the dock or window manager)!
This kind of behavior can be triggered by software bugs, and un-anticipated input/ output/ environment (i.e.: the destination disk accidentally unmounted before DropStuff completed).

SO, you should only `renice` a process to a limit of -10.

All the best,
DouglasDD

[ Reply to This | # ]

WARNING: Only `renice` to -10
Authored by: osxpounder on Jun 18, '03 04:31:55PM

Thanks for mentioning that! I am trying this out right now--compressing a 15min raw DV capture into an MPEG-2 video with Cleaner 6 in the background whilst I surf this site and a few others. I reniced Cleaner to 10 on your advice--I can't tell if it's making a difference, but events are proceeding, at least, so it doesn't seem to have hurt. I certainly don't want to keep Cleaner in the foreground just to get the best reasonable compression speed out of it.

I'm glad I didn't set it to renice at 20; thanks so much for the warning.

---
--
osxpounder



[ Reply to This | # ]
WARNING: Only `renice` to -10
Authored by: foobar104 on Jun 19, '03 11:22:29AM

Erm, I don't think that's true. Priorities are arranged in bands. You have normal user jobs at the bottom, kernel tasks above them, and real-time tasks at the top. Real-time tasks can be scheduled in such a way that the operating system itself can't interrupt them, but this requires special programming and superuser privilege. Ordinary user tasks--tasks not running as the root user--can't preempt the kernel.

Nice doesn't set the scheduling priority of a task. It just nudges the task up and down a little in the priority queue. So doing a nice -20 isn't going to hurt anything.

(Incidentally, nice makes perfect sense when you remember the intent of the command: it's called *nice*. You use it to set the "niceness" value of a task. More nice means less priority. Less nice means more priority. So nice -20 is higher priority and nice +20 is lower priority.)



[ Reply to This | # ]
Use renice to give DropStuff a speed boost
Authored by: malvolio on Jun 18, '03 01:03:39PM

Another GUI for renicing (and my personal favorite) is Process Wizard:
http://www.versiontracker.com/dyn/moreinfo/macosx/13366
It puts an icon in your menubar which provides drop-down menus showing all running processes. Each process has a slider bar which can be used to set the nice level to any value from 20 to -20.

---
/mal



[ Reply to This | # ]
Use renice to give DropStuff a speed boost
Authored by: Rod76 on Jun 18, '03 02:51:44PM

I also found just typing in the apps name works as well instead of using its PID ie. sudo renice -10 DropStuff



[ Reply to This | # ]
SMP
Authored by: eo on Jun 18, '03 03:06:16PM
It's too bad StuffIt doesn't use more than one CPU... I'll bet Raymond Lau could devise an algorithm to make efficient use of threading. ;-)

[ Reply to This | # ]
Use renice to give DropStuff a speed boost
Authored by: nofutureuk on Jun 18, '03 06:05:39PM

This hint is total nonsense. The renice command only reprioritizes a process in the kernel's process table. If you leave it at the default value, the system will give as much CPU as is left to that app. If you have other apps running which eat up your CPU, you should close them effectively speeding up your dropstuff.

In fact, it is very bad practice to use -20 as a value for user-space tools. It basically states that anything else running on your system has to wait. I am not sure (and you shouldn't be sure too), that you want all your system tasks effectively be put back to lower priority.

Especially, don't forget that if your have 2 apps running, both apps with take the needed CPU time even if you have executed your renice command.

This is the basis of multitasking. Unless you want to run something in a pseudo realtime fashion, just keep your fingers away from renice and you will be perfectly happy.

This is tuning crap that leads to nothing.



[ Reply to This | # ]
Use renice to give DropStuff a speed boost
Authored by: Darkshadow on Jun 18, '03 08:36:11PM

No, that's not quite true. When you renice a program to -20, it takes up as much of the processor as it can, but it *doesn't* block other applications from using the processor. They can still use it, and will. They'll run a bit slower, yes, but they *won't* stop running.



[ Reply to This | # ]
Use renice to give DropStuff a speed boost
Authored by: nofutureuk on Jun 19, '03 02:52:43AM

Re-read what I said, and you will see, that my response is in no way telling it stops other processes...
Don't put words in my mouth.



[ Reply to This | # ]
Theory vs. practice...
Authored by: robg on Jun 18, '03 09:31:33PM

I had 15 apps running in "user space," including iTunes, iMovie, Excel, Word, Safari, Mail, etc. At no time was the system unresponsive, iTunes never skipped a beat, and I was able to switch apps with ease.

All I really noticed was that the DropStuff app was running literally twice as fast in the background as it had been before.

it was my understanding that even with a -20 value, you can't prevent other apps from getting the CPU they need to do their jobs...

-rob.



[ Reply to This | # ]
Theory vs. practice...
Authored by: nofutureuk on Jun 19, '03 02:57:55AM

That is indeed something you can observe in practice. My point is:

- never use a value of -20. see the nice man page for details
- you probably waste time renicing your programs instead of just simply letting them finish normally

the only situation I personnally used a renice (with a value of -5) was on a very old 486 PC, used as server, which also had some music streaming. But that was a server task.

Basically you shouldn't ever need renice. If you need it, some of your software probably has bad design.



[ Reply to This | # ]
Theory vs. practice...
Authored by: maxgraphic on Jun 19, '03 04:00:28AM

man nice says nothing about not using -20. In fact, man renice recommends "anything negative" to "make things go very fast."

And, yes, I would call DropStuff or anything I've ever used from Aladdin a "bad design." I don't want to get off on a rant here, but StuffIt has a long history of major suckage and I've spent a fair amount of time wondering how it won out over Compact Pro, a far superior compression app that complied perfectly with Mac OS human interface guidelines. StuffIt still, years later, prompts for a filename at the point your create a new archive. Expander still dies silently when it encounters an error. The whole package needs a rewrite desperately.

Anyway, getting back to the point, I am not surprised at all that DropStuff benefits from renicing and thus this is a perfectly valid and usable hint, despite your objections.

---
Design your own business cards and more
http://www.designyourowncard.com/



[ Reply to This | # ]
Theory vs. practice...
Authored by: nofutureuk on Jun 19, '03 09:34:34AM

interesting ideas about dropstuff, I was more thinking of for example other apps like Word eating CPU time even if you only read a document... or if it's in background... (where the priority discussion comes in)

cheers



[ Reply to This | # ]
Theory vs. practice...
Authored by: foobar104 on Jun 19, '03 11:28:37AM

There's no such thing as "background" and "foreground" any more. All applications run at the whim of the system scheduler without regard for which one you (the user) happen to be interacting with at any given instant.

(There are some exceptions. Virtual PC 5 tries to set its CPU usage differently depending on whether or not it's the active application. I don't think that feature actually works.)

Word eats up CPU time because you have background spell-checking and pagination turned on. Turn them off, and your problem will largely go away. Not completely, because Word as a Carbon (and poorly Carbonized, at that) application still uses the old event polling scheme, which means it constantly has to run a little loop rather than waiting for dispatches from the OS. But that's not that big a deal.

An even better suggestion is to use TextEdit instead of Word. It's faster, smaller, and comes with your computer for free.



[ Reply to This | # ]
Theory vs. practice...
Authored by: nofutureuk on Jun 20, '03 03:43:45AM

hehe, I don't use Word. I was just using it as an example of bad software. With background, I exactly meant what you explained ;-)
cheers



[ Reply to This | # ]