SlideShare a Scribd company logo
T S PRADEEP KUMAR
   Process Introduction
   Process States
   Process Control Block (PCB or TCB)
   Process creation and I/O Requests
   Schedulers
   A program in execution
   Process in memory has
    ◦ Text section (includes program code)
    ◦ Data section (global variables)
    ◦ Stack (contains the return address, local address,
      function parameters)
    ◦ Heap (dynamic runtime memory during the
      execution of process and this may vary)
stack


heap


data


text
   Program is a passive entity
   Program stores sequence of instructions written
    in a file stored in the secondary memory
   Process is active entity which has program
    counter that tells the next instruction to be
    executed and also has a set of associated
    resources.
   Program becomes a process when the file is
    loaded in the primary memory
    ◦ Example: double click the executable file of running
      a.out is example of program -> process
   New – a process is generated
   Ready – multiple processes are ready to run
    under a CPU.
   Running – currently executing on the CPU
   Waiting – Waiting for an Event or an IO, Once
    the event is available, process moves to the
    ready state.
   Terminated – Process is killed or terminated
   Identifier: A unique identifier associated with this
    process, to distinguish it from all other
    processes.
   State: If the process is currently executing, it is in
    the running state.
   Priority: Priority level relative to other processes.
   Program counter: The address of the next
    instruction in the program to be executed.
   Memory pointers: Includes pointers to the
    program code and data associated with this
    process, plus any memory blocks shared with
    other processes.
   Context data: These are data that are present
    in registers in the processor while the process
    is executing.
   I/O status information: Includes outstanding
    I/O requests, I/O devices (e.g., disk drives)
    assigned to this process, a list of files in use
    by the process, and so on.
   Accounting information: May include the
    amount of processor time and clock time
    used, time limits, account numbers, and so
    on.
pid_t pid                    Process identifier
Long state                   State of a process
Unsigned int time_slice      Scheduling information
Struct task_struct *parent   This process’s parent
Struct list_head child;      This process’s children
Struct files_struct *files   List of open files
Struct mm_struct *mm         Addresss space of this process
int main()
{
pid_t pid;
pid =fork();
if (pid < 0) { I* error occurred *I
fprintf(stderr, "Fork Failed");
return 1;
}
else if (pid == 0) { I* child process *I
execlp("lbinlls","ls",NULL);
}
else { I* parent process *I
}
wait (NULL) ;
printf("Child Complete");
return 0;}
   A process migrates among various scheduling
    queues throughout its lifetime
   Long Term Scheduler or Job Scheduler
    ◦ in a batch system, more processes are submitted
      than can be executed immediately.
    ◦ execute less frequently
   Short Term Scheduler or CPU Scheduler
    ◦ selects from among the processes that are ready
      to execute and allocates the CPU to one of them.
    ◦ Runs most frequently (ex: runs every 100ms)
   Processes are either I/O Bound or CPU Bound
   Long Term schedulers should have the
    correct mix of I/O Process and CPU Bound
    processes
   Short Term Scheduler schedules the
    Processes that are ready to run under the CPU
   So Unix and Microsoft does not have Long
    Term Schedulers as it more time to get
    executed
   When an interrupt occurs, the state of the
    process to be saved which called as context
    switching
   It depends highly on the hardware support
   Hardware architecture should have more
    number of registers as compared to more
    number of context switches.
   Reasons for IPC
    ◦ Information Sharing
      Sharing file between processes
    ◦ Computational Speedup
      Processes are break down in to sub-process
    ◦ Modularity
    ◦ Convenience
      Individual user can work on many tasks at the same
       time
   Independent Processes
    ◦ No interference with other processes in the system
   Cooperative processes
    ◦ Shared Memory
    ◦ Message Passing
   Message Passing
    ◦ Suitable for smaller amount of data
    ◦ Easier to implement
    ◦ Usually implemented using System calls, so kernel
      is bothered every-time during message
      communication
   Shared Memory
    ◦ Faster to implement
    ◦ system calls are required only to establish shared-
      memory regions.
    ◦ Once shared memory is established, all accesses are
      treated as routine memory accesses, and no
      assistance from the kernel is required.
   Use of Producer – Consumer relations
   Producer will produce and consumer will
    consume the items produced by the producer
   P-C problem achieved through
    ◦ Unbounded buffer
      No limit on the size of queue
       The consumer may have to wait for new items
        but the producer can always produce new items.
    ◦ Bounded buffer
      Implement like a circular Queue
      Producer will wait if the queue is full
      Consume will waif if the queue is empty
#define BUFFER_SIZE 10
typedef struct {
…
}item;
item buffer[BUFFER_SIZE];
int in = 0;
int out = 0;
/*
Buffer is empty when in==out
Buffer is full when ((in+1)%BUFFER_SIZE)==out
*/
while (true) {
/* produce an item in nextProduced *I
while ( ((in + 1) % BUFFER_SIZE) == out)
I* do nothing *I
buffer[in] = nextProduced;
in = (in + 1) % BUFFER_SIZE;
}
item nextConsumed;
while (true) {
while (in == out)
; II do nothing
nextConsumed = buffer[out];
out = (out + 1) % BUFFER_SIZE;
I* consume the item in nextConsumed *I
}

More Related Content

What's hot

INTER PROCESS COMMUNICATION (IPC).pptx
INTER PROCESS COMMUNICATION (IPC).pptxINTER PROCESS COMMUNICATION (IPC).pptx
INTER PROCESS COMMUNICATION (IPC).pptx
LECO9
 
Process in operating system
Process in operating systemProcess in operating system
Process in operating system
Chetan Mahawar
 
Memory Management in OS
Memory Management in OSMemory Management in OS
Memory Management in OS
vampugani
 
Lecture 2 process
Lecture 2   processLecture 2   process
Lecture 2 process
Kumbirai Junior Muzavazi
 
System calls
System callsSystem calls
System calls
Bernard Senam
 
Memory Management in OS
Memory Management in OSMemory Management in OS
Memory Management in OS
Kumar Pritam
 
Process management in os
Process management in osProcess management in os
Process management in os
Miong Lazaro
 
OS concepts 6 OS for various computing environments
OS concepts 6 OS for various computing environmentsOS concepts 6 OS for various computing environments
OS concepts 6 OS for various computing environments
Vaibhav Khanna
 
Memory management
Memory managementMemory management
Memory management
Vishal Singh
 
Direct Memory Access ppt
Direct Memory Access pptDirect Memory Access ppt
Linux process management
Linux process managementLinux process management
Linux process managementRaghu nath
 
Concurrency control
Concurrency controlConcurrency control
Concurrency control
Soumyajit Dutta
 
Operating Systems: Process Scheduling
Operating Systems: Process SchedulingOperating Systems: Process Scheduling
Operating Systems: Process Scheduling
Damian T. Gordon
 
SCHEDULING ALGORITHMS
SCHEDULING ALGORITHMSSCHEDULING ALGORITHMS
SCHEDULING ALGORITHMS
Dhaval Sakhiya
 
Storage Management
Storage ManagementStorage Management
Storage Management
SURBHI SAROHA
 
Cs8493 unit 4
Cs8493 unit 4Cs8493 unit 4
Cs8493 unit 4
Kathirvel Ayyaswamy
 
Scheduling
SchedulingScheduling
Inter Process Communication
Inter Process CommunicationInter Process Communication
Inter Process Communication
Adeel Rasheed
 
Methods for handling deadlock
Methods for handling deadlockMethods for handling deadlock
Methods for handling deadlock
sangrampatil81
 

What's hot (20)

INTER PROCESS COMMUNICATION (IPC).pptx
INTER PROCESS COMMUNICATION (IPC).pptxINTER PROCESS COMMUNICATION (IPC).pptx
INTER PROCESS COMMUNICATION (IPC).pptx
 
Process in operating system
Process in operating systemProcess in operating system
Process in operating system
 
Memory Management in OS
Memory Management in OSMemory Management in OS
Memory Management in OS
 
Lecture 2 process
Lecture 2   processLecture 2   process
Lecture 2 process
 
System calls
System callsSystem calls
System calls
 
Memory Management in OS
Memory Management in OSMemory Management in OS
Memory Management in OS
 
Process management in os
Process management in osProcess management in os
Process management in os
 
OS concepts 6 OS for various computing environments
OS concepts 6 OS for various computing environmentsOS concepts 6 OS for various computing environments
OS concepts 6 OS for various computing environments
 
Memory management
Memory managementMemory management
Memory management
 
Direct Memory Access ppt
Direct Memory Access pptDirect Memory Access ppt
Direct Memory Access ppt
 
Linux process management
Linux process managementLinux process management
Linux process management
 
operating system structure
operating system structureoperating system structure
operating system structure
 
Concurrency control
Concurrency controlConcurrency control
Concurrency control
 
Operating Systems: Process Scheduling
Operating Systems: Process SchedulingOperating Systems: Process Scheduling
Operating Systems: Process Scheduling
 
SCHEDULING ALGORITHMS
SCHEDULING ALGORITHMSSCHEDULING ALGORITHMS
SCHEDULING ALGORITHMS
 
Storage Management
Storage ManagementStorage Management
Storage Management
 
Cs8493 unit 4
Cs8493 unit 4Cs8493 unit 4
Cs8493 unit 4
 
Scheduling
SchedulingScheduling
Scheduling
 
Inter Process Communication
Inter Process CommunicationInter Process Communication
Inter Process Communication
 
Methods for handling deadlock
Methods for handling deadlockMethods for handling deadlock
Methods for handling deadlock
 

Viewers also liked

Os presentation process
Os presentation processOs presentation process
Os presentation processNaseer Ahmad
 
Chapter 3 - Processes
Chapter 3 - ProcessesChapter 3 - Processes
Chapter 3 - Processes
Wayne Jones Jnr
 
Process of operating system
Process of operating systemProcess of operating system
Processes and threads
Processes and threadsProcesses and threads
Processes Control Block (Operating System)
Processes Control Block (Operating System)Processes Control Block (Operating System)
Processes Control Block (Operating System)Imdad Ullah
 
Process management
Process managementProcess management
Process management
Birju Tank
 
Introduction to Computers
Introduction to ComputersIntroduction to Computers
Introduction to ComputersSamudin Kassan
 

Viewers also liked (7)

Os presentation process
Os presentation processOs presentation process
Os presentation process
 
Chapter 3 - Processes
Chapter 3 - ProcessesChapter 3 - Processes
Chapter 3 - Processes
 
Process of operating system
Process of operating systemProcess of operating system
Process of operating system
 
Processes and threads
Processes and threadsProcesses and threads
Processes and threads
 
Processes Control Block (Operating System)
Processes Control Block (Operating System)Processes Control Block (Operating System)
Processes Control Block (Operating System)
 
Process management
Process managementProcess management
Process management
 
Introduction to Computers
Introduction to ComputersIntroduction to Computers
Introduction to Computers
 

Similar to Lecture 5 process concept

OS_Unit_II_Ch3 Process and CPU Scheduling
OS_Unit_II_Ch3 Process and CPU SchedulingOS_Unit_II_Ch3 Process and CPU Scheduling
OS_Unit_II_Ch3 Process and CPU Scheduling
SDivya19
 
OS-Process.pdf
OS-Process.pdfOS-Process.pdf
OS-Process.pdf
Rakibul Rakib
 
Lecture_Slide_4.pptx
Lecture_Slide_4.pptxLecture_Slide_4.pptx
Lecture_Slide_4.pptx
DiptoRoy21
 
UNIT-2-Process-Management.pdf
UNIT-2-Process-Management.pdfUNIT-2-Process-Management.pdf
UNIT-2-Process-Management.pdf
aakritii765
 
Operating Systems Unit Two - Fourth Semester - Engineering
Operating Systems Unit Two - Fourth Semester - EngineeringOperating Systems Unit Two - Fourth Semester - Engineering
Operating Systems Unit Two - Fourth Semester - Engineering
Yogesh Santhan
 
operating system module 2 presentation notes
operating system module 2 presentation notesoperating system module 2 presentation notes
operating system module 2 presentation notes
ksamjish
 
Cs8493 unit 2
Cs8493 unit 2Cs8493 unit 2
Cs8493 unit 2
Kathirvel Ayyaswamy
 
LM9 - OPERATIONS, SCHEDULING, Inter process xommuncation
LM9 - OPERATIONS, SCHEDULING, Inter process xommuncationLM9 - OPERATIONS, SCHEDULING, Inter process xommuncation
LM9 - OPERATIONS, SCHEDULING, Inter process xommuncation
Mani Deepak Choudhry
 
CS6401 OPERATING SYSTEMS Unit 2
CS6401 OPERATING SYSTEMS Unit 2CS6401 OPERATING SYSTEMS Unit 2
CS6401 OPERATING SYSTEMS Unit 2
Kathirvel Ayyaswamy
 
Ch03- PROCESSES.ppt
Ch03- PROCESSES.pptCh03- PROCESSES.ppt
Ch03- PROCESSES.ppt
MeghaSharma474761
 
Ch2_Processes_and_process_management_1.ppt
Ch2_Processes_and_process_management_1.pptCh2_Processes_and_process_management_1.ppt
Ch2_Processes_and_process_management_1.ppt
Mohammad Almuiet
 
CH03.pdf
CH03.pdfCH03.pdf
CH03.pdf
ImranKhan880955
 
Ch3 processes
Ch3   processesCh3   processes
Ch3 processes
Welly Dian Astika
 
UNIT - 3 PPT(Part- 1)_.pdf
UNIT - 3 PPT(Part- 1)_.pdfUNIT - 3 PPT(Part- 1)_.pdf
UNIT - 3 PPT(Part- 1)_.pdf
AyushSharma651966
 
Advanced Operating Systems......Process Management
Advanced Operating Systems......Process ManagementAdvanced Operating Systems......Process Management
Advanced Operating Systems......Process Management
Veejeya Kumbhar
 
Processes in Operating System
Processes in Operating SystemProcesses in Operating System
Processes in Operating System
Arafat Hossan
 
Chapter -2 operating system presentation
Chapter -2 operating system presentationChapter -2 operating system presentation
Chapter -2 operating system presentation
chnrketan
 
Chapter 1 Introduction to Operating System Concepts
Chapter 1 Introduction to Operating System ConceptsChapter 1 Introduction to Operating System Concepts
Chapter 1 Introduction to Operating System Concepts
MeenalJabde
 
Process
ProcessProcess

Similar to Lecture 5 process concept (20)

OS_Unit_II_Ch3 Process and CPU Scheduling
OS_Unit_II_Ch3 Process and CPU SchedulingOS_Unit_II_Ch3 Process and CPU Scheduling
OS_Unit_II_Ch3 Process and CPU Scheduling
 
OS-Process.pdf
OS-Process.pdfOS-Process.pdf
OS-Process.pdf
 
Lecture_Slide_4.pptx
Lecture_Slide_4.pptxLecture_Slide_4.pptx
Lecture_Slide_4.pptx
 
UNIT-2-Process-Management.pdf
UNIT-2-Process-Management.pdfUNIT-2-Process-Management.pdf
UNIT-2-Process-Management.pdf
 
Operating Systems Unit Two - Fourth Semester - Engineering
Operating Systems Unit Two - Fourth Semester - EngineeringOperating Systems Unit Two - Fourth Semester - Engineering
Operating Systems Unit Two - Fourth Semester - Engineering
 
operating system module 2 presentation notes
operating system module 2 presentation notesoperating system module 2 presentation notes
operating system module 2 presentation notes
 
Cs8493 unit 2
Cs8493 unit 2Cs8493 unit 2
Cs8493 unit 2
 
LM9 - OPERATIONS, SCHEDULING, Inter process xommuncation
LM9 - OPERATIONS, SCHEDULING, Inter process xommuncationLM9 - OPERATIONS, SCHEDULING, Inter process xommuncation
LM9 - OPERATIONS, SCHEDULING, Inter process xommuncation
 
Process Management
Process ManagementProcess Management
Process Management
 
CS6401 OPERATING SYSTEMS Unit 2
CS6401 OPERATING SYSTEMS Unit 2CS6401 OPERATING SYSTEMS Unit 2
CS6401 OPERATING SYSTEMS Unit 2
 
Ch03- PROCESSES.ppt
Ch03- PROCESSES.pptCh03- PROCESSES.ppt
Ch03- PROCESSES.ppt
 
Ch2_Processes_and_process_management_1.ppt
Ch2_Processes_and_process_management_1.pptCh2_Processes_and_process_management_1.ppt
Ch2_Processes_and_process_management_1.ppt
 
CH03.pdf
CH03.pdfCH03.pdf
CH03.pdf
 
Ch3 processes
Ch3   processesCh3   processes
Ch3 processes
 
UNIT - 3 PPT(Part- 1)_.pdf
UNIT - 3 PPT(Part- 1)_.pdfUNIT - 3 PPT(Part- 1)_.pdf
UNIT - 3 PPT(Part- 1)_.pdf
 
Advanced Operating Systems......Process Management
Advanced Operating Systems......Process ManagementAdvanced Operating Systems......Process Management
Advanced Operating Systems......Process Management
 
Processes in Operating System
Processes in Operating SystemProcesses in Operating System
Processes in Operating System
 
Chapter -2 operating system presentation
Chapter -2 operating system presentationChapter -2 operating system presentation
Chapter -2 operating system presentation
 
Chapter 1 Introduction to Operating System Concepts
Chapter 1 Introduction to Operating System ConceptsChapter 1 Introduction to Operating System Concepts
Chapter 1 Introduction to Operating System Concepts
 
Process
ProcessProcess
Process
 

More from Pradeep Kumar TS

Digital Portfolio and Footprint
Digital Portfolio and FootprintDigital Portfolio and Footprint
Digital Portfolio and Footprint
Pradeep Kumar TS
 
Open book Examination
Open book ExaminationOpen book Examination
Open book Examination
Pradeep Kumar TS
 
Software Define Networking (SDN)
Software Define Networking (SDN)Software Define Networking (SDN)
Software Define Networking (SDN)
Pradeep Kumar TS
 
What next - Career Enhancement of Graduates
What next - Career Enhancement of GraduatesWhat next - Career Enhancement of Graduates
What next - Career Enhancement of Graduates
Pradeep Kumar TS
 
Protothreads
ProtothreadsProtothreads
Protothreads
Pradeep Kumar TS
 
6LoWPAN
6LoWPAN 6LoWPAN
Software Defined Networks
Software Defined NetworksSoftware Defined Networks
Software Defined Networks
Pradeep Kumar TS
 
Higher Order Thinking - Question paper setting
Higher Order Thinking - Question paper settingHigher Order Thinking - Question paper setting
Higher Order Thinking - Question paper setting
Pradeep Kumar TS
 
IoT Communication Protocols
IoT Communication ProtocolsIoT Communication Protocols
IoT Communication Protocols
Pradeep Kumar TS
 
IoT Applications
IoT ApplicationsIoT Applications
IoT Applications
Pradeep Kumar TS
 
RPL - Routing Protocol for Low Power and Lossy Networks
RPL - Routing Protocol for Low Power and Lossy NetworksRPL - Routing Protocol for Low Power and Lossy Networks
RPL - Routing Protocol for Low Power and Lossy Networks
Pradeep Kumar TS
 
Mannasim for NS2
Mannasim for NS2Mannasim for NS2
Mannasim for NS2
Pradeep Kumar TS
 
Recompiling network simulator 2
Recompiling network simulator 2Recompiling network simulator 2
Recompiling network simulator 2
Pradeep Kumar TS
 
OTcl and C++ linkages in NS2
OTcl and C++ linkages in NS2OTcl and C++ linkages in NS2
OTcl and C++ linkages in NS2
Pradeep Kumar TS
 
Wired and Wireless Examples in ns2
Wired and Wireless Examples in ns2Wired and Wireless Examples in ns2
Wired and Wireless Examples in ns2
Pradeep Kumar TS
 
Installation of ns2
Installation of ns2Installation of ns2
Installation of ns2
Pradeep Kumar TS
 
Introduction to ns2
Introduction to ns2Introduction to ns2
Introduction to ns2
Pradeep Kumar TS
 
Software Defined Networking - 1
Software Defined Networking - 1Software Defined Networking - 1
Software Defined Networking - 1
Pradeep Kumar TS
 
Software Defined Networking - 2
Software Defined Networking - 2Software Defined Networking - 2
Software Defined Networking - 2
Pradeep Kumar TS
 
Software Defined Networking - 3
Software Defined Networking - 3Software Defined Networking - 3
Software Defined Networking - 3
Pradeep Kumar TS
 

More from Pradeep Kumar TS (20)

Digital Portfolio and Footprint
Digital Portfolio and FootprintDigital Portfolio and Footprint
Digital Portfolio and Footprint
 
Open book Examination
Open book ExaminationOpen book Examination
Open book Examination
 
Software Define Networking (SDN)
Software Define Networking (SDN)Software Define Networking (SDN)
Software Define Networking (SDN)
 
What next - Career Enhancement of Graduates
What next - Career Enhancement of GraduatesWhat next - Career Enhancement of Graduates
What next - Career Enhancement of Graduates
 
Protothreads
ProtothreadsProtothreads
Protothreads
 
6LoWPAN
6LoWPAN 6LoWPAN
6LoWPAN
 
Software Defined Networks
Software Defined NetworksSoftware Defined Networks
Software Defined Networks
 
Higher Order Thinking - Question paper setting
Higher Order Thinking - Question paper settingHigher Order Thinking - Question paper setting
Higher Order Thinking - Question paper setting
 
IoT Communication Protocols
IoT Communication ProtocolsIoT Communication Protocols
IoT Communication Protocols
 
IoT Applications
IoT ApplicationsIoT Applications
IoT Applications
 
RPL - Routing Protocol for Low Power and Lossy Networks
RPL - Routing Protocol for Low Power and Lossy NetworksRPL - Routing Protocol for Low Power and Lossy Networks
RPL - Routing Protocol for Low Power and Lossy Networks
 
Mannasim for NS2
Mannasim for NS2Mannasim for NS2
Mannasim for NS2
 
Recompiling network simulator 2
Recompiling network simulator 2Recompiling network simulator 2
Recompiling network simulator 2
 
OTcl and C++ linkages in NS2
OTcl and C++ linkages in NS2OTcl and C++ linkages in NS2
OTcl and C++ linkages in NS2
 
Wired and Wireless Examples in ns2
Wired and Wireless Examples in ns2Wired and Wireless Examples in ns2
Wired and Wireless Examples in ns2
 
Installation of ns2
Installation of ns2Installation of ns2
Installation of ns2
 
Introduction to ns2
Introduction to ns2Introduction to ns2
Introduction to ns2
 
Software Defined Networking - 1
Software Defined Networking - 1Software Defined Networking - 1
Software Defined Networking - 1
 
Software Defined Networking - 2
Software Defined Networking - 2Software Defined Networking - 2
Software Defined Networking - 2
 
Software Defined Networking - 3
Software Defined Networking - 3Software Defined Networking - 3
Software Defined Networking - 3
 

Recently uploaded

Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
EduSkills OECD
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
timhan337
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Po-Chuan Chen
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
BhavyaRajput3
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
DhatriParmar
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
Nguyen Thanh Tu Collection
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
Peter Windle
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
vaibhavrinwa19
 

Recently uploaded (20)

Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
 

Lecture 5 process concept

  • 1. T S PRADEEP KUMAR
  • 2. Process Introduction  Process States  Process Control Block (PCB or TCB)  Process creation and I/O Requests  Schedulers
  • 3. A program in execution  Process in memory has ◦ Text section (includes program code) ◦ Data section (global variables) ◦ Stack (contains the return address, local address, function parameters) ◦ Heap (dynamic runtime memory during the execution of process and this may vary)
  • 5.
  • 6. Program is a passive entity  Program stores sequence of instructions written in a file stored in the secondary memory  Process is active entity which has program counter that tells the next instruction to be executed and also has a set of associated resources.  Program becomes a process when the file is loaded in the primary memory ◦ Example: double click the executable file of running a.out is example of program -> process
  • 7.
  • 8. New – a process is generated  Ready – multiple processes are ready to run under a CPU.  Running – currently executing on the CPU  Waiting – Waiting for an Event or an IO, Once the event is available, process moves to the ready state.  Terminated – Process is killed or terminated
  • 9.
  • 10. Identifier: A unique identifier associated with this process, to distinguish it from all other processes.  State: If the process is currently executing, it is in the running state.  Priority: Priority level relative to other processes.  Program counter: The address of the next instruction in the program to be executed.  Memory pointers: Includes pointers to the program code and data associated with this process, plus any memory blocks shared with other processes.
  • 11. Context data: These are data that are present in registers in the processor while the process is executing.  I/O status information: Includes outstanding I/O requests, I/O devices (e.g., disk drives) assigned to this process, a list of files in use by the process, and so on.  Accounting information: May include the amount of processor time and clock time used, time limits, account numbers, and so on.
  • 12. pid_t pid Process identifier Long state State of a process Unsigned int time_slice Scheduling information Struct task_struct *parent This process’s parent Struct list_head child; This process’s children Struct files_struct *files List of open files Struct mm_struct *mm Addresss space of this process
  • 13.
  • 14.
  • 15.
  • 16. int main() { pid_t pid; pid =fork(); if (pid < 0) { I* error occurred *I fprintf(stderr, "Fork Failed"); return 1; } else if (pid == 0) { I* child process *I execlp("lbinlls","ls",NULL); } else { I* parent process *I } wait (NULL) ; printf("Child Complete"); return 0;}
  • 17. A process migrates among various scheduling queues throughout its lifetime  Long Term Scheduler or Job Scheduler ◦ in a batch system, more processes are submitted than can be executed immediately. ◦ execute less frequently  Short Term Scheduler or CPU Scheduler ◦ selects from among the processes that are ready to execute and allocates the CPU to one of them. ◦ Runs most frequently (ex: runs every 100ms)
  • 18. Processes are either I/O Bound or CPU Bound  Long Term schedulers should have the correct mix of I/O Process and CPU Bound processes  Short Term Scheduler schedules the Processes that are ready to run under the CPU  So Unix and Microsoft does not have Long Term Schedulers as it more time to get executed
  • 19. When an interrupt occurs, the state of the process to be saved which called as context switching  It depends highly on the hardware support  Hardware architecture should have more number of registers as compared to more number of context switches.
  • 20. Reasons for IPC ◦ Information Sharing  Sharing file between processes ◦ Computational Speedup  Processes are break down in to sub-process ◦ Modularity ◦ Convenience  Individual user can work on many tasks at the same time
  • 21. Independent Processes ◦ No interference with other processes in the system  Cooperative processes ◦ Shared Memory ◦ Message Passing
  • 22.
  • 23. Message Passing ◦ Suitable for smaller amount of data ◦ Easier to implement ◦ Usually implemented using System calls, so kernel is bothered every-time during message communication  Shared Memory ◦ Faster to implement ◦ system calls are required only to establish shared- memory regions. ◦ Once shared memory is established, all accesses are treated as routine memory accesses, and no assistance from the kernel is required.
  • 24. Use of Producer – Consumer relations  Producer will produce and consumer will consume the items produced by the producer  P-C problem achieved through ◦ Unbounded buffer  No limit on the size of queue  The consumer may have to wait for new items but the producer can always produce new items. ◦ Bounded buffer  Implement like a circular Queue  Producer will wait if the queue is full  Consume will waif if the queue is empty
  • 25. #define BUFFER_SIZE 10 typedef struct { … }item; item buffer[BUFFER_SIZE]; int in = 0; int out = 0; /* Buffer is empty when in==out Buffer is full when ((in+1)%BUFFER_SIZE)==out */
  • 26. while (true) { /* produce an item in nextProduced *I while ( ((in + 1) % BUFFER_SIZE) == out) I* do nothing *I buffer[in] = nextProduced; in = (in + 1) % BUFFER_SIZE; }
  • 27. item nextConsumed; while (true) { while (in == out) ; II do nothing nextConsumed = buffer[out]; out = (out + 1) % BUFFER_SIZE; I* consume the item in nextConsumed *I }