1
What is a Process?
 A process is a program in execution. Process is not as same as
program code but a lot more than it. A process is an 'active'
entity as opposed to program which is considered to be a
'passive' entity. Attributes held by process include hardware
state, memory, CPU etc .
2
Program & Process
 Program
- A computer program is a collection of instruction that performs a
specific task when executed by a computer .
- Passive entity
 Process
- Active entity
- Program code + pc + associated resources + Status of the
process’s execution . 3
Processes
• Process Concept
• Process Scheduling
• Operations on Processes
• Cooperating Processes
• Interprocess Communication
• Communication in Client-Server Systems
4
Process Concept
 An operating system executes a variety of programs: -
- Batch system – jobs
- Time-shared systems – user programs or tasks
 Process – a program in execution; process execution must progress in
sequential fashion.
 A process includes:
- Text section
- Data section
- Stack section
- program counter 5
Process Concept
• Program is passive entity stored on disk (executable file), process is active
– Program becomes process when executable file loaded into memory
• Execution of program started via GUI mouse clicks, command line entry of
its name, etc
• One program can be several processes
– Consider multiple users executing the same program
6
What the OS is going to do for the Process?
 Creating and removing( destroying )process .
 Controlling the progress of processes .
 Acting on interrupts and arithmetic errors .
 Resource allocation among processes .
 Inter process communication .
7
Process Memory
 Process memory is divided into four sections for efficient working : -
 The Text section is made up of the compiled program code, read in
from non-volatile storage when the program is launched.
 The Data section is made up the global and static variables,
allocated and initialized prior to executing the main.
 The Heap is used for the dynamic memory allocation, and is
managed via calls to new, delete, malloc, free, etc.
 The Stack is used for local variables. Space on the stack is reserved
for local variables when they are declared. 8
9
#include<iostream>
using namespace std;
int total;
int Square(int x)
{
return x*x;
}
int SquareOfSum(int x,int y)
{
int z=Square(x+y);
return z;
}
int main()
{
int a=4,b=8;
total=SquareOfSum(a,b);
cout<<"Total ="<<total<<endl;
system("pause");
}
Process Memory
9
10
#include<iostream>
using namespace std;
void main()
{
int x;
x=10;
int *ptr;
ptr=&x;
cout<<*ptr<<" "<<x<<" "<<ptr <<" "<<&x<<endl;
*ptr=30;
cout<<endl<<endl;
cout<<*ptr<<" "<<x<<" "<< ptr <<" "<<&x<<endl;
cout<<endl<<endl;
system("pause");
}
Stack & Heap
Any
Question ?
11
FOR
ATTENTIO
12

Process concept

  • 1.
  • 2.
    What is aProcess?  A process is a program in execution. Process is not as same as program code but a lot more than it. A process is an 'active' entity as opposed to program which is considered to be a 'passive' entity. Attributes held by process include hardware state, memory, CPU etc . 2
  • 3.
    Program & Process Program - A computer program is a collection of instruction that performs a specific task when executed by a computer . - Passive entity  Process - Active entity - Program code + pc + associated resources + Status of the process’s execution . 3
  • 4.
    Processes • Process Concept •Process Scheduling • Operations on Processes • Cooperating Processes • Interprocess Communication • Communication in Client-Server Systems 4
  • 5.
    Process Concept  Anoperating system executes a variety of programs: - - Batch system – jobs - Time-shared systems – user programs or tasks  Process – a program in execution; process execution must progress in sequential fashion.  A process includes: - Text section - Data section - Stack section - program counter 5
  • 6.
    Process Concept • Programis passive entity stored on disk (executable file), process is active – Program becomes process when executable file loaded into memory • Execution of program started via GUI mouse clicks, command line entry of its name, etc • One program can be several processes – Consider multiple users executing the same program 6
  • 7.
    What the OSis going to do for the Process?  Creating and removing( destroying )process .  Controlling the progress of processes .  Acting on interrupts and arithmetic errors .  Resource allocation among processes .  Inter process communication . 7
  • 8.
    Process Memory  Processmemory is divided into four sections for efficient working : -  The Text section is made up of the compiled program code, read in from non-volatile storage when the program is launched.  The Data section is made up the global and static variables, allocated and initialized prior to executing the main.  The Heap is used for the dynamic memory allocation, and is managed via calls to new, delete, malloc, free, etc.  The Stack is used for local variables. Space on the stack is reserved for local variables when they are declared. 8
  • 9.
    9 #include<iostream> using namespace std; inttotal; int Square(int x) { return x*x; } int SquareOfSum(int x,int y) { int z=Square(x+y); return z; } int main() { int a=4,b=8; total=SquareOfSum(a,b); cout<<"Total ="<<total<<endl; system("pause"); } Process Memory 9
  • 10.
    10 #include<iostream> using namespace std; voidmain() { int x; x=10; int *ptr; ptr=&x; cout<<*ptr<<" "<<x<<" "<<ptr <<" "<<&x<<endl; *ptr=30; cout<<endl<<endl; cout<<*ptr<<" "<<x<<" "<< ptr <<" "<<&x<<endl; cout<<endl<<endl; system("pause"); } Stack & Heap
  • 11.
  • 12.