I try to call a.py and b.py concurrently in test.py by multiprocessing.Process(), it worked. But the process CMD name of a.py, b.py and test.py, which are '/usr/bin/python /tmp/test.py', are the same .
# ps -ef | grep b.py
UID   PID  PPID   C STIME   TTY           TIME CMD
501 61486 39878   0  2:33PM ??         0:00.05 /usr/bin/python /tmp/test.py
501 61487 61486   0  2:33PM ??         0:00.01 /usr/bin/python /tmp/test.py
501 61488 61486   0  2:33PM ??         0:00.01 /usr/bin/python /tmp/test.py
I'd like to have these three processes show different CMD names by 'ps -ef' as below: (which can help me to identify whether different process is running or not.)
# ps -ef | grep b.py
UID   PID  PPID   C STIME   TTY           TIME CMD
501 61486 39878   0  2:33PM ??         0:00.05 /usr/bin/python /tmp/test.py
501 61487 61486   0  2:33PM ??         0:00.01 /usr/bin/python /tmp/a.py
501 61488 61486   0  2:33PM ??         0:00.01 /usr/bin/python /tmp/b.py
Please help advice:)
Source code is as below:
test.py:
import multiprocessing
import a
import b
p1 = multiprocessing.Process(target=a.printa)
p2 = multiprocessing.Process(target=b.printb)
p1.start()
p2.start()
a.py:
import time
def printa():
    while True:
        print 'a'
        time.sleep(1)
if __name__ == '__main__':
    printa()
b.py:
import time
def printb():
    while True:
        print 'b'
        time.sleep(1)
if __name__ == '__main__':
    printb()
 
     
    