SlideShare a Scribd company logo
1 of 16
Operations on
Processes and
Cooperating
Processes
-Vishnu Vijay Menon, S3 BCA
Operations On Processes
Processes- as we know is an activity/ program under execution.
Execution of a process is a complex activity.
In modern day systems, processes are executed concurrently.
Therefore, it is the duty of an operating system to provide a flexible
mechanism for dynamically creating, maintaining anddeleting processes
in a computer system.
Operations performed while executing a process
Creation
Process Creation
Process creation is deemed to be the first step of any process execution
activity. In simpler terms, it can be put as the construction of new processes
for execution.
There are four events that leads to the creation of a “new” process:-
1. System Initialisation.
2. Execution of a process creation system call by a running process.
3. User request to create a new process.
4. Initialization of a batch job.
-A new process is created using the system call “fork()”
system call on UNIX systems [ CreateProcess() on
Windows-based systems}. The one which initiates this
call is termed as “Parent Process”; the one derived from
it is termed as “Child Process”.
-After the creation of a new process, the OS assigns a new
Process identifier , an integer value to identify a process,
which creates a new entry on the primary table.
- Then, the required memory for all elements of a process
such as program,data etc is allocated on Process Control
Block. A thing to note is that depending the
implementation of a system, some resources/data may
be shared between a child and it’s parent process. In the
beginning, not much is allocated to a process because a
user has to request to do so but it’s child may inherit
some resource from its parent.
Diagram of Creating a process using fork()
Parent
Process
After a child process is created, there are two options
for the parent process:
● Wait for the child process to terminate before
proceeding. The parent makes a wait() call. This
is more common with UNIX based systems.
● Run concurrently with the child. A scenario where
a parent process executes for a while and then
pauses, for the child process to execute, is also
possible
Process Termination
All created processes have to be terminated at some point of their cycle.
This is when a process is no longer needed for the program or some kind
of problems may have been encountered by the program.
A Process begins its termination when the final piece of the statement in
a program is executed.
Types of Process Termination
Normal Termination:- It is a type of voluntary termination, where the process
quits after it has executed the final statement. The process may return a status
value ( typically an integer) to the parent. The shared resources are also de-
allocated by the OS.
Abnormal Termination:- This type of termination occurs mostly due to
programming errors,runtime errors, user intervention etc. There are three
categories under this type of termination.
1. Error Exit: A voluntary type termination which occurs due to program bugs(
like trying to execute an illegal statement, referencing non existing memory
etc.) In some cases in UNIX systems, the process requests the OS itself to
rectify its own mistake, therefore only interrupting instead of terminating
them.
2. Fatal Errors: It is an involuntary execution, in
which there are problems in the code or a non
existent file.
3. Killed by another process:- The Process may
be terminated under the instruction of another
process. This is invoked by an appropriate
system call
A Parent may also terminate its Child when:-
1. The task given to the Child is not needed anymore.
2. The Child exceeds the usage of resources allocated
to it.
3. The Parent is exiting, resulting in the termination of
the Child.
Note: If the child is unable to be terminated since
their Parent isn’t waiting, they will be returned to init and
eventually be killed off.
Cooperating Processes
There are many Processes which may be independent or cooperates with other
processes in a program. As the name suggests, Independent Processes do not
share any data and is not affected by any other process in any way. On the
other hand, Cooperating processes may be affected by the other process in the
system.
A cooperating process is one that can affect or be affected by other process
executing in the system cooperating process can:
1. Directly share a logical address data space (i.e. code & data) - This
may result in data inconsistency. It is implemented on threads.
2. Share data only through files/ messages - It only deals with orderly
execution of cooperating process so that data consistency is maintained.
Reasons that allow Process Cooperation
1. Information Sharing: There may arise a scenario where every user wants the
same piece of information. Thus, it allows concurrent access to all the data
for everyone.
2. Computation Speedup: A Process is expected to execute efficiently. So we
breakup these processes into smaller sub tasks, where they will be
parallely executing with one another.
3. Modularity: Modular systems refers to a system that divides its functions
into separate processes.
4. Convenience: It enables the user to perform some tasks and run some
programs at the same time.
Methods of Cooperation
There are two ways:
a) Cooperation by Sharing:- Processes can cooperate with each other by
sharing data,memory,files,databases.
Here, P1 and P2 share memory,variables,files,databases etc.
b) Cooperation by communication:- This method is
generally tricky to execute. The processes in this
method communicate through passage of messages.
It may lead to a deadlock, if each process is waiting
for a message. If it never receives, it may lead to
starvation.
In the diagram given, the processes
communicate through messages.
Thank You !!

More Related Content

What's hot

Deadlock in Distributed Systems
Deadlock in Distributed SystemsDeadlock in Distributed Systems
Deadlock in Distributed SystemsPritom Saha Akash
 
CS9222 ADVANCED OPERATING SYSTEMS
CS9222 ADVANCED OPERATING SYSTEMSCS9222 ADVANCED OPERATING SYSTEMS
CS9222 ADVANCED OPERATING SYSTEMSKathirvel Ayyaswamy
 
MULTILEVEL QUEUE SCHEDULING
MULTILEVEL QUEUE SCHEDULINGMULTILEVEL QUEUE SCHEDULING
MULTILEVEL QUEUE SCHEDULINGgarishma bhatia
 
physical file system in operating system
physical file system in operating systemphysical file system in operating system
physical file system in operating systemtittuajay
 
Paging and Segmentation in Operating System
Paging and Segmentation in Operating SystemPaging and Segmentation in Operating System
Paging and Segmentation in Operating SystemRaj Mohan
 
File System Interface
File System InterfaceFile System Interface
File System Interfacechandinisanz
 
INTER PROCESS COMMUNICATION (IPC).pptx
INTER PROCESS COMMUNICATION (IPC).pptxINTER PROCESS COMMUNICATION (IPC).pptx
INTER PROCESS COMMUNICATION (IPC).pptxLECO9
 
Process in operating system
Process in operating systemProcess in operating system
Process in operating systemChetan Mahawar
 
Group Communication (Distributed computing)
Group Communication (Distributed computing)Group Communication (Distributed computing)
Group Communication (Distributed computing)Sri Prasanna
 
clock synchronization in Distributed System
clock synchronization in Distributed System clock synchronization in Distributed System
clock synchronization in Distributed System Harshita Ved
 
Process synchronization in Operating Systems
Process synchronization in Operating SystemsProcess synchronization in Operating Systems
Process synchronization in Operating SystemsRitu Ranjan Shrivastwa
 
Memory management
Memory managementMemory management
Memory managementcpjcollege
 

What's hot (20)

Demand paging
Demand pagingDemand paging
Demand paging
 
Deadlock in Distributed Systems
Deadlock in Distributed SystemsDeadlock in Distributed Systems
Deadlock in Distributed Systems
 
CS9222 ADVANCED OPERATING SYSTEMS
CS9222 ADVANCED OPERATING SYSTEMSCS9222 ADVANCED OPERATING SYSTEMS
CS9222 ADVANCED OPERATING SYSTEMS
 
MULTILEVEL QUEUE SCHEDULING
MULTILEVEL QUEUE SCHEDULINGMULTILEVEL QUEUE SCHEDULING
MULTILEVEL QUEUE SCHEDULING
 
physical file system in operating system
physical file system in operating systemphysical file system in operating system
physical file system in operating system
 
Paging and Segmentation in Operating System
Paging and Segmentation in Operating SystemPaging and Segmentation in Operating System
Paging and Segmentation in Operating System
 
Concurrency
ConcurrencyConcurrency
Concurrency
 
File System Interface
File System InterfaceFile System Interface
File System Interface
 
INTER PROCESS COMMUNICATION (IPC).pptx
INTER PROCESS COMMUNICATION (IPC).pptxINTER PROCESS COMMUNICATION (IPC).pptx
INTER PROCESS COMMUNICATION (IPC).pptx
 
Buffering.pptx
Buffering.pptxBuffering.pptx
Buffering.pptx
 
Process in operating system
Process in operating systemProcess in operating system
Process in operating system
 
Group Communication (Distributed computing)
Group Communication (Distributed computing)Group Communication (Distributed computing)
Group Communication (Distributed computing)
 
clock synchronization in Distributed System
clock synchronization in Distributed System clock synchronization in Distributed System
clock synchronization in Distributed System
 
Chapter 13
Chapter 13Chapter 13
Chapter 13
 
Process synchronization in Operating Systems
Process synchronization in Operating SystemsProcess synchronization in Operating Systems
Process synchronization in Operating Systems
 
Process state in OS
Process state in OSProcess state in OS
Process state in OS
 
Operating system critical section
Operating system   critical sectionOperating system   critical section
Operating system critical section
 
Concurrency control
Concurrency controlConcurrency control
Concurrency control
 
Fault tolerance
Fault toleranceFault tolerance
Fault tolerance
 
Memory management
Memory managementMemory management
Memory management
 

Similar to Operations on Processes and Cooperating processes

operating system for computer engineering ch3.ppt
operating system for computer engineering ch3.pptoperating system for computer engineering ch3.ppt
operating system for computer engineering ch3.pptgezaegebre1
 
Chapter two process.pptx
Chapter two process.pptxChapter two process.pptx
Chapter two process.pptxMezigebuMelese1
 
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
 
Unit 2 part 2(Process)
Unit 2 part 2(Process)Unit 2 part 2(Process)
Unit 2 part 2(Process)WajeehaBaig
 
Advanced computer architecture lesson 1 and 2
Advanced computer architecture lesson 1 and 2Advanced computer architecture lesson 1 and 2
Advanced computer architecture lesson 1 and 2Ismail Mukiibi
 
Operating System Lecture Notes
Operating System Lecture NotesOperating System Lecture Notes
Operating System Lecture NotesFellowBuddy.com
 
Lecture_3-Process Management.pdf
Lecture_3-Process Management.pdfLecture_3-Process Management.pdf
Lecture_3-Process Management.pdfHarika Pudugosula
 
Producer Consumer Problem in C explained.ppt
Producer Consumer Problem in C explained.pptProducer Consumer Problem in C explained.ppt
Producer Consumer Problem in C explained.pptossama8
 
Operating system
Operating systemOperating system
Operating systemMark Muhama
 
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
 

Similar to Operations on Processes and Cooperating processes (20)

Process and threads
Process and threadsProcess and threads
Process and threads
 
operating system for computer engineering ch3.ppt
operating system for computer engineering ch3.pptoperating system for computer engineering ch3.ppt
operating system for computer engineering ch3.ppt
 
Chapter two process.pptx
Chapter two process.pptxChapter two process.pptx
Chapter two process.pptx
 
Operating Systems
Operating Systems Operating Systems
Operating Systems
 
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
 
Unit 2 part 2(Process)
Unit 2 part 2(Process)Unit 2 part 2(Process)
Unit 2 part 2(Process)
 
Advanced computer architecture lesson 1 and 2
Advanced computer architecture lesson 1 and 2Advanced computer architecture lesson 1 and 2
Advanced computer architecture lesson 1 and 2
 
Operating System Lecture Notes
Operating System Lecture NotesOperating System Lecture Notes
Operating System Lecture Notes
 
Lecture_3-Process Management.pdf
Lecture_3-Process Management.pdfLecture_3-Process Management.pdf
Lecture_3-Process Management.pdf
 
Chapter 3.pdf
Chapter 3.pdfChapter 3.pdf
Chapter 3.pdf
 
Ch4
Ch4Ch4
Ch4
 
Producer Consumer Problem in C explained.ppt
Producer Consumer Problem in C explained.pptProducer Consumer Problem in C explained.ppt
Producer Consumer Problem in C explained.ppt
 
Operating system
Operating systemOperating system
Operating system
 
Chapter 5
Chapter 5Chapter 5
Chapter 5
 
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
 
Os unit 1
Os unit 1Os unit 1
Os unit 1
 
Operating system
Operating systemOperating system
Operating system
 
CH03.pdf
CH03.pdfCH03.pdf
CH03.pdf
 
Ch03- PROCESSES.ppt
Ch03- PROCESSES.pptCh03- PROCESSES.ppt
Ch03- PROCESSES.ppt
 
Process Management
Process ManagementProcess Management
Process Management
 

Recently uploaded

Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Hyundai Motor Group
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 

Recently uploaded (20)

Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 

Operations on Processes and Cooperating processes

  • 2. Operations On Processes Processes- as we know is an activity/ program under execution. Execution of a process is a complex activity. In modern day systems, processes are executed concurrently. Therefore, it is the duty of an operating system to provide a flexible mechanism for dynamically creating, maintaining anddeleting processes in a computer system.
  • 3. Operations performed while executing a process Creation
  • 4. Process Creation Process creation is deemed to be the first step of any process execution activity. In simpler terms, it can be put as the construction of new processes for execution. There are four events that leads to the creation of a “new” process:- 1. System Initialisation. 2. Execution of a process creation system call by a running process. 3. User request to create a new process. 4. Initialization of a batch job.
  • 5. -A new process is created using the system call “fork()” system call on UNIX systems [ CreateProcess() on Windows-based systems}. The one which initiates this call is termed as “Parent Process”; the one derived from it is termed as “Child Process”. -After the creation of a new process, the OS assigns a new Process identifier , an integer value to identify a process, which creates a new entry on the primary table. - Then, the required memory for all elements of a process such as program,data etc is allocated on Process Control Block. A thing to note is that depending the implementation of a system, some resources/data may be shared between a child and it’s parent process. In the beginning, not much is allocated to a process because a user has to request to do so but it’s child may inherit some resource from its parent.
  • 6. Diagram of Creating a process using fork() Parent Process
  • 7. After a child process is created, there are two options for the parent process: ● Wait for the child process to terminate before proceeding. The parent makes a wait() call. This is more common with UNIX based systems. ● Run concurrently with the child. A scenario where a parent process executes for a while and then pauses, for the child process to execute, is also possible
  • 8. Process Termination All created processes have to be terminated at some point of their cycle. This is when a process is no longer needed for the program or some kind of problems may have been encountered by the program. A Process begins its termination when the final piece of the statement in a program is executed.
  • 9. Types of Process Termination Normal Termination:- It is a type of voluntary termination, where the process quits after it has executed the final statement. The process may return a status value ( typically an integer) to the parent. The shared resources are also de- allocated by the OS. Abnormal Termination:- This type of termination occurs mostly due to programming errors,runtime errors, user intervention etc. There are three categories under this type of termination. 1. Error Exit: A voluntary type termination which occurs due to program bugs( like trying to execute an illegal statement, referencing non existing memory etc.) In some cases in UNIX systems, the process requests the OS itself to rectify its own mistake, therefore only interrupting instead of terminating them.
  • 10. 2. Fatal Errors: It is an involuntary execution, in which there are problems in the code or a non existent file. 3. Killed by another process:- The Process may be terminated under the instruction of another process. This is invoked by an appropriate system call
  • 11. A Parent may also terminate its Child when:- 1. The task given to the Child is not needed anymore. 2. The Child exceeds the usage of resources allocated to it. 3. The Parent is exiting, resulting in the termination of the Child. Note: If the child is unable to be terminated since their Parent isn’t waiting, they will be returned to init and eventually be killed off.
  • 12. Cooperating Processes There are many Processes which may be independent or cooperates with other processes in a program. As the name suggests, Independent Processes do not share any data and is not affected by any other process in any way. On the other hand, Cooperating processes may be affected by the other process in the system. A cooperating process is one that can affect or be affected by other process executing in the system cooperating process can: 1. Directly share a logical address data space (i.e. code & data) - This may result in data inconsistency. It is implemented on threads. 2. Share data only through files/ messages - It only deals with orderly execution of cooperating process so that data consistency is maintained.
  • 13. Reasons that allow Process Cooperation 1. Information Sharing: There may arise a scenario where every user wants the same piece of information. Thus, it allows concurrent access to all the data for everyone. 2. Computation Speedup: A Process is expected to execute efficiently. So we breakup these processes into smaller sub tasks, where they will be parallely executing with one another. 3. Modularity: Modular systems refers to a system that divides its functions into separate processes. 4. Convenience: It enables the user to perform some tasks and run some programs at the same time.
  • 14. Methods of Cooperation There are two ways: a) Cooperation by Sharing:- Processes can cooperate with each other by sharing data,memory,files,databases. Here, P1 and P2 share memory,variables,files,databases etc.
  • 15. b) Cooperation by communication:- This method is generally tricky to execute. The processes in this method communicate through passage of messages. It may lead to a deadlock, if each process is waiting for a message. If it never receives, it may lead to starvation. In the diagram given, the processes communicate through messages.

Editor's Notes

  1. Critical section…...