Differences between Routine and Process


A routine is said to be a computer program with a set of instructions that is used for the execution of the system program. They allocate or deallocate the memory used after completion of its execution as per instructions given as routine-routine or even functions. The process is termed as the programs that are currently in execution state and utilizes the resources of CPU. Each process undergoes different states like active, new, ready, block, and wait, suspended during its life cycle. Multiprogramming environment is done to the processes which require it, where each process is classified into preemption and non-preemption methods

Routine

A routine is called a function that is used by the program to perform any particular task assigned to it. During the execution of the task, the sequence or routine should branch off to the common function as needed. After completion of the task, the calling program resumes executing the next instruction as specified in the routine. Routines given to the programs are used for efficient read-and-write operations of the memory management unit. This can be used by other upcoming programs to use the same one with different input data without creating new code.

Routines are used in higher level languages as a functional interface to perform the needed task that can be repeated many times. Macro instructions are provided as input variables to the routine in decoded form in assembly language. These instructions are used by the programmers which saves time rather than creating and controlling the branching instructions into the routine designed. Packaging of specific functions with interfaces needed by higher-end languages can be done to most required routines and some other functions are termed as stubs that are used in the dynamic execution of system calls.

Process

The process gets into activation when a program starts its execution process that uses main memory after loading into it. Multiple processes are present in the system where a few executes the operating system code and the rest executes the user process. Various sections are needed for the process to perform its work and they are data section, text section, heap (dynamic allocation), and stack (storage area of local variable).

Each process is managed by the process control block that holds details or components of the process state, CPU registers, process id, program counter, memory management, scheduling information, and other input/output details.

Various operations that are done on the processes are creation, designing, execution, deletion, synchronization, blocking, context switching, inter-process communication, etc.

The table below defines the major differences between Routine and Process:

Basis of difference

Routine

Process

Responsibility

It performs specific tasks with the help of a routine that is called by other functions or subroutines multiple times.

This has the responsibility to execute a set of code or programs which is termed as the primary work of the operating system.

Purpose

It is used by the program as an interface to perform several tasks repeated times.

It functions based on a process that executes the system code or the user code.

Termed for

These contain a set of codes to execute the programs of the user and provide input/output operations

This contains the programs that are in the execution state which used the resources of the CPU.

Application support

Commonly used routines are packaged as functions to provide an interface for higher-end programming languages. Dynamic library routines are created for applications that do not need memory location till it gets loaded.

Each application process works on the information from the process control block that is considered as a major unit to store and manage the programs or applications for their execution.

Operations

Used by the programs that should follow a common routine and move to the next sequential operation which is branched to the routine data

Based on the user request, the processes are enabled to get into an active state with proper memory management, scheduling, register locations, etc.

Examples

Saving a user file, displaying system time, and adding two input data based on the routine already stored for such common tasks.

Using a music player to view and listen to songs, a calculator tool that performs on multiple operands, a browser interface has multiple processes operating at the same time for user interface and other tabs to be used later

Conclusion

Routines are a specific set of common instructions that are used by the programs repeatedly times and offers the advantage of using the same routine with different input data set, which saves time for the developers not to work on a new set of routine. When a program is in the execution stage it is termed as a process that can manage system code as well as user code based on the request to the memory. Each process undergoes several states throughout its life cycle which functions on a process control block with process id, CPU utilization, and Scheduling algorithms, register set, and based on real-time sharing systems.

Updated on: 17-Jul-2023

101 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements