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?

First: When you run a program, may it link more than one execution files.

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.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值