A process is an instance of a program in execution, consisting of four key components: code (executable instructions), data (static and global variables), heap (dynamic memory allocation at runtime), and stack (local variables, function parameters, and recursion handling). Unlike a program which is stored on secondary memory, a process exists in main memory during execution and has no fixed boundary between stack and heap since their sizes depend on runtime requirements.
Process in OS: Definition, Program vs Process & Structure
Added:hello guys welcome you all to my channel making it simple today in this video we will see what is process in operating system is it a program or is there a difference between program and process if yes what is the difference between both of them let's simplify the concept and try to solve all these queries if you have not watched my other videos on operating system you can watch them here and also there is link in description so without wasting any time let's start the video [Music] let's start with the definition we can define process in more than one way a process is the instance of a computer program that is being executed or we can say that a process is basically a program in execution let's try to understand in simple way let's say we write a java code we will save the file as a dot java file then we will provide it to the compiler and compiler will compile the dot java file and generate a dot class file these both files are called program and they are stored in secondary memory or we can say hard disk then we need to execute the file to get output so now the operating system will take the dot class file and bring it in the main memory or ram for execution when the cpu starts the execution the program becomes a process which is executed by the cpu the process performs all tasks present in the program so we say that a process is basically a program in execution so when a program is running it is called as process let us see what really happens when program becomes process when the program becomes process it is structured the structure can be divided in four parts first is code second one is data third is heap and fourth one is stack let us see one by one all four of them first is code the executable code which we need to execute is being stored in the code let us consider an example we write a java program and compile it we get a output file or executable file which has program instructions this code is stored in the code section second is data data consists of static and global variables static variable is the variable which is allocated statically that is we define the variable while writing the program static variable does not get deleted until complete run of program and preserves the value assigned to it global variable is a variable with global scope that is it can be visible or can be accessed anywhere in the program these static and global variables are stored in data section third is heap this heap is not the heap data structure it is a free available space in memory it is used for dynamic allocation when we write a program we define some variables memory for those variables is allocated as we declare them but in some cases we don't know how much of memory will be required at runtime that is when the program is running so we cannot define or allocate that memory statically so in that case we need dynamic memory allocation which is allocated at runtime so the dynamic memory allocation is done in heap section fourth is stack the stack is used for local variables which we normally declare in a program it is also used to store method or function parameters or return address and we also use it when we use recursion function the recursive calls are handled in the stack this all is stored in the stack section now as we see in the diagram there is no fixed division between stack and heap why is it so we cannot predict which one will require how much of space in one program stack may cover more space in other program heap may cover more space so if we get a fixed division there can be an issue so there is no fixed partition stack propagates in down direction and heap propagates in up direction let's understand with a example let's say we use a single notebook for two subjects let us consider first scenario if we write one subject from start and another one in middle of notebook let's say we finish our first subject in half pages in this example 25 pages and for second one we complete 50 and still require more 20 pages so partition or allocation done was not useful as we had no idea about how much will be required for which subject let's consider second scenario we start to write first subject from first page and second subject from last page we complete first subject in 25 pages and we require 70 for subject 2.
this time we can cover all 70 pages so when we don't know about the data it is good to use this option same is done in the process structure stack propagates in downward direction and heap in upward direction with no fixed partition so in this video we saw about what exactly process is and what is the structure of process hope you all understood the concepts clearly if you have any doubts or queries related to the topic or you have any suggestions related to the video comment them down below if you find my video helpful like the video and share it with your friends who need to clear these concepts subscribe my channel and press the bell icon to get updates about my new videos
Up Next

Understanding Chroot in Linux: A Comprehensive Tutorial
@robbraxmantech
34.1K views•2020-02-24

Introduction to Secure Multiparty Computation with Yehuda Lindell
@fhe_org
7.7K views•2021-02-04

HTTP Requests Explained: GET, POST, PUT, DELETE
@codecademy
103.1K views•2021-10-07

Enigma Machine Mechanics: WWII Encryption Explained
@JaredOwen
13.2M views•2021-12-11
Related Study Plans & Knowledge Roadmaps
Structured learning paths in Computer Science











































