Process&Program

Abstract: Have you ever been curious about that, When you run a program, your task management will appear maybe more than one processes. Why this way?

For example, if you double click QQPCTray.exe, you will see below the pic on task management, including two services processes and the other three.

This quite a lot of fun, that you try to end this task, the system will tell you low Authority. I'm a newbie on OS and do these things. The only way that I know is the right-click the icon and exit QQ管家. After that, I found 电脑管家 and 小火箭 processes dismissed and Disk using became 100%.

What's the QQ管家 and 小火箭's relationship they are? I guess QQ管家 is the parent process.

Let's do some tests, see what's the situation that QQ管家 belongs to.

Using python open another python file

process.py

import os

if __name__ == '__main__':
    os.system('python process2.py')
    print("Main Process ID:"+str(os.getpid()))
    input()
process2.py

import os

print("process2 ID: "+str(os.getpid()))

When you run process.py, cmd will print two PID.

import another python

process.py

import os
import process2

if __name__ == '__main__':
    print("Main Process ID:"+str(os.getpid()))
    input()
process2.py

import os

print("process2 ID: "+str(os.getpid()))

You will find only print a PID.

posted @ 2020-05-07 16:21  咕咕鸟GGA  阅读(199)  评论(0)    收藏  举报