The Wayback Machine - https://web.archive.org/web/20240812111036/https://www.geeksforgeeks.org/difference-between-routine-and-process/
Open In App

Difference between Routine and Process

Last Updated : 24 Jun, 2021
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

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, Parent Process, and Child Process
Running program is a process. From this process, another process can be created. There is a parent-child relationship between the two processes. This can be achieved using a library function called fork(). fork() function splits the running process into two processes, the existing one is known as parent and the new process is known as a child. Here
8 min read
Difference between Process Image and Multi Thread Process image
1. Process Image : Process image is an executable file required during the execution of any process. It consists of several segments related to the execution of the process. Following are the contents of the process image - 1. Process Control Block 2. Stack 3. Data 4. Code 2. Multi Thread Process Image : Multi thread process image is an executable
2 min read
Process Scheduler : Job and Process Status
When the jobs moves through the system and makes progress, it changes it's states from HOLD to FINISH. When the job is being processed by the job manager and the process manager, it is always in one of these 5 states: HOLD: When a user submits a job and it accepts the job, the job is put on HOLD and placed in a queue. READY: A job is in READY state
2 min read
Process Table and Process Control Block (PCB)
While creating a process, the operating system performs several operations. To identify the processes, it assigns a process identification number (PID) to each process. As the operating system supports multi-programming, it needs to keep track of all the processes. For this task, the process control block (PCB) is used to track the process’s execut
7 min read
Process states and Transitions in a UNIX Process
Process is an instance of a program in execution. A set of processes combined together make a complete program. There are two categories of processes in Unix, namely User processes : They are operated in user mode. Kernel processes : They are operated in kernel mode. Understanding the distinction between user and kernel processes is essential for c
4 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 threads are scheduled by operating system (kernel mod
1 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 type of thread in which threads of a process are ma
2 min read
Difference between Process Contention Scope and System Contention Scope
1. Process Contention Scope :In an operating system the thread library is schedules by an operating system known as kernel thread that is managed by a thread library for user level thread to runs off an available light weight process. This is often referred to as process contention scope.Process contention scope is executed accordingly to the prior
3 min read
Difference between Job, Task and Process
Prerequisite : Introduction of Process Management, Gang scheduling in Operating System Introduction :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 defines the way the work can be done
5 min read
Difference between a process stack and a CPU stack
Temporary data like as method/function arguments, return address, and local variables are stored on the process Stack, whereas on the other hand, the CPU stack consists of a collection of data words. It employs the Last In First Out (LIFO) access technique, which is the most common in most CPUs. In this article we are going to find out the detailed
3 min read
Article Tags :
three90RightbarBannerImg