Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm running experiments via python & pygame that are time-sensitive and I'd like to reduce all the OS's background processing as much as possible while still being able to do things like detect keyboard/gamepad/mouse input, show things on screen, and play sounds. How could I go about killing all superfluous processes?

share|improve this question

migrated from superuser.com Apr 16 '12 at 15:40

This question came from our site for computer enthusiasts and power users.

1 Answer 1

up vote 1 down vote accepted

Did you try using nice? that may be enough for your needs.

sudo nice -20 your-program.py

this will ensure that your program has a higher priority than other processes.

share|improve this answer
    
If I'm using a python package like pygame that uses lower level libraries (e.g. pygame uses SDL), will this prioritize the computation done by those lower level libraries as well? –  Mike Apr 18 '12 at 15:14
    
It should, unless you fork or do something to make it effectively become another process. –  roadmr Apr 18 '12 at 17:11
    
hm, I do use the multiprocessing library to create separate but intercommunicating processes. Hopefully calling os.nice(-20) in each separate process will set them all to equal-and-highest priority (?) –  Mike Apr 18 '12 at 18:09
    
yes, calling it on each process would work, but I suggest you read up on nice and process scheduling to ensure that setting them to -20 does what you want; you may end up with a lot of processes fighting each other for CPU. –  roadmr Apr 18 '12 at 19:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.