Difference between Routine and Process
Last Updated :
24 Jun, 2021
In this article, we are going to discuss the difference between routine and process. Before differentiating between both, first, let us understand what they are.
Routine :
In computer programming, a routine is nothing but a sequence of code, intended for the execution of user programs and input/output operations. It can range from a subroutine, co-routine to a function.
It is called repeatedly by other codes, during the execution of a program.
A routine, also known as a function with a specified programming interface, in higher-level languages, can be used in a program to perform a particular task many times, obviously with different data values.
Whenever a program needs to perform a specific task, the main sequence of logic in a program can branch off to a common routine when necessary. As soon as the routine has been executed, the calling program must resume the execution, by taking over the called routine. The called routine is said to return to the calling program, by executing the return instruction.
All these things are taken care of by the operating system internally, by means of a data structure known as Stack.
Example –
A routine to multiply two numbers.
Process :
The process is a program in execution and represents the basic unit of CPU utilization.
A process is an active entity that is created when an executable file gets loaded into the main memory for execution.
A system compromises a bunch of processes, some of which execute the system code(known as the operating-system processes) while, on the other hand, the rest of the processes that execute the user code(user processes).
Well, many students get confused with the terms Program and Process, but the two are different entities. The program is a passive entity, while the process is an active entity.
A process has numerous states, defined by the current activity of that process.
Each process is represented in the Operating System, by a Process Control Block(PCB).
Example –
The browser on which you are reading the article is actually a process in which multiple processes are running concurrently, maybe one for the UI, the other for the opened tabs.
Difference between Routine and Process :
- A routine is a sequence of code, while a process is actually a code in execution.
- A routine is used to perform a specific task and it can be a part of multiple processes.
The difference between Routine and Process in tabular form :
| Criteria |
Routine
|
Process
|
| Definition |
It is a sequence of code, intended for the execution of user programs and input/output operations. |
It is a program in execution, unit of work in modern time-sharing systems. |
| Role |
The role of a routine is to perform a task, and a routine can be called many a time by other routines or subroutines. |
Its role is to execute a sequence of code, it represents the basic unit of work to be implemented in a system. |
| Functionality |
It can be used in a program to perform a particular task many times. |
A process can be of two types, one which executes the system code, meanwhile, the other one being which executes the user code. |
| Example |
A routine to multiply two numbers, add two numbers, etc. called repeatedly. |
A calculator is a process responsible for doing several operations on an operand. |
Similar Reads
Difference between Process and Thread
Process and threads are the basic components in OS. Process is a program under execution whereas a thread is part of process. Threads allows a program to perform multiple tasks simultaneously, like downloading a file while you browse a website or running animations while processing user input. A pro
7 min read
Difference between Program and Process
In Computer Science, there are two fundamental terms in operating system: Program and Process. Program is a set of instructions written to perform a task, stored in memory. A process is the active execution of a program, using system resources like CPU and memory. In other words, a program is static
4 min read
Difference between Job, Task and Process
In operating system the concept of job, process, and task revolves around each other.Job is work that needs to be done. A task is a piece of work that needs to be done. The process is a series of actions that is done for a particular purpose. Job and task define the work to be done, whereas process
6 min read
Difference between Process and Kernel Thread
1. Process: Process is an activity of executing a program. Process is of two types - User process and System process. Process control block controls the operation of the process. 2. Kernel Thread: Kernel thread is a type of thread in which threads of a process are managed at kernel level. Kernel thr
1 min read
Difference Between PSP and TSP
Software is the set of instructions in the form of programs to govern the computer system and process the hardware components. To produce a software product a set of activities is used. This set is called a software process. In this article, we will see a difference between PSP and TSP. What is Pers
7 min read
Difference between Process and User Level Thread
1. Process : Process is an activity of executing a program. Process is of two types - User process and System process. Process control block controls the operation of the process. 2. User Level Thread : On the basis of level, threads are of two types: User level Kernel Level User level thread is a t
2 min read
Difference between Multitasking and Multiprocessing
When it comes to analyzing the productivity of systems in the contemporary environment of computing, the concepts of multitasking and multiprocessing become prominent. Although both concepts are bound to how a computer processes work, their mode of function and their purpose are entirely dissimilar.
5 min read
Difference between Multiprocessing and Multithreading
Multiprocessing uses multiple CPUs to run many processes at a time while multithreading creates multiple threads within a single process to get faster and more efficient task execution. Both Multiprocessing and Multithreading are used to increase the computing power of a system in different ways. In
3 min read
Difference between Batch Processing and Stream Processing
Today, an immense amount of data is generated, which needs to be managed properly for the efficient functioning of any business organization. Two clear ways of dealing with data are the batch and stream processes. Even though both methods are designed to handle data, there are significant difference
7 min read
Difference between Multiprocessing and Multiprogramming
Multiprocessing and Multiprogramming both strategies are designed to increase the efficiency of the system by managing multiple tasks but with different principles of their own. But they share the common goal which is improving resource utilization and system throughput. So, understanding which one
5 min read