0

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?

0

1 Answer 1

1

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.

4
  • 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? Apr 18, 2012 at 15:14
  • It should, unless you fork or do something to make it effectively become another process.
    – roadmr
    Apr 18, 2012 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 (?) Apr 18, 2012 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, 2012 at 19:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .