November 23, 2024

Program and Process in OS

Program

•A program is a passive entity as it resides in the secondary memory, such as the contents of a file stored on a disk. One program can have several processes.

•A program is an executable file that contains a certain set of instructions written to complete a specific job on your computer. For example, Google browser chrome.exe is an executable file that stores a set of instructions written in it which allow you to view web pages.

•Programs are never stored on the primary memory in your computer. Instead, they are stored on a disk or secondary memory on your PC. They are read from the primary memory and executed by the kernel.

Features of Program

•A program is a passive entity. It stores a group of instructions to be executed.

•Various processes may be related to the same program.

•A user may run multiple programs where the operating systems simplify its internal programmed activities like memory management.

•The program can’t perform any action without a run. It needs to be executed to realize the steps mentioned in it.

•The operating system allocates the main memory to store program instructions.

Process:

•A process is a program in execution. A process defines the fundamental unit of computation for the computer.

•A process is an instance of a computer program that is being executed. It contains the program code and its current activity.

•Depending on the operating system(OS), a process may be made up of multiple threads of execution that execute instructions concurrently.

•Process is a dynamic entity that is a program in execution.

•A process is a sequence of information executions. That exists a limited span of time.

•Two or more processes could be executing the same program, each using its own data and resources.

•Process is an active entity and may provide a response to the user.

•Process memory is divided into four sections for efficient working :

•The text section is made up of the compiled program code, read in from non-volatile storage when the program is launched.

•The data section is made up of the global and static variables, allocated and initialized prior to executing the main.

•The heap is used for the dynamic memory allocation and is managed via calls to new, delete, malloc, free, etc.

•The stack is used for local variables. Space on the stack is reserved for local variables when they are declared.

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

Leave a Reply

Your email address will not be published. Required fields are marked *