Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python process management

Tags:

python

process

ps

Is there any way python is natively, or through some code available online (preferably under the GPL), capable of doing process management. The goal is similar to the functionality of ps, but preferably in arrays, lists, and/or dicts.

like image 494
cpf Avatar asked Mar 17 '09 15:03

cpf


People also ask

What are processes in Python?

In Python, a process is an instance of the Python interpreter that executes Python code. In Python, the first process created when we run our program is called the 'MainProcess'. It is also a parent process and may be called the main parent process. The main process will create the first child process or processes.

Does Python have multiprocessing?

Python multiprocessing Pool can be used for parallel execution of a function across multiple input values, distributing the input data across processes (data parallelism). Below is a simple Python multiprocessing Pool example.

How do you create a process in Python?

In this example, at first we import the Process class then initiate Process object with the display() function. Then process is started with start() method and then complete the process with the join() method. We can also pass arguments to the function using args keyword.

Is subprocess built in Python?

The subprocess module present in Python(both 2. x and 3. x) is used to run new applications or programs through Python code by creating new processes.


2 Answers

http://pypi.python.org/pypi/PSI

like image 123
vartec Avatar answered Oct 24 '22 16:10

vartec


This one is cross-platform: http://code.google.com/p/psutil/

like image 30
eadmaster Avatar answered Oct 24 '22 16:10

eadmaster