📜  程序和过程的区别

📅  最后修改于: 2021-09-12 10:58:39             🧑  作者: Mango

1. 程序:
当我们执行一个刚编译好的程序时,操作系统会生成一个进程来执行这个程序。程序的执行通过 GUI 鼠标点击、命令行输入等方式开始。程序是一个被动实体,因为它驻留在辅助存储器中,例如存储在磁盘上的文件的内容。一个程序可以有多个进程。

2. 流程:
术语进程(作业)是指已加载到计算机内存中以便可由中央处理单元 (CPU) 执行的程序代码。进程可以描述为在计算机上运行的程序的实例,也可以描述为可以分配给处理器并在其上执行的实体。程序在加载到内存中时成为一个进程,因此是一个活动实体。

程序与流程的区别:

Sr.No. Program Process
1. Program contains a set of instructions designed to complete a specific task. Process is an instance of an executing program.
2. Program is a passive entity as it resides in the secondary memory. Process is a active entity as it is created during execution and loaded into the main memory.
3. Program exists at a single place and continues to exist until it is deleted. Process exists for a limited span of time as it gets terminated after the completion of task.
4. Program is a static entity. Process is a dynamic entity.
5. Program does not have any resource requirement, it only requires memory space for storing the instructions. Process has a high resource requirement, it needs resources like CPU, memory address, I/O during its lifetime.
6. Program does not have any control block. Process has its own control block called Process Control Block.