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

Difference between Routine and Process

Last Updated : 24 Jun, 2021
Summarize
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 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
Difference between Process and Thread
Process and threads are the basic components in OS. Process is the program under execution whereas the thread is part of process. Threads of a process can be used when same process is required multiple times. A process can consists of multiple threads. In this article we will explore difference between process and thread in detail. What is Process?
4 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, a process is dynamic, representing the program i
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 defines the way the work can be done or how the wo
6 min read
Difference between Thread Context Switch and Process Context Switch
A context switch is the process where the operating system switches the CPU's attention from one task to another, ensuring multitasking. This allows multiple processes or threads to share the CPU efficiently. In a thread context switch, the CPU switches between threads within the same process. Since threads share the same memory space. In contrast,
5 min read
Communication between two process using signals in C
Prerequisite : C signal handling In this post, the communication between child and parent processes is done using kill() and signal(), fork() system call. fork() creates the child process from the parent. The pid can be checked to decide whether it is the child (if pid == 0) or the parent (pid = child process id).The parent can then send messages t
3 min read
Process-Based and Thread-Based Multitasking
Multitasking operating system is an operating system that gives you the perception of two or more tasks/jobs/processes running simultaneously. It does this by dividing system resources amongst these tasks/jobs/processes and switching between the tasks/jobs/processes while they are executing over and over again. The CPU processes only one task at a
2 min read
Process Scheduler : PCBs and Queueing
When the job scheduler accepts a job, it creates the job's PCB (Process Control Blocks) and updates it throughout the execution. These PCBs, and not the jobs, are linked to form the queues and are used to track the respective jobs. Note: The PCB store all of the data about the job being processed, like it's progress in the system. This data is need
1 min read
Process Creation and Deletions in Operating Systems
Prerequisite - States of a Process in Operating Systems There are two basic operations that can be performed on a process: Creation and Deletion. They are explained as Process creation: 1. When a new process is created, the operating system assigns a unique Process Identifier (PID) to it and inserts a new entry in the primary process table. 2. Then
2 min read
Operating Systems | Process Management | Question 6
Consider the following code fragment: if (fork() == 0) { a = a + 5; printf("%d,%d\n", a, &a); } else { a = a –5; printf("%d, %d\n", a, &a); } Let u, v be the values printed by the parent process, and x, y be the values printed by the child process. Which one of the following is TRUE? (A) u = x + 10 and v = y (B) u = x +
2 min read
Operating Systems | Process Management | Question 6
Three concurrent processes X, Y, and Z execute three different code segments that access and update certain shared variables. Process X executes the P operation (i.e., wait) on semaphores a, b and c; process Y executes the P operation on semaphores b, c and d; process Z executes the P operation on semaphores c, d, and a before entering the respecti
2 min read
Operating Systems | Process Management | Question 6
A shared variable x, initialized to zero, is operated on by four concurrent processes W, X, Y, Z as follows. Each of the processes W and X reads x from memory, increments by one, stores it to memory, and then terminates. Each of the processes Y and Z reads x from memory, decrements by two, stores it to memory, and then terminates. Each process befo
2 min read
Message based Communication in IPC (inter process communication)
Prerequisites - Cloud computing, Load balancing in Cloud Computing, Inter-process Communication In the development of models and technologies, message abstraction is a necessary aspect that enables distributed computing. Distributed system is defined as a system in which components reside at networked communication and synchronise its functions onl
5 min read
Get/Set process resource limits in C
The getrlimit() and setrlimit() system calls can be used to get and set the resource limits such as files, CPU, memory etc. associated with a process. Each resource has an associated soft and hard limit. soft limit: The soft limit is the actual limit enforced by the kernel for the corresponding resource. hard limit: The hard limit acts as a ceiling
3 min read
Two State Process Model in Operating System
Pre-requisite: States of a Process in Operating Systems The process in an operating system passes from different states starting from its formation to its completion. A process consists of program data and its associated data and a process control block (PCB). A process may change its state because of the following events like I/O requests, interru
3 min read
Formation Of Process from Program
Process: A Process is a program in execution is called as Program. But the conversion of a program into process involves various stages which are clearly defined in this article. Further more after the program is converted into the process memory has to be allocated to these process in the main memory and these memory allocations are handled by O.S
5 min read
Message Passing Model of Process Communication
So message passing means how a message can be sent from one end to the other end. Either it may be a client-server model or it may be from one node to another node. The formal model for distributed message passing has two timing models one is synchronous and the other is asynchronous. The fundamental points of message passing are: In message-passin
3 min read
FIFO Barbershop in Process synchronization
Overview :In process synchronization, there exists a Sleeping Barber problem, as discussed here. But in the above solution, there is no guarantee that the customers are served in the order they arrive in the barbershop, i.e. there is no guarantee that the customers enter a FIFO manner(First-in First-out). In the solution discussed above. Up to n cu
5 min read
N process Peterson algorithm
Prerequisites for this topic include an idea about synchronization among processes and how to obtain it. Also, some knowledge of the producer-consumer problems along with an idea of Peterson's algorithm is of utmost importance. Overview :Synchronization among the execution of various processes in any operating system is of utmost importance. Which
8 min read
Three State Process Model in Operating System
Pre-requisites: States of a Process in Operating Systems, Two-State Process Model in Operating SystemIn this article, we'll be discussing a three-state process model in an operating system and also discussing the need for this process model, how the process executes, what will be the possible transition that can occur, and last its benefits and som
4 min read
Cooperating Process in Operating System
Pre-requisites: Process Synchronization In an operating system, everything is around the process. How the process goes through several different states. So in this article, we are going to discuss one type of process called as Cooperating Process. In the operating system there are two types of processes: Independent Process: Independent Processes a
2 min read
Six-State Process Model in Operating System
In this article, we are going to discuss the Six-State Process Model in Operating Systems and we will also understand what was the need for introducing these process models, what are the states present in these process models, and all the possible transitions that can occur in these models. Need for Six-State Process Model:The Five-State process mo
4 min read
Article Tags :