SlideShare une entreprise Scribd logo
1  sur  27
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
}

Contenu connexe

Tendances

Process concept
Process conceptProcess concept
Process conceptjangezkhan
 
MULTILEVEL QUEUE SCHEDULING
MULTILEVEL QUEUE SCHEDULINGMULTILEVEL QUEUE SCHEDULING
MULTILEVEL QUEUE SCHEDULINGgarishma bhatia
 
Memory management ppt
Memory management pptMemory management ppt
Memory management pptManishaJha43
 
File Management in Operating System
File Management in Operating SystemFile Management in Operating System
File Management in Operating SystemJanki Shah
 
Operating system - Process and its concepts
Operating system - Process and its conceptsOperating system - Process and its concepts
Operating system - Process and its conceptsKaran Thakkar
 
Contiguous Memory Allocation.ppt
Contiguous Memory Allocation.pptContiguous Memory Allocation.ppt
Contiguous Memory Allocation.pptinfomerlin
 
contiguous memory allocation.pptx
contiguous memory allocation.pptxcontiguous memory allocation.pptx
contiguous memory allocation.pptxRajapriya82
 
Page replacement algorithms
Page replacement algorithmsPage replacement algorithms
Page replacement algorithmsPiyush Rochwani
 
Operating system memory management
Operating system memory managementOperating system memory management
Operating system memory managementrprajat007
 
file system in operating system
file system in operating systemfile system in operating system
file system in operating systemtittuajay
 
Sorting Algorithms
Sorting AlgorithmsSorting Algorithms
Sorting AlgorithmsPranay Neema
 
Free space managment46
Free space managment46Free space managment46
Free space managment46myrajendra
 
Process in operating system
Process in operating systemProcess in operating system
Process in operating systemChetan Mahawar
 

Tendances (20)

Process concept
Process conceptProcess concept
Process concept
 
Deadlock
DeadlockDeadlock
Deadlock
 
MULTILEVEL QUEUE SCHEDULING
MULTILEVEL QUEUE SCHEDULINGMULTILEVEL QUEUE SCHEDULING
MULTILEVEL QUEUE SCHEDULING
 
Scheduling algorithms
Scheduling algorithmsScheduling algorithms
Scheduling algorithms
 
Conditional branches
Conditional branchesConditional branches
Conditional branches
 
Memory management ppt
Memory management pptMemory management ppt
Memory management ppt
 
File Management in Operating System
File Management in Operating SystemFile Management in Operating System
File Management in Operating System
 
Operating system - Process and its concepts
Operating system - Process and its conceptsOperating system - Process and its concepts
Operating system - Process and its concepts
 
Contiguous Memory Allocation.ppt
Contiguous Memory Allocation.pptContiguous Memory Allocation.ppt
Contiguous Memory Allocation.ppt
 
operating system structure
operating system structureoperating system structure
operating system structure
 
Deadlock ppt
Deadlock ppt Deadlock ppt
Deadlock ppt
 
contiguous memory allocation.pptx
contiguous memory allocation.pptxcontiguous memory allocation.pptx
contiguous memory allocation.pptx
 
Page replacement algorithms
Page replacement algorithmsPage replacement algorithms
Page replacement algorithms
 
Operating system memory management
Operating system memory managementOperating system memory management
Operating system memory management
 
file system in operating system
file system in operating systemfile system in operating system
file system in operating system
 
Sorting Algorithms
Sorting AlgorithmsSorting Algorithms
Sorting Algorithms
 
Disk structure
Disk structureDisk structure
Disk structure
 
Free space managment46
Free space managment46Free space managment46
Free space managment46
 
Process in operating system
Process in operating systemProcess in operating system
Process in operating system
 
Memory management
Memory managementMemory management
Memory management
 

En vedette

En vedette (6)

Os presentation process
Os presentation processOs presentation process
Os presentation process
 
Chapter 3 - Processes
Chapter 3 - ProcessesChapter 3 - Processes
Chapter 3 - Processes
 
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
 

Similaire à Lecture 5 process concept

Lecture_Slide_4.pptx
Lecture_Slide_4.pptxLecture_Slide_4.pptx
Lecture_Slide_4.pptxDiptoRoy21
 
UNIT-2-Process-Management.pdf
UNIT-2-Process-Management.pdfUNIT-2-Process-Management.pdf
UNIT-2-Process-Management.pdfaakritii765
 
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 - EngineeringYogesh Santhan
 
LM9 - OPERATIONS, SCHEDULING, Inter process xommuncation
LM9 - OPERATIONS, SCHEDULING, Inter process xommuncationLM9 - OPERATIONS, SCHEDULING, Inter process xommuncation
LM9 - OPERATIONS, SCHEDULING, Inter process xommuncationMani Deepak Choudhry
 
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.pptMohammad Almuiet
 
Advanced Operating Systems......Process Management
Advanced Operating Systems......Process ManagementAdvanced Operating Systems......Process Management
Advanced Operating Systems......Process ManagementVeejeya Kumbhar
 
Processes in Operating System
Processes in Operating SystemProcesses in Operating System
Processes in Operating SystemArafat Hossan
 
Chapter -2 operating system presentation
Chapter -2 operating system presentationChapter -2 operating system presentation
Chapter -2 operating system presentationchnrketan
 
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 ConceptsMeenalJabde
 

Similaire à Lecture 5 process concept (20)

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
 
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
 
Processes
ProcessesProcesses
Processes
 
Chapter 3.pdf
Chapter 3.pdfChapter 3.pdf
Chapter 3.pdf
 

Plus de Pradeep Kumar TS

Digital Portfolio and Footprint
Digital Portfolio and FootprintDigital Portfolio and Footprint
Digital Portfolio and FootprintPradeep 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 GraduatesPradeep Kumar TS
 
Higher Order Thinking - Question paper setting
Higher Order Thinking - Question paper settingHigher Order Thinking - Question paper setting
Higher Order Thinking - Question paper settingPradeep Kumar TS
 
IoT Communication Protocols
IoT Communication ProtocolsIoT Communication Protocols
IoT Communication ProtocolsPradeep 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 NetworksPradeep Kumar TS
 
Recompiling network simulator 2
Recompiling network simulator 2Recompiling network simulator 2
Recompiling network simulator 2Pradeep Kumar TS
 
OTcl and C++ linkages in NS2
OTcl and C++ linkages in NS2OTcl and C++ linkages in NS2
OTcl and C++ linkages in NS2Pradeep Kumar TS
 
Wired and Wireless Examples in ns2
Wired and Wireless Examples in ns2Wired and Wireless Examples in ns2
Wired and Wireless Examples in ns2Pradeep Kumar TS
 
Software Defined Networking - 1
Software Defined Networking - 1Software Defined Networking - 1
Software Defined Networking - 1Pradeep Kumar TS
 
Software Defined Networking - 2
Software Defined Networking - 2Software Defined Networking - 2
Software Defined Networking - 2Pradeep Kumar TS
 
Software Defined Networking - 3
Software Defined Networking - 3Software Defined Networking - 3
Software Defined Networking - 3Pradeep Kumar TS
 

Plus de 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
 

Dernier

Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxmarlenawright1
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentationcamerronhm
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...Nguyen Thanh Tu Collection
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024Elizabeth Walsh
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxUmeshTimilsina1
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsKarakKing
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxannathomasp01
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17Celine George
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...Amil baba
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfDr Vijay Vishwakarma
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxPooja Bhuva
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxDr. Sarita Anand
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - Englishneillewis46
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 

Dernier (20)

Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptx
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 

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 }