SlideShare une entreprise Scribd logo
1  sur  31
Interprocess Communication(IPC)
Interprocess Communication
• Processes within a system may be independent or cooperating!
• Cooperating process can affect or be affected by other processes,
including sharing data.
• Reasons for cooperating processes:
• Information sharing
• Computation speedup
• Modularity
• Convenience
• Cooperating processes need interprocess communication(IPC)
• Two models of IPC:
• Shared memory
• Message passing
Communications Models
Cooperating Processes
• Independent process cannot affect or be affected by the execution of
another process
• Cooperating process can affect or be affected by the execution of
another process
• Advantages of process cooperation:
• Information sharing
• Computation speed-up
• Modularity
• Convenience
Interprocess Communication – Message Passing
• Mechanism for processes to communicate and to synchronize their actions
• Message system – processes communicate with each other without
resorting to shared variables
• IPC facility provides two operations:
• send(message) – message size fixed or variable
• receive(message)
• If P and Q wish to communicate, they need to:
• establish a communication link between them
• exchange messages via send/receive
• Implementation of communication link
• physical (e.g., shared memory, hardware bus)
• logical (e.g., logical properties)
Direct Communication
• Processes must name each other explicitly:
• send (P, message) – send a message to process P
• receive(Q, message) – receive a message from process Q
• Properties of communication link
• Links are established automatically
• A link is associated with exactly one pair of communicating processes
• Between each pair there exists exactly one link
• The link may be unidirectional, but is usually bi-directional
Indirect Communication
• Messages are directed and received from mailboxes (also referred to
as ports)
• Each mailbox has a unique id
• Processes can communicate only if they share a mailbox
• Properties of communication link
• Link established only if processes share a common mailbox
• A link may be associated with many processes
• Each pair of processes may share several communication links
• Link may be unidirectional or bi-directional
Indirect Communication
• Operations
• create a new mailbox
• send and receive messages through mailbox
• destroy a mailbox
• Primitives are defined as:
• send(A, message) – send a message to mailbox A
• receive(A, message) – receive a message from mailbox A
Indirect Communication
• Mailbox sharing
• P1, P2, and P3 share mailbox A
• P1, sends; P2 and P3 receive
• Who gets the message?
• Solutions:
• Allow a link to be associated with at most two processes
• Allow only one process at a time to execute a receive operation
• Allow the system to select arbitrarily the receiver. Sender is notified who the
receiver was.
Synchronization
• Message passing may be either blocking or non-blocking
• Blocking is considered synchronous!
• Blocking send has the sender block until the message is received
• Blocking receive has the receiver block until a message is available
• Non-blocking is considered asynchronous!
• Non-blocking send has the sender send the message and continue
• Non-blocking receive has the receiver receive a valid message or null"
Buffering
• Queue of messages attached to the link; implemented in one of
three ways
1. Zero capacity – 0 messages
Sender must wait for receiver (rendezvous)
2. Bounded capacity – finite length of n messages
Sender must wait if link full"
3. Unbounded capacity – infinite length
• Sender never waits
Examples of IPC Systems - POSIX
• POSIX Shared Memory
• Process first creates shared memory segment
segment id = shmget(IPC PRIVATE, size, SIRUSR | SIWUSR);
• Process wanting access to that shared memory must attach to it"
• shared memory = (char *) shmat(id, NULL, 0);
• Now the process could write to the shared memory"
• sprintf(shared memory, "Writing to shared memory");
• When done a process can detach the shared memory from its address
space
• shmdt(shared memory);
Examples of IPC Systems – Windows XP
• Message-passing centric via local procedure call (LPC) facility
• Only works between processes on the same system"
• Uses ports (like mailboxes) to establish and maintain communication channels
• Communication works as follows:
• The client opens a handle to the subsystem’s connection port object
• The client sends a connection request
• The server creates two private communication ports and returns the handle to one
of them to the client
• The client and server use the corresponding port handle to send messages or
callbacks and to listen for replies
Local Procedure Calls in Windows XP
Signal
• Signal is an IPC used for signaling from a process A to OS to enable start of
another process B.
• Signal is a one or two byte IPC from a process to the OS.
• Signal provides the shortest communication.
• The signal ( ) sends a one-bit output for a process, which unmasks a signal mask
of a process or task (called signal handler)
• The handler has coding similar to ones in an ISR runs in a way similar to a
highest priority ISR.
• An ISR runs on an hardware interrupt provided that interrupt is no masked. The
signal handler also runs on signal provided that signal is no masked.
• When the IPC functions for signal are not provided by an OS, then the OS
employs semaphore for the same purpose.
Signal function
Signal function
• Task i sending signal s to initiate signal handler ISR j
PIPE
• Pipes are a data transfer, byte stream IPC facility that connect processes;
the byte stream written to one end of the pipe can be read from the other.
• once created, pipes are referenced by file descriptor handles
#include <unistd.h>
int pipe(int filedes[2]);
• filedes[0] is open for reading (read-end),
• filedes[1] is open for writing (write-end)
• The output of filedes[1] is the input of filedes[0]
• pipes are half-duplex
Pipes — intuition
• every read from a pipe copy from kernel space to user space
• every write to a pipe copy from user space to kernel space
Semaphores
• A semaphore is a protected variable whose value can be accessed and altered only by
the operations P(wait)and V(signal)and initialization operation.
• wait() was called P (for Dutch “Proberen” meaning to test) and signal() was
called V (for Dutch “Verhogen” meaning to increment).
• Types of Semaphore:
1. Binary Semaphore
• Binary semaphores have 2 methods associated with it. (lock, unlock)
• Binary semaphores can take only 2 values (0/1). They are used to acquire locks. When a
resource is available, the process in charge set the semaphore to 1 else 0.
Semaphores
2. Counting semaphores
• Counting Semaphore may have value to be greater than one, typically used to allocate
resources from a pool of identical resources
3.Mutex Semaphore
• A mutual exclusion (mutex) semaphore is a special binary semaphore that supports
ownership, recursive access, task deletion safety.
• Is a key to a toilet. One person can have the key - occupy the toilet - at the time. When
finished, the person gives (frees) the key to the next person in the queue.
Semaphores: Access
• wait: If the value of semaphore variable is not negative, decrements it
by 1. If the semaphore variable is now negative, the process
executing wait is blocked (i.e., added to the semaphore's queue) until
the value is greater or equal to 1. Otherwise, the process continues
execution, having used a unit of the resource.
• signal: Increments the value of semaphore variable by 1. After the
increment, if the pre-increment value was negative (meaning there
are processes waiting for a resource), it transfers a blocked process
from the semaphore's waiting queue to the ready queue.
Semaphores: Access
wait (semaphore s)
{
while(s==0); //wait until s>0;
s=s-1;
}
signal (semaphore s)
{
s=s+1;
}
Sockets
• A socket is defined as an endpoint for communication
• Concatenation of IP address and port
• The socket 161.25.19.8:1625 refers to port 1625 on host 161.25.19.8
• Communication consists between a pair of sockets
Shared Memory
• Shared memory allows one or more processes to communicate via
memory that appears in all of their virtual address spaces.
Shared Memory with Mutex
• In this design pattern, task #1 and task #2 access shared memory
using a mutex for synchronization.
• Each task must first acquire the mutex before accessing the shared
memory. The task blocks if the mutex is already locked, indicating that
another task is accessing the shared memory. The task releases the
mutex after it completes its operation on the shared memory.
Message Queues
• Message queues allow one or more processes to write messages that will be read
by one or more reading processes.
Message Queues: Operation
• Kernel job to assign a unique ID to a message queue and to create its QCB and
task-waiting list. The kernel also takes developer-supplied parameters such as the
length of the queue and the maximum message length to determine how much
memory is required for the message queue. After the kernel has this information,
it allocates memory for the message queue from either a pool of system memory
or some private memory space.
• The message queue itself consists of a number of elements, each of which can
hold a single message. The elements holding the first and last messages are called
the head and tail respectively.
• a message queue has two associated task-waiting lists. The receiving task-waiting
list consists of tasks that wait on the queue when it is empty. The sending list
consists of tasks that wait on the queue when it is full. Empty and full message-
queue states, as well as other key concepts
Deadlock
• A deadlock is a situation in which two or more competing actions are
each waiting for the other to finish, and thus neither ever does.
Deadlock Characterization
Deadlock can arise if four conditions hold simultaneously :
• Mutual exclusion: only one process at a time can use a resource.
• Hold and wait: a process holding at least one resource is waiting to acquire
additional resources held by other processes.
• No preemption: a resource can be released only voluntarily by the process
holding it, after that process has completed its task.
• Circular wait: there exists a set {P0, P1, …, Pn} of waiting processes such that
P0 is waiting for a resource that is held by P1, P1 is waiting for a resource that
is held by P2, …, Pn–1 is waiting for a resource that is held by Pn, and Pn is
waiting for a resource that is held by P0

Contenu connexe

Tendances

Evaluation of morden computer & system attributes in ACA
Evaluation of morden computer &  system attributes in ACAEvaluation of morden computer &  system attributes in ACA
Evaluation of morden computer & system attributes in ACAPankaj Kumar Jain
 
Synchronization in distributed systems
Synchronization in distributed systems Synchronization in distributed systems
Synchronization in distributed systems SHATHAN
 
Inter-Process Communication in distributed systems
Inter-Process Communication in distributed systemsInter-Process Communication in distributed systems
Inter-Process Communication in distributed systemsAya Mahmoud
 
Interprocess communication
Interprocess communicationInterprocess communication
Interprocess communicationSushil Singh
 
Operating systems system structures
Operating systems   system structuresOperating systems   system structures
Operating systems system structuresMukesh Chinta
 
Remote Procedure Call in Distributed System
Remote Procedure Call in Distributed SystemRemote Procedure Call in Distributed System
Remote Procedure Call in Distributed SystemPoojaBele1
 
Clock synchronization in distributed system
Clock synchronization in distributed systemClock synchronization in distributed system
Clock synchronization in distributed systemSunita Sahu
 
Os Swapping, Paging, Segmentation and Virtual Memory
Os Swapping, Paging, Segmentation and Virtual MemoryOs Swapping, Paging, Segmentation and Virtual Memory
Os Swapping, Paging, Segmentation and Virtual Memorysgpraju
 
Operating system 24 mutex locks and semaphores
Operating system 24 mutex locks and semaphoresOperating system 24 mutex locks and semaphores
Operating system 24 mutex locks and semaphoresVaibhav Khanna
 
remote procedure calls
  remote procedure calls  remote procedure calls
remote procedure callsAshish Kumar
 
Consistency protocols
Consistency protocolsConsistency protocols
Consistency protocolsZongYing Lyu
 
CS9222 ADVANCED OPERATING SYSTEMS
CS9222 ADVANCED OPERATING SYSTEMSCS9222 ADVANCED OPERATING SYSTEMS
CS9222 ADVANCED OPERATING SYSTEMSKathirvel Ayyaswamy
 

Tendances (20)

Message passing in Distributed Computing Systems
Message passing in Distributed Computing SystemsMessage passing in Distributed Computing Systems
Message passing in Distributed Computing Systems
 
Evaluation of morden computer & system attributes in ACA
Evaluation of morden computer &  system attributes in ACAEvaluation of morden computer &  system attributes in ACA
Evaluation of morden computer & system attributes in ACA
 
Synchronization in distributed systems
Synchronization in distributed systems Synchronization in distributed systems
Synchronization in distributed systems
 
Inter-Process Communication in distributed systems
Inter-Process Communication in distributed systemsInter-Process Communication in distributed systems
Inter-Process Communication in distributed systems
 
message passing
 message passing message passing
message passing
 
Interprocess communication
Interprocess communicationInterprocess communication
Interprocess communication
 
11. dfs
11. dfs11. dfs
11. dfs
 
Lecture 3 threads
Lecture 3   threadsLecture 3   threads
Lecture 3 threads
 
Operating systems system structures
Operating systems   system structuresOperating systems   system structures
Operating systems system structures
 
Remote Procedure Call in Distributed System
Remote Procedure Call in Distributed SystemRemote Procedure Call in Distributed System
Remote Procedure Call in Distributed System
 
Clock synchronization in distributed system
Clock synchronization in distributed systemClock synchronization in distributed system
Clock synchronization in distributed system
 
Os Swapping, Paging, Segmentation and Virtual Memory
Os Swapping, Paging, Segmentation and Virtual MemoryOs Swapping, Paging, Segmentation and Virtual Memory
Os Swapping, Paging, Segmentation and Virtual Memory
 
Operating system 24 mutex locks and semaphores
Operating system 24 mutex locks and semaphoresOperating system 24 mutex locks and semaphores
Operating system 24 mutex locks and semaphores
 
Chapter 7 - Deadlocks
Chapter 7 - DeadlocksChapter 7 - Deadlocks
Chapter 7 - Deadlocks
 
remote procedure calls
  remote procedure calls  remote procedure calls
remote procedure calls
 
Scheduling algorithms
Scheduling algorithmsScheduling algorithms
Scheduling algorithms
 
Consistency protocols
Consistency protocolsConsistency protocols
Consistency protocols
 
Deadlock
DeadlockDeadlock
Deadlock
 
Pram model
Pram modelPram model
Pram model
 
CS9222 ADVANCED OPERATING SYSTEMS
CS9222 ADVANCED OPERATING SYSTEMSCS9222 ADVANCED OPERATING SYSTEMS
CS9222 ADVANCED OPERATING SYSTEMS
 

En vedette

Inter-Process Communication (IPC) techniques on Mac OS X
Inter-Process Communication (IPC) techniques on Mac OS XInter-Process Communication (IPC) techniques on Mac OS X
Inter-Process Communication (IPC) techniques on Mac OS XHEM DUTT
 
Stij5014 distributed systems
Stij5014 distributed systemsStij5014 distributed systems
Stij5014 distributed systemslara_ays
 
Distributed File Systems
Distributed File SystemsDistributed File Systems
Distributed File Systemsawesomesos
 
Distributed File Systems
Distributed File Systems Distributed File Systems
Distributed File Systems Maurvi04
 
Inter process communication
Inter process communicationInter process communication
Inter process communicationMohd Tousif
 
Op Sy 03 Ch 33
Op Sy 03 Ch 33Op Sy 03 Ch 33
Op Sy 03 Ch 33 Google
 
Chapter 2 - Operating System Structures
Chapter 2 - Operating System StructuresChapter 2 - Operating System Structures
Chapter 2 - Operating System StructuresWayne Jones Jnr
 
Operating system.ppt (1)
Operating system.ppt (1)Operating system.ppt (1)
Operating system.ppt (1)Vaibhav Bajaj
 
Operating system overview concepts ppt
Operating system overview concepts pptOperating system overview concepts ppt
Operating system overview concepts pptRajendraPrasad Alladi
 

En vedette (13)

Inter-Process Communication (IPC) techniques on Mac OS X
Inter-Process Communication (IPC) techniques on Mac OS XInter-Process Communication (IPC) techniques on Mac OS X
Inter-Process Communication (IPC) techniques on Mac OS X
 
Ch12
Ch12Ch12
Ch12
 
Stij5014 distributed systems
Stij5014 distributed systemsStij5014 distributed systems
Stij5014 distributed systems
 
Ipc
IpcIpc
Ipc
 
Distributed File Systems
Distributed File SystemsDistributed File Systems
Distributed File Systems
 
Distributed File Systems
Distributed File Systems Distributed File Systems
Distributed File Systems
 
Inter process communication
Inter process communicationInter process communication
Inter process communication
 
Op Sy 03 Ch 33
Op Sy 03 Ch 33Op Sy 03 Ch 33
Op Sy 03 Ch 33
 
Distributed System
Distributed System Distributed System
Distributed System
 
Chapter 2 - Operating System Structures
Chapter 2 - Operating System StructuresChapter 2 - Operating System Structures
Chapter 2 - Operating System Structures
 
Inter Process Communication
Inter Process CommunicationInter Process Communication
Inter Process Communication
 
Operating system.ppt (1)
Operating system.ppt (1)Operating system.ppt (1)
Operating system.ppt (1)
 
Operating system overview concepts ppt
Operating system overview concepts pptOperating system overview concepts ppt
Operating system overview concepts ppt
 

Similaire à IPC

Multiprocessing -Interprocessing communication and process sunchronization,se...
Multiprocessing -Interprocessing communication and process sunchronization,se...Multiprocessing -Interprocessing communication and process sunchronization,se...
Multiprocessing -Interprocessing communication and process sunchronization,se...Neena R Krishna
 
Lecture-4_Process Management.pdf
Lecture-4_Process Management.pdfLecture-4_Process Management.pdf
Lecture-4_Process Management.pdfHarika Pudugosula
 
System Programming - Interprocess communication
System Programming - Interprocess communicationSystem Programming - Interprocess communication
System Programming - Interprocess communicationHelpWithAssignment.com
 
MODULE IV embedded (1).pptx
MODULE IV embedded (1).pptxMODULE IV embedded (1).pptx
MODULE IV embedded (1).pptxSajinvs4
 
SYNCHRONIZATION IN MULTIPROCESSING
SYNCHRONIZATION IN MULTIPROCESSINGSYNCHRONIZATION IN MULTIPROCESSING
SYNCHRONIZATION IN MULTIPROCESSINGAparna Bhadran
 
ITFT_Inter process communication
ITFT_Inter process communicationITFT_Inter process communication
ITFT_Inter process communicationSneh Prabha
 
Operating system 19 interacting processes and ipc
Operating system 19 interacting processes and ipcOperating system 19 interacting processes and ipc
Operating system 19 interacting processes and ipcVaibhav Khanna
 
Inter Process Communication - IPC
Inter Process Communication - IPCInter Process Communication - IPC
Inter Process Communication - IPCPravjot Singh
 
interprocess-communication.pdf
interprocess-communication.pdfinterprocess-communication.pdf
interprocess-communication.pdfAmarSingh21897
 
Introduction 1
Introduction 1Introduction 1
Introduction 1Yasir Khan
 
Linux Inter Process Communication
Linux Inter Process CommunicationLinux Inter Process Communication
Linux Inter Process CommunicationAbhishek Sagar
 
Module2 MultiThreads.ppt
Module2 MultiThreads.pptModule2 MultiThreads.ppt
Module2 MultiThreads.pptshreesha16
 
INTER PROCESS COMMUNICATION (IPC).pptx
INTER PROCESS COMMUNICATION (IPC).pptxINTER PROCESS COMMUNICATION (IPC).pptx
INTER PROCESS COMMUNICATION (IPC).pptxSKUP1
 
distrbuted system show how distbuted system
distrbuted system show how distbuted systemdistrbuted system show how distbuted system
distrbuted system show how distbuted systemayoupalthman
 
Processes and Threads in Windows Vista
Processes and Threads in Windows VistaProcesses and Threads in Windows Vista
Processes and Threads in Windows VistaTrinh Phuc Tho
 
Chapter 3b- Process Communication (1) (1)(1) (1).pptx
Chapter 3b- Process Communication (1) (1)(1) (1).pptxChapter 3b- Process Communication (1) (1)(1) (1).pptx
Chapter 3b- Process Communication (1) (1)(1) (1).pptxayeshabaig2004
 
Module 2 - PPT.pdfModule 2 - PPT.pdfModule 2 - PPT.pdfModule 2 - PPT.pdfModul...
Module 2 - PPT.pdfModule 2 - PPT.pdfModule 2 - PPT.pdfModule 2 - PPT.pdfModul...Module 2 - PPT.pdfModule 2 - PPT.pdfModule 2 - PPT.pdfModule 2 - PPT.pdfModul...
Module 2 - PPT.pdfModule 2 - PPT.pdfModule 2 - PPT.pdfModule 2 - PPT.pdfModul...morganjohn3
 

Similaire à IPC (20)

Ch03 processes
Ch03 processesCh03 processes
Ch03 processes
 
Multiprocessing -Interprocessing communication and process sunchronization,se...
Multiprocessing -Interprocessing communication and process sunchronization,se...Multiprocessing -Interprocessing communication and process sunchronization,se...
Multiprocessing -Interprocessing communication and process sunchronization,se...
 
Lecture-4_Process Management.pdf
Lecture-4_Process Management.pdfLecture-4_Process Management.pdf
Lecture-4_Process Management.pdf
 
Lecture 5 inter process communication
Lecture 5 inter process communicationLecture 5 inter process communication
Lecture 5 inter process communication
 
System Programming - Interprocess communication
System Programming - Interprocess communicationSystem Programming - Interprocess communication
System Programming - Interprocess communication
 
MODULE IV embedded (1).pptx
MODULE IV embedded (1).pptxMODULE IV embedded (1).pptx
MODULE IV embedded (1).pptx
 
SYNCHRONIZATION IN MULTIPROCESSING
SYNCHRONIZATION IN MULTIPROCESSINGSYNCHRONIZATION IN MULTIPROCESSING
SYNCHRONIZATION IN MULTIPROCESSING
 
ITFT_Inter process communication
ITFT_Inter process communicationITFT_Inter process communication
ITFT_Inter process communication
 
Operating system 19 interacting processes and ipc
Operating system 19 interacting processes and ipcOperating system 19 interacting processes and ipc
Operating system 19 interacting processes and ipc
 
Inter Process Communication - IPC
Inter Process Communication - IPCInter Process Communication - IPC
Inter Process Communication - IPC
 
interprocess-communication.pdf
interprocess-communication.pdfinterprocess-communication.pdf
interprocess-communication.pdf
 
Introduction 1
Introduction 1Introduction 1
Introduction 1
 
Os
OsOs
Os
 
Linux Inter Process Communication
Linux Inter Process CommunicationLinux Inter Process Communication
Linux Inter Process Communication
 
Module2 MultiThreads.ppt
Module2 MultiThreads.pptModule2 MultiThreads.ppt
Module2 MultiThreads.ppt
 
INTER PROCESS COMMUNICATION (IPC).pptx
INTER PROCESS COMMUNICATION (IPC).pptxINTER PROCESS COMMUNICATION (IPC).pptx
INTER PROCESS COMMUNICATION (IPC).pptx
 
distrbuted system show how distbuted system
distrbuted system show how distbuted systemdistrbuted system show how distbuted system
distrbuted system show how distbuted system
 
Processes and Threads in Windows Vista
Processes and Threads in Windows VistaProcesses and Threads in Windows Vista
Processes and Threads in Windows Vista
 
Chapter 3b- Process Communication (1) (1)(1) (1).pptx
Chapter 3b- Process Communication (1) (1)(1) (1).pptxChapter 3b- Process Communication (1) (1)(1) (1).pptx
Chapter 3b- Process Communication (1) (1)(1) (1).pptx
 
Module 2 - PPT.pdfModule 2 - PPT.pdfModule 2 - PPT.pdfModule 2 - PPT.pdfModul...
Module 2 - PPT.pdfModule 2 - PPT.pdfModule 2 - PPT.pdfModule 2 - PPT.pdfModul...Module 2 - PPT.pdfModule 2 - PPT.pdfModule 2 - PPT.pdfModule 2 - PPT.pdfModul...
Module 2 - PPT.pdfModule 2 - PPT.pdfModule 2 - PPT.pdfModule 2 - PPT.pdfModul...
 

Dernier

%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Hararemasabamasaba
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrandmasabamasaba
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension AidPhilip Schwarz
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...masabamasaba
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park masabamasaba
 
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburgmasabamasaba
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...Shane Coughlan
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in sowetomasabamasaba
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyviewmasabamasaba
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...masabamasaba
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...chiefasafspells
 
tonesoftg
tonesoftgtonesoftg
tonesoftglanshi9
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...masabamasaba
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024VictoriaMetrics
 

Dernier (20)

%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 

IPC

  • 2. Interprocess Communication • Processes within a system may be independent or cooperating! • Cooperating process can affect or be affected by other processes, including sharing data. • Reasons for cooperating processes: • Information sharing • Computation speedup • Modularity • Convenience • Cooperating processes need interprocess communication(IPC) • Two models of IPC: • Shared memory • Message passing
  • 4. Cooperating Processes • Independent process cannot affect or be affected by the execution of another process • Cooperating process can affect or be affected by the execution of another process • Advantages of process cooperation: • Information sharing • Computation speed-up • Modularity • Convenience
  • 5. Interprocess Communication – Message Passing • Mechanism for processes to communicate and to synchronize their actions • Message system – processes communicate with each other without resorting to shared variables • IPC facility provides two operations: • send(message) – message size fixed or variable • receive(message) • If P and Q wish to communicate, they need to: • establish a communication link between them • exchange messages via send/receive • Implementation of communication link • physical (e.g., shared memory, hardware bus) • logical (e.g., logical properties)
  • 6. Direct Communication • Processes must name each other explicitly: • send (P, message) – send a message to process P • receive(Q, message) – receive a message from process Q • Properties of communication link • Links are established automatically • A link is associated with exactly one pair of communicating processes • Between each pair there exists exactly one link • The link may be unidirectional, but is usually bi-directional
  • 7. Indirect Communication • Messages are directed and received from mailboxes (also referred to as ports) • Each mailbox has a unique id • Processes can communicate only if they share a mailbox • Properties of communication link • Link established only if processes share a common mailbox • A link may be associated with many processes • Each pair of processes may share several communication links • Link may be unidirectional or bi-directional
  • 8. Indirect Communication • Operations • create a new mailbox • send and receive messages through mailbox • destroy a mailbox • Primitives are defined as: • send(A, message) – send a message to mailbox A • receive(A, message) – receive a message from mailbox A
  • 9. Indirect Communication • Mailbox sharing • P1, P2, and P3 share mailbox A • P1, sends; P2 and P3 receive • Who gets the message? • Solutions: • Allow a link to be associated with at most two processes • Allow only one process at a time to execute a receive operation • Allow the system to select arbitrarily the receiver. Sender is notified who the receiver was.
  • 10. Synchronization • Message passing may be either blocking or non-blocking • Blocking is considered synchronous! • Blocking send has the sender block until the message is received • Blocking receive has the receiver block until a message is available • Non-blocking is considered asynchronous! • Non-blocking send has the sender send the message and continue • Non-blocking receive has the receiver receive a valid message or null"
  • 11. Buffering • Queue of messages attached to the link; implemented in one of three ways 1. Zero capacity – 0 messages Sender must wait for receiver (rendezvous) 2. Bounded capacity – finite length of n messages Sender must wait if link full" 3. Unbounded capacity – infinite length • Sender never waits
  • 12. Examples of IPC Systems - POSIX • POSIX Shared Memory • Process first creates shared memory segment segment id = shmget(IPC PRIVATE, size, SIRUSR | SIWUSR); • Process wanting access to that shared memory must attach to it" • shared memory = (char *) shmat(id, NULL, 0); • Now the process could write to the shared memory" • sprintf(shared memory, "Writing to shared memory"); • When done a process can detach the shared memory from its address space • shmdt(shared memory);
  • 13. Examples of IPC Systems – Windows XP • Message-passing centric via local procedure call (LPC) facility • Only works between processes on the same system" • Uses ports (like mailboxes) to establish and maintain communication channels • Communication works as follows: • The client opens a handle to the subsystem’s connection port object • The client sends a connection request • The server creates two private communication ports and returns the handle to one of them to the client • The client and server use the corresponding port handle to send messages or callbacks and to listen for replies
  • 14. Local Procedure Calls in Windows XP
  • 15. Signal • Signal is an IPC used for signaling from a process A to OS to enable start of another process B. • Signal is a one or two byte IPC from a process to the OS. • Signal provides the shortest communication. • The signal ( ) sends a one-bit output for a process, which unmasks a signal mask of a process or task (called signal handler) • The handler has coding similar to ones in an ISR runs in a way similar to a highest priority ISR. • An ISR runs on an hardware interrupt provided that interrupt is no masked. The signal handler also runs on signal provided that signal is no masked. • When the IPC functions for signal are not provided by an OS, then the OS employs semaphore for the same purpose.
  • 18. • Task i sending signal s to initiate signal handler ISR j
  • 19. PIPE • Pipes are a data transfer, byte stream IPC facility that connect processes; the byte stream written to one end of the pipe can be read from the other. • once created, pipes are referenced by file descriptor handles #include <unistd.h> int pipe(int filedes[2]); • filedes[0] is open for reading (read-end), • filedes[1] is open for writing (write-end) • The output of filedes[1] is the input of filedes[0] • pipes are half-duplex
  • 20. Pipes — intuition • every read from a pipe copy from kernel space to user space • every write to a pipe copy from user space to kernel space
  • 21. Semaphores • A semaphore is a protected variable whose value can be accessed and altered only by the operations P(wait)and V(signal)and initialization operation. • wait() was called P (for Dutch “Proberen” meaning to test) and signal() was called V (for Dutch “Verhogen” meaning to increment). • Types of Semaphore: 1. Binary Semaphore • Binary semaphores have 2 methods associated with it. (lock, unlock) • Binary semaphores can take only 2 values (0/1). They are used to acquire locks. When a resource is available, the process in charge set the semaphore to 1 else 0.
  • 22. Semaphores 2. Counting semaphores • Counting Semaphore may have value to be greater than one, typically used to allocate resources from a pool of identical resources 3.Mutex Semaphore • A mutual exclusion (mutex) semaphore is a special binary semaphore that supports ownership, recursive access, task deletion safety. • Is a key to a toilet. One person can have the key - occupy the toilet - at the time. When finished, the person gives (frees) the key to the next person in the queue.
  • 23. Semaphores: Access • wait: If the value of semaphore variable is not negative, decrements it by 1. If the semaphore variable is now negative, the process executing wait is blocked (i.e., added to the semaphore's queue) until the value is greater or equal to 1. Otherwise, the process continues execution, having used a unit of the resource. • signal: Increments the value of semaphore variable by 1. After the increment, if the pre-increment value was negative (meaning there are processes waiting for a resource), it transfers a blocked process from the semaphore's waiting queue to the ready queue.
  • 24. Semaphores: Access wait (semaphore s) { while(s==0); //wait until s>0; s=s-1; } signal (semaphore s) { s=s+1; }
  • 25. Sockets • A socket is defined as an endpoint for communication • Concatenation of IP address and port • The socket 161.25.19.8:1625 refers to port 1625 on host 161.25.19.8 • Communication consists between a pair of sockets
  • 26. Shared Memory • Shared memory allows one or more processes to communicate via memory that appears in all of their virtual address spaces.
  • 27. Shared Memory with Mutex • In this design pattern, task #1 and task #2 access shared memory using a mutex for synchronization. • Each task must first acquire the mutex before accessing the shared memory. The task blocks if the mutex is already locked, indicating that another task is accessing the shared memory. The task releases the mutex after it completes its operation on the shared memory.
  • 28. Message Queues • Message queues allow one or more processes to write messages that will be read by one or more reading processes.
  • 29. Message Queues: Operation • Kernel job to assign a unique ID to a message queue and to create its QCB and task-waiting list. The kernel also takes developer-supplied parameters such as the length of the queue and the maximum message length to determine how much memory is required for the message queue. After the kernel has this information, it allocates memory for the message queue from either a pool of system memory or some private memory space. • The message queue itself consists of a number of elements, each of which can hold a single message. The elements holding the first and last messages are called the head and tail respectively. • a message queue has two associated task-waiting lists. The receiving task-waiting list consists of tasks that wait on the queue when it is empty. The sending list consists of tasks that wait on the queue when it is full. Empty and full message- queue states, as well as other key concepts
  • 30. Deadlock • A deadlock is a situation in which two or more competing actions are each waiting for the other to finish, and thus neither ever does.
  • 31. Deadlock Characterization Deadlock can arise if four conditions hold simultaneously : • Mutual exclusion: only one process at a time can use a resource. • Hold and wait: a process holding at least one resource is waiting to acquire additional resources held by other processes. • No preemption: a resource can be released only voluntarily by the process holding it, after that process has completed its task. • Circular wait: there exists a set {P0, P1, …, Pn} of waiting processes such that P0 is waiting for a resource that is held by P1, P1 is waiting for a resource that is held by P2, …, Pn–1 is waiting for a resource that is held by Pn, and Pn is waiting for a resource that is held by P0