In last article, we have seen what is difference between process and thread. Now , we will talk about what are the differences between process and program used in modern operating systems. Operating system is basically a way to connect the end user to the hardware of the computer. It controls the entire functionality of the computer. Some of its popular examples include Linux, Unix, Windows. A number of duties are handled by the operating systems for example, creation or deletion a specific directory is handle, the creation, suspension, deletion or synchronization is managed, memory management (to allocate or deallocate memory to a specific process), hardware devices management and control, security handling etc. Therefore, an operating system plays a very important role in the working of a computer.
In plain words, a program is an activity related to system. There are two types of system; batch processing system and operating system. When in batch processing system, they are named as executing jobs. On the other hand, in an operating system they are named as programs. When a user is using a computer, he can run plenty of programs simultaneously. The operating system allots them memory using its own techniques. Other parameters can also be allotted using the OS.
There are two types of entities; active and passive. A program is categorized as a passive one. For example, a program is an executable file that is yet to be executed. It is not in running state. Therefore, it is passive. It does not perform an action. It is supposed to be run to see its actions that are linked to it. Each program has its own address space which consists of the data, instructions, stack etc. To see the execution of a program, the first step is to allocate it memory. This is done by the operating system. Then, it is scheduled for its execution. This scheduling time is set by the Operating System using different methods such as First in first out, Shortest job first etc. After that, an arrangement is set up for the process to get access to file info. The CPU is shared by operating system for the execution of a specific process and then the execution of rest of the programs.
Characteristics of a program
A program has the following characteristics:
- It is a passive entity. It is just a file that has a set of instructions that are yet to be run.
- A number of processes can be linked to a single program. For example, a browser can have multiple tabs open at the same time.
- A single user can execute a number of programs. Then the operating systems deals with the handling of these programs for example management of the memory.
- The program itself cannot take any action. It is in static state. It has to be run to see that what are steps mentioned in it.
- The operating system has the duty of giving main memory for the storage of all the instructions of the programs.
A Process is a program that has been executed. So, it is an active entity. It is used to see the actions that are linked to a specific in a program. A number of processes can be linked to a single program. A process takes care of the activities of an operating system using Process Control Block. It includes state, stack, program counter etc. A program counter is used to store the next instruction in sequence that is to be run after the one running.
A process requires some resources for instance memory, I/O ones and processing etc. in order to achieve tasks related to management. While, in running state of a program, I/O operation or processor are used that distinguish a process from a program. For example, there is a code in C language. When we store it, it is simply a program in a file. No cation is performed. Whereas, when this program is run, it transforms into a process. This confirms the dynamic nature of a process. One processor schedules a number of processes and decides their order of execution. Then it is shared between several processes.
Characteristics of a process
A process has the following characteristics:
- A process has a limited life time i.e. only when it is being executed.
- Each process can produce child processes. Moreover, they can also die or can be killed.
- Each process has a specific set of information linked to it. For example, its parent’s name, address of the allocated memory space, properties related to its security that include ownership credentials and privileges.
- Processes are system resources that are allocated. For example, network ports and file descriptors.
Process vs Program
There are a number of differences between a process and a program. For starters, a program is a set of ordered instructions that are yet to be run. They are static is nature. While, a process is basically a particular part of program in running condition.
A program is passive in nature because it does not do anything. It waits for its execution. On the other hand, a process is of active nature. It is in running condition and it performs a particular action.
Moreover, a program’s life time is usually longer as it is simply written and then stored in memory. It has to be deleted by the user himself. Whereas, a process’s life time is relatively shorter due to the fact that it has to get truncated once the task being performed is finally completed.
Lastly, the resources used by the process are grater in number than the ones used by the program. A process has to be processed, it needs its own memory space and then finally I/O resources so that it is run successfully. While, in a program, only memory space is of importance.
|Any executable file is called program i.e. it has a specific set of commands that are written down for the sake of completion of the specified task told by the user|
|A process is simply the running state of any particular program|
|A program is static in nature|
|The process is dynamic when it comes to its nature|
|Only memory space is needed|
|Large number of resources is required|
|The overhead cost is very less|
|Overhead cost is significant|
|It has a large lifespan as it has to be deleted by the user itself|
|It has a shorter lifespan as it is terminated after its execution|
|No need to copy the parent process|
|A parent process may copy to get child processes|
|It requires its own memory for storage|
|It requires memory when only in running condition|
|The program is stored on disk in some file and does not require any other resources.|
|Process holds resources like CPU, memory address, disk, I/O, etc.|
The above-mentioned information can be summarized as follows:
- Any executable file is called program i.e. it has a specific set of commands that are written down for the sake of completion of the specified task told by the user
- A process is simply the running state of any particular program
- A process has a shorter lifespan than the program itself
- A process is a dynamic entity whereas a program is a static one
- Multiple processes can be linked to a single program