SlideShare una empresa de Scribd logo
1 de 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
}

Más contenido relacionado

La actualidad más candente

8 memory management strategies
8 memory management strategies8 memory management strategies
8 memory management strategiesDr. Loganathan R
 
Introduction to Unix operating system Chapter 1-PPT Mrs.Sowmya Jyothi
Introduction to Unix operating system Chapter 1-PPT Mrs.Sowmya JyothiIntroduction to Unix operating system Chapter 1-PPT Mrs.Sowmya Jyothi
Introduction to Unix operating system Chapter 1-PPT Mrs.Sowmya JyothiSowmya Jyothi
 
Memory organization in computer architecture
Memory organization in computer architectureMemory organization in computer architecture
Memory organization in computer architectureFaisal Hussain
 
Cpu scheduling in operating System.
Cpu scheduling in operating System.Cpu scheduling in operating System.
Cpu scheduling in operating System.Ravi Kumar Patel
 
OPERATING SYSTEM SERVICES, OPERATING SYSTEM STRUCTURES
OPERATING SYSTEM SERVICES, OPERATING SYSTEM STRUCTURESOPERATING SYSTEM SERVICES, OPERATING SYSTEM STRUCTURES
OPERATING SYSTEM SERVICES, OPERATING SYSTEM STRUCTURESpriyasoundar
 
file system in operating system
file system in operating systemfile system in operating system
file system in operating systemtittuajay
 
Process concept
Process conceptProcess concept
Process conceptjangezkhan
 
Process management in linux
Process management in linuxProcess management in linux
Process management in linuxMazenetsolution
 
Memory management ppt
Memory management pptMemory management ppt
Memory management pptManishaJha43
 
Contiguous Memory Allocation.ppt
Contiguous Memory Allocation.pptContiguous Memory Allocation.ppt
Contiguous Memory Allocation.pptinfomerlin
 
DeadLock in Operating-Systems
DeadLock in Operating-SystemsDeadLock in Operating-Systems
DeadLock in Operating-SystemsVenkata Sreeram
 
Operating systems system structures
Operating systems   system structuresOperating systems   system structures
Operating systems system structuresMukesh Chinta
 
Memory organization (Computer architecture)
Memory organization (Computer architecture)Memory organization (Computer architecture)
Memory organization (Computer architecture)Sandesh Jonchhe
 
Process in operating system
Process in operating systemProcess in operating system
Process in operating systemChetan Mahawar
 

La actualidad más candente (20)

Memory management
Memory managementMemory management
Memory management
 
8 memory management strategies
8 memory management strategies8 memory management strategies
8 memory management strategies
 
process control block
process control blockprocess control block
process control block
 
Introduction to Unix operating system Chapter 1-PPT Mrs.Sowmya Jyothi
Introduction to Unix operating system Chapter 1-PPT Mrs.Sowmya JyothiIntroduction to Unix operating system Chapter 1-PPT Mrs.Sowmya Jyothi
Introduction to Unix operating system Chapter 1-PPT Mrs.Sowmya Jyothi
 
Process of operating system
Process of operating systemProcess of operating system
Process of operating system
 
Memory organization in computer architecture
Memory organization in computer architectureMemory organization in computer architecture
Memory organization in computer architecture
 
memory hierarchy
memory hierarchymemory hierarchy
memory hierarchy
 
Cpu scheduling in operating System.
Cpu scheduling in operating System.Cpu scheduling in operating System.
Cpu scheduling in operating System.
 
OPERATING SYSTEM SERVICES, OPERATING SYSTEM STRUCTURES
OPERATING SYSTEM SERVICES, OPERATING SYSTEM STRUCTURESOPERATING SYSTEM SERVICES, OPERATING SYSTEM STRUCTURES
OPERATING SYSTEM SERVICES, OPERATING SYSTEM STRUCTURES
 
file system in operating system
file system in operating systemfile system in operating system
file system in operating system
 
Process concept
Process conceptProcess concept
Process concept
 
Memory Organization
Memory OrganizationMemory Organization
Memory Organization
 
Os Threads
Os ThreadsOs Threads
Os Threads
 
Process management in linux
Process management in linuxProcess management in linux
Process management in linux
 
Memory management ppt
Memory management pptMemory management ppt
Memory management ppt
 
Contiguous Memory Allocation.ppt
Contiguous Memory Allocation.pptContiguous Memory Allocation.ppt
Contiguous Memory Allocation.ppt
 
DeadLock in Operating-Systems
DeadLock in Operating-SystemsDeadLock in Operating-Systems
DeadLock in Operating-Systems
 
Operating systems system structures
Operating systems   system structuresOperating systems   system structures
Operating systems system structures
 
Memory organization (Computer architecture)
Memory organization (Computer architecture)Memory organization (Computer architecture)
Memory organization (Computer architecture)
 
Process in operating system
Process in operating systemProcess in operating system
Process in operating system
 

Destacado

Destacado (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
 

Similar a 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
 

Similar a 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
 

Más 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
 

Más 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
 

Último

THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxChelloAnnAsuncion2
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxAshokKarra1
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYKayeClaireEstoconing
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfSpandanaRallapalli
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxDr.Ibrahim Hassaan
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxMaryGraceBautista27
 

Último (20)

THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptx
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdf
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptx
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptx
 

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 }