0% found this document useful (0 votes)
64 views39 pages

What Is Interprocess Communication?

Uploaded by

sumitbhadane22
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
64 views39 pages

What Is Interprocess Communication?

Uploaded by

sumitbhadane22
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 39

SYSTEM

What is interprocess communication?


Interprocess communication (IPC) is a process that allows
different processes of a computer system to share
information.

IPC lets different programs run in parallel, share data, and


communicate with each other.
🞆It’s important for two reasons:

🞆First, it speeds up the execution of tasks, and

🞆secondly, it ensures that the tasks run correctly and in the order
that they were executed.
WHY INTERPROCESS COMMUNICATION IS NECESSARY

🞆IPC lets different programs run in parallel, share data, and


communicate with each other.

🞆It’s important for two reasons:

🞆It speeds up the execution of tasks.

🞆It ensures that the tasks run correctly and in the order that they
were executed.

🞆IPC is essential for the efficient operation of an operating system.


🞆Operating systems use IPC to exchange data with tools and
components that the system uses to interact with the user, such as
the keyboard, the mouse, and the graphical user interface (GUI).

🞆IPC also lets the system run multiple programs at the same time.

🞆 For example, the system might use IPC to provide information to


the windowing system about the status of a window on the screen.
COMPARISON WITH A REAL-LIFE EXAMPLE

🞆When you are using a team-based system, it is necessary to


communicate with all the teams in the company.

🞆Some of them are the Business Objects team, the product sales
team, and others are the technical teams.

🞆Communication between them will speed up the work and overall


efficiency will also increase.

🞆So, in the same way, an operating system allows a particular


program to handle several user requests simultaneously.

🞆 And overall efficiency will increase.


ADVANTAGES OF INTERPROCESS COMMUNICATION

🞆 Interprocess communication allows one application to manage another and


enables glitch-free data sharing.

🞆 Interprocess communication helps send messages efficiently between


processes.

🞆 The program is easy to maintain and debug because it is divided into


different sections of code that work separately.

🞆 Programmers can perform a variety of other tasks at the same time,


including Editing, listening to music, compiling, etc.

🞆 Data can be shared between different programs at the same time.

🞆 Tasks can be subdivided and run on special types of processors. You can
DISADVANTAGES OF INTERPROCESS COMMUNICATION

🞆The program cannot write to similar locations.

🞆Processes or programs that use the shared memory model must


make sure that they are not writing to similar memory locations.

🞆The shared storage model can cause problems such as storage


synchronization and protection that need to be addressed.

🞆It’s slower than a direct function call.


HOW DOES IPC WORK IN COMPUTER SYSTEMS?

🞆IPC occurs when an application sends a message to an operating


system process.

🞆The operating system sends the message to a designated IPC


mechanism, which handles the message and sends a response back
to the application.

🞆IPC mechanisms can be found in the kernel or the user space of an


operating system.
🞆IPC is an essential process in the operation of computer
systems.

🞆It enables different programs to run in parallel, share data, and


communicate with each other.

🞆IPC is important for the efficient operation of an operating


system and ensures that the tasks run correctly and in the order
that they were executed.
HOW TO DO INTERPROCESS COMMUNICATION OR WAYS OF IPC

🞆 1. Message passing

🞆 Another important way that inter-process communication takes place with other
processes is via message passing.

🞆 When two or more processes participate in inter-process communication, each process


sends messages to the others via Kernel.

🞆 Here is an example of sending messages between two processes: –

🞆 Here, the process sends a message like “M” to the OS kernel.

🞆 This message is then read by Process B.

🞆 A communication link is required between the two processes for successful message
exchange.

🞆 There are several ways to create these links.


🞆2. Shared memory

🞆Shared memory is a memory shared between all processes by two


or more processes established using shared memory.

🞆This type of memory should protect each other by synchronizing


access between all processes.

🞆Both processes like A and B can set up a shared memory segment


and exchange data through this shared memory area.
🞆Shared memory is important for these reasons-

🞆It is a way of passing data between processes.

🞆Shared memory is much faster than these methods and is


also more reliable.

🞆Shared memory allows two or more processes to share


the same copy of the data.
🞆Suppose process A wants to communicate to process B, and needs
to attach its address space to this shared memory segment.

🞆Process A will write a message to the shared memory and Process


B will read that message from the shared memory.

🞆 So processes are responsible for ensuring synchronization so that


both processes do not write to the same location at the same time.
B
🞆3. Pipes

🞆Pipes are a type of data channel commonly used for one-way


communication between two processes.

🞆Because this is a half-duplex technique, the primary process


communicates with the secondary process.

🞆However, additional lines are required to achieve a full duplex.


🞆The two pipes create a bidirectional data channel between the two
processes.

🞆But one pipe creates a unidirectional data channel.

🞆Pipes are primarily used on Windows operating systems.

🞆Like in the diagram it is shown that one process will send a


message to the pipe.

🞆The message will be retrieved and another process will write it to


the standard output.
🞆4. Signal

🞆The signal is a facility that allows processes to communicate with


each other.

🞆A signal is a way of telling a process that it needs to do something.

🞆 A process can send a signal to another process.

🞆A signal also allows a process to interrupt another process.

🞆 A signal is a way of communicating between processes.


THREADS IN OPERATING SYSTEM

🞆A thread is a single sequential flow of execution of tasks of a process


so it is also known as thread of execution or thread of control.

🞆There is a way of thread execution inside the process of any


operating system.

🞆Apart from this, there can be more than one thread inside a process.

🞆Each thread of the same process makes use of a separate program


counter and a stack of activation records and control blocks.

🞆Thread is often referred to as a lightweight process.


🞆The process can be split down into so many threads.

🞆 For example, in a browser, many tabs can be viewed as


threads.

🞆MS Word uses many threads - formatting text from one


thread, processing input from another thread, etc.
STRUCTURE OF THREADS
🞆Need of Thread:

🞆It takes far less time to create a new thread in an existing process
than to create a new process.

🞆Threads can share the common data, they do not need to use Inter-
Process communication.

🞆Context switching is faster when working with threads.

🞆It takes less time to terminate a thread than a process.


🞆Types of Threads

🞆In the operating system there are two types of threads.

🞆1. Kernel level thread.

🞆2. User-level thread.


🞆 User-level thread

🞆 The operating system does not recognize the user-level thread.

🞆 User threads can be easily implemented and it is implemented by the user.

🞆 If a user performs a user-level thread blocking operation, the whole


process is blocked.

🞆 The kernel level thread does not know nothing about the user level thread.

🞆 The kernel-level thread manages user-level threads as if they are single-


threaded processes?

🞆 examples: Java thread, POSIX threads, etc.


🞆Advantages of User-level threads

🞆The user threads can be easily implemented than the kernel


thread.

🞆User-level threads can be applied to such types of operating


systems that do not support threads at the kernel-level.

🞆It is faster and efficient.

🞆Context switch time is shorter than the kernel-level threads.

🞆It does not require modifications of the operating system.


🞆Disadvantages of User-level threads

🞆User-level threads lack coordination between the thread


and the kernel.

🞆If a thread causes a page fault, the entire process is


blocked.
🞆Kernel level thread

🞆The kernel thread recognizes the operating system.

🞆There is a thread control block and process control block in the


system for each thread and process in the kernel-level thread.

🞆The kernel-level thread is implemented by the operating system.

🞆The kernel knows about all the threads and manages them.
🞆The kernel-level thread offers a system call to create and
manage the threads from user-space.

🞆 The implementation of kernel threads is more difficult than the


user thread.

🞆Context switch time is longer in the kernel thread.

🞆If a kernel thread performs a blocking operation, the Banky


thread execution can continue.

🞆Example: Window Solaris.


🞆Advantages of Kernel-level threads

🞆The kernel-level thread is fully aware of all threads.

🞆The scheduler may decide to spend more CPU time in the


process of threads being large numerical.

🞆The kernel-level thread is good for those applications that


block the frequency.
🞆Disadvantages of Kernel-level threads

🞆The kernel thread manages and schedules all threads.

🞆The implementation of kernel threads is difficult than the user


thread.

🞆The kernel-level thread is slower than user-level threads.


🞆Components of Threads

🞆Any thread has the following components.

🞆Program counter

🞆Register set

🞆Stack space
🞆 Benefits of Threads

🞆 Enhanced throughput of the system:

🞆 When the process is split into many threads, and each thread is treated as a
job, the number of jobs done in the unit time increases. That is why the
throughput of the system also increases.

🞆 Effective Utilization of Multiprocessor system:


When you have more than one thread in one process, you can schedule more
than one thread in more than one processor.

🞆 Faster context switch:

🞆 The context switching period between threads is less than the process
context switching. The process context switch means more overhead for the
🞆Responsiveness: When the process is split into several threads,
and when a thread completes its execution, that process can be
responded to as soon as possible.

🞆Communication: Multiple-thread communication is simple


because the threads share the same address space, while in
process, we adopt just a few exclusive communication
strategies for communication between two processes.

🞆Resource sharing: Resources can be shared between all


threads within a process, such as code, data, and files.

🞆Note: The stack and register cannot be shared between threads.


There is a stack and register for each thread.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy