Difference between Process and Thread

在这里插入图片描述
线程&进程不同点:

在这里插入图片描述

What is a Process?

  • A process is the execution of a program that allows you to perform
    the appropriate actions specified in a program.
  • It can be defined as an execution unit where a program runs.
  • The OS helps you to create, schedule, and terminates the processes
    which is used by CPU.
  • The other processes created by the main process are called child
    process.

在这里插入图片描述

What is Thread?

  • Thread is an execution unit that is part of a process.
  • A process can have multiple threads, all executing at the same time.
  • It is a unit of execution in concurrent(同时) programming.
  • A thread is lightweight and can be managed independently by a scheduler.
  • It helps you to improve the application performance using parallelism.

进程:指在系统中正在运行的一个应用程序;程序一旦运行就是进程;
进程——资源分配的最小单位。

线程:系统分配处理器时间资源的基本单元,或者说进程之内独立执行的一个单元执行流。
线程——程序执行的最小单位。


小结:

1.进程要分配一大部分的内存,而线程只需要分配一部分栈就可以了.

2.一个程序至少有一个进程,一个进程至少有一个线程.

3.进程是资源分配的最小单位,线程是程序执行的最小单位。

4.一个线程可以创建和撤销另一个线程,同一个进程中的多个线程之间可以并发执行.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值