Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 Apr 16 '12 at 15:40

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

up vote 1 down vote accepted

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

sudo nice -20

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 Lawrence 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 Lawrence 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


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.