What is a computer process?

A computer program in running state is called a Process. lets say that you open the notepad. when the notepad was not opened, it was a computer program, but now when you have opened it, it has become a process. But what truly happens under the hood, when you start a process by opening the notepad or any other thing. let’s uncover it.
All the applications you have in your computer, are stored on the secondary storage (i.e SSD or HDD etc). When you open that application, it loads into the primary storage (i.e RAM). This is done because if CPU interacts with the secondary storage, then this processing would become extremely slow (because the secondary storage is extremely slow). That’s why the program is loaded into the primary memory so that the CPU can process it quickly.
When a process is in the RAM, it can be divided into four sections.

- Stack
Stack is the memory which contains all temporary data of the program (or process) such as local variables and function/method parameters. After the execution of a method (or function), the local variables inside it are terminated. Hence called the temporary data.
2. Heap
It is a dynamically allocated memory, which means that it’s size is determined at run time of the program. This memory stores global variables in the program.
3. Data
This section contains all the variables, static and global.
4. Text
This section contains contains the compiled code of the program, which is loaded into the RAM when the program is launched.
Process States
The process can be in one of the following states.
- Start
A process is in the Start state when it is first launched.
2. Ready
A process is in the Ready state when it is fully ready to be executed by the CPU.
3. Running
A process is in the running state when it is getting executed by the CPU.
4. Waiting
When a process which is in the running state, needs some resource such as user input in order to proceed, it is transferred from the running state to waiting state, so that the CPU can execute some other process instead of wasting time.
5. Terminated
When a process completes its execution, it goes into the terminated state.

Process Control Block (PCB)
The operating system creates and maintains a data structure called PCB, for every process that is created. A PCB is uniquely identified by process id (PID). PCB contains the essential information about the process. This includes
- Process state
The current state of the process. i.e., whether the process is running, waiting etc.
2. Process privileges
What system resources are allowed to the process.
3. Process id
A unique identifier assigned by the operating system to the process.
4. Pointer
A pointer to the parent process.
5. Program counter
Address to the instruction that is to be executed next in the program.
6. Process scheduling information
Process priority and other scheduling information required to schedule the process.
7. Memory Management information
This contains the information about the page table, segment table, page size.
8. Accounting information
The amount of CPU used for the process execution etc.
9. I/O status information
This includes a list of I/O devices allocated to the process.
10. CPU registers
Various CPU registers where process need to be stored for execution for running state.

Conclusion
A process in real life means something in action. A computer process is no different than that. In the world of computers, when a computer program is in action, it is called a process. A process passes through different states throughout its lifetime and a data structure is maintained by the operating system for every process to store information about it.