SlideShare a Scribd company logo
IPC TYPES
 SHARED MEMORY
 MAPPED MEMORY
 PIPE
 FIFO
 MASSEGE QUEUE
 SOCKET
 SIGNAL
SHARED MEMORY
 Simplest and fastest form of IPC.
 All process shares same piece of memory.
 This memory is shared between some different processes
so synchronization needed.
Means, only one process should be allowed to read/write at
a time.(we can do this by using semaphore).
 First create shared memory with a specific key using
shmget.
 Attach that memory to process’s address space to make it
available for that process using shmat.
 ipcs –m. (To see the list of shared memory in our pc.)
Shmget & shmat
 shm_id = shmget( key , bytes , flag).
 Key - unrelated process can access same shared segment by
specifying same key.
 Bytes – number of bytes in segment.
 Flag – IPC_CREAT | IPC_EXCL | S_IRUSR | S_IWUSR.
 char *shm = shmat(shm_id, ptr, flag);
 shm_id – shared segment identifier returned by shmget.
 ptr – pointer that specifies where in your process’s address space you
want to map shared memory.
 flag – SHM_RND, SHM_RDONLY.
 shmdt(shm) – detach shared memory from our process address
space.
 shmctl( shm_id, flag, NULL).
flag = IPC_STAT , IPC_RMID etc.
MAPPED MEMORY
 Permit different process to communicate via a shared
file.
 Mapped memory forms an association between a file
and a process’s memory.
 Linux splits the file into page-sized chunks and then
copies them into virtual memory pages so that they
can be made available in a process’s address space.
 mmap call is used.
Mmap()
 mmap( addr, len, prot, flag, fd, offset).
o Addr – address at which you would like linux to map the
file into your process’s address space(NULL).
o Len – length of map In bytes.
o Prot – PROT_READ | PROT_WRITE | PROT_EXEC.
o Flag – MAP_FIXED, MAP_PRIVATE (store write to new
file), MAP_SHARED(store write immediately to file, do
not buffer it).
o Fd – file descriptor opened to file to be mapped.
o Offset – offset from beginning of file from which to start
the map.
PIPE & FIFO
 PIPE permits sequential communication from one process to a
related process.
 Data written to the “write end” of the pipe is read back from the
“read end.”
 Eg. ls | less : output of “ls” will be written to pipe and on other
side it becomes input for “less”.
 Int pipe( int fd[2]);
 FIFOs : fifo are similar to pipes, except that unrelated processes
can communicate.
 Write mkfifo foo (on first terminal).
 Write echo hello > foo (first terminal).
 Write cat < foo (second terminal).
MESSAGE QUEUE
 Two (or more) processes can exchange information via
access to a common system message queue.
 The sending process places via some (OS) message
passing module a message onto a queue which can be
read by another process.
 Each message is given an identification or type so that
processes can select the appropriate message.
 Before we start sending/receiving message, we have to
initialize message queue.
 Initializing msgq : int msgget( key_t key , int msgflg ).
Msgget, msgsnd, msgrcv
 msgid = msgget( key_t key, int msgflg)
 Key : processes must share common key to gain access to the queue.
 Msdflg : IPC_CREAT | IPC_EXCL | 0666;
 Int msgsnd( int msgid, void *msgp, size_t msgsz,
int msgflg ). // man msgsend.
 Int msgrcv( int msgid , void *msgp , size_t msgsz,
long msgtyp , int msgflg ).
 struct mymsg {
long mtype; /* message type */
char mtext[MSGSZ]; /* message text of length MSGSZ */
} *msgp;
SIGNAL
 Used to signal asynchronous events to one or more
processes.
 An application program can specify a function called a
signal handler to be invoked when specific signal is
received.
 Signal hander than catches the signal by using :
int (*signal(int sig , void (*func())));
 “ Kill –l ” gives list of different signals.
 Process can ignores most of signals except SIGSTOP
and SIGKILL.

More Related Content

What's hot

INTER PROCESS COMMUNICATION (IPC).pptx
INTER PROCESS COMMUNICATION (IPC).pptxINTER PROCESS COMMUNICATION (IPC).pptx
INTER PROCESS COMMUNICATION (IPC).pptx
LECO9
 
Inter process communication
Inter process communicationInter process communication
Inter process communication
Pradeep Kumar TS
 
Distributed File Systems
Distributed File Systems Distributed File Systems
Distributed File Systems
Maurvi04
 
8. mutual exclusion in Distributed Operating Systems
8. mutual exclusion in Distributed Operating Systems8. mutual exclusion in Distributed Operating Systems
8. mutual exclusion in Distributed Operating Systems
Dr Sandeep Kumar Poonia
 
Deadlock in Distributed Systems
Deadlock in Distributed SystemsDeadlock in Distributed Systems
Deadlock in Distributed Systems
Pritom Saha Akash
 
Deadlock Avoidance - OS
Deadlock Avoidance - OSDeadlock Avoidance - OS
Deadlock Avoidance - OS
MsAnita2
 
file sharing semantics by Umar Danjuma Maiwada
file sharing semantics by Umar Danjuma Maiwada file sharing semantics by Umar Danjuma Maiwada
file sharing semantics by Umar Danjuma Maiwada
umardanjumamaiwada
 
operating system structure
operating system structureoperating system structure
operating system structure
Waseem Ud Din Farooqui
 
Memory Management in OS
Memory Management in OSMemory Management in OS
Memory Management in OS
Kumar Pritam
 
Locks In Disributed Systems
Locks In Disributed SystemsLocks In Disributed Systems
Locks In Disributed Systems
mridul mishra
 
Interprocess communication
Interprocess communicationInterprocess communication
Interprocess communication
Sushil Singh
 
Introduction to Shell script
Introduction to Shell scriptIntroduction to Shell script
Introduction to Shell script
Bhavesh Padharia
 
Processes and threads
Processes and threadsProcesses and threads
Message passing in Distributed Computing Systems
Message passing in Distributed Computing SystemsMessage passing in Distributed Computing Systems
Message passing in Distributed Computing Systems
Alagappa Govt Arts College, Karaikudi
 
process creation OS
process creation OSprocess creation OS
process creation OS
Kiran Kumar Thota
 
Storage management in operating system
Storage management in operating systemStorage management in operating system
Storage management in operating system
DeepikaT13
 
Distributed operating system
Distributed operating systemDistributed operating system
Distributed operating system
Prankit Mishra
 
distributed shared memory
 distributed shared memory distributed shared memory
distributed shared memory
Ashish Kumar
 
Distributed deadlock
Distributed deadlockDistributed deadlock
Distributed deadlock
Md. Mahedi Mahfuj
 
Memory Management in OS
Memory Management in OSMemory Management in OS
Memory Management in OS
vampugani
 

What's hot (20)

INTER PROCESS COMMUNICATION (IPC).pptx
INTER PROCESS COMMUNICATION (IPC).pptxINTER PROCESS COMMUNICATION (IPC).pptx
INTER PROCESS COMMUNICATION (IPC).pptx
 
Inter process communication
Inter process communicationInter process communication
Inter process communication
 
Distributed File Systems
Distributed File Systems Distributed File Systems
Distributed File Systems
 
8. mutual exclusion in Distributed Operating Systems
8. mutual exclusion in Distributed Operating Systems8. mutual exclusion in Distributed Operating Systems
8. mutual exclusion in Distributed Operating Systems
 
Deadlock in Distributed Systems
Deadlock in Distributed SystemsDeadlock in Distributed Systems
Deadlock in Distributed Systems
 
Deadlock Avoidance - OS
Deadlock Avoidance - OSDeadlock Avoidance - OS
Deadlock Avoidance - OS
 
file sharing semantics by Umar Danjuma Maiwada
file sharing semantics by Umar Danjuma Maiwada file sharing semantics by Umar Danjuma Maiwada
file sharing semantics by Umar Danjuma Maiwada
 
operating system structure
operating system structureoperating system structure
operating system structure
 
Memory Management in OS
Memory Management in OSMemory Management in OS
Memory Management in OS
 
Locks In Disributed Systems
Locks In Disributed SystemsLocks In Disributed Systems
Locks In Disributed Systems
 
Interprocess communication
Interprocess communicationInterprocess communication
Interprocess communication
 
Introduction to Shell script
Introduction to Shell scriptIntroduction to Shell script
Introduction to Shell script
 
Processes and threads
Processes and threadsProcesses and threads
Processes and threads
 
Message passing in Distributed Computing Systems
Message passing in Distributed Computing SystemsMessage passing in Distributed Computing Systems
Message passing in Distributed Computing Systems
 
process creation OS
process creation OSprocess creation OS
process creation OS
 
Storage management in operating system
Storage management in operating systemStorage management in operating system
Storage management in operating system
 
Distributed operating system
Distributed operating systemDistributed operating system
Distributed operating system
 
distributed shared memory
 distributed shared memory distributed shared memory
distributed shared memory
 
Distributed deadlock
Distributed deadlockDistributed deadlock
Distributed deadlock
 
Memory Management in OS
Memory Management in OSMemory Management in OS
Memory Management in OS
 

Viewers also liked

Inter process communication using Linux System Calls
Inter process communication using Linux System CallsInter process communication using Linux System Calls
Inter process communication using Linux System Calls
jyoti9vssut
 
Sockets in unix
Sockets in unixSockets in unix
Sockets in unix
swtjerin4u
 
Sun RPC (Remote Procedure Call)
Sun RPC (Remote Procedure Call)Sun RPC (Remote Procedure Call)
Sun RPC (Remote Procedure Call)
Peter R. Egli
 
Remote procedure call on client server computing
Remote procedure call on client server computingRemote procedure call on client server computing
Remote procedure call on client server computing
Satya P. Joshi
 
RPC: Remote procedure call
RPC: Remote procedure callRPC: Remote procedure call
RPC: Remote procedure call
Sunita Sahu
 
Rpc (Distributed computing)
Rpc (Distributed computing)Rpc (Distributed computing)
Rpc (Distributed computing)
Sri Prasanna
 
Introduction to Remote Procedure Call
Introduction to Remote Procedure CallIntroduction to Remote Procedure Call
Introduction to Remote Procedure Call
Abdelrahman Al-Ogail
 
5 Process Scheduling
5 Process Scheduling5 Process Scheduling
5 Process Scheduling
Dr. Loganathan R
 
Process Scheduling
Process SchedulingProcess Scheduling
Process scheduling
Process schedulingProcess scheduling
Process scheduling
Deepika Balichwal
 
Os Threads
Os ThreadsOs Threads
Os Threads
Salman Memon
 
Mobile Ad hoc Networks
Mobile Ad hoc NetworksMobile Ad hoc Networks
Mobile Ad hoc Networks
Jagdeep Singh
 
Threads (operating System)
Threads (operating System)Threads (operating System)
Threads (operating System)
Prakhar Maurya
 
RPC
RPCRPC
remote procedure calls
  remote procedure calls  remote procedure calls
remote procedure calls
Ashish Kumar
 
Process scheduling
Process schedulingProcess scheduling
Process scheduling
Prasunjeet Soni
 
Operating System-Threads-Galvin
Operating System-Threads-GalvinOperating System-Threads-Galvin
Operating System-Threads-Galvin
Sonali Chauhan
 
Process Scheduling
Process SchedulingProcess Scheduling
Process Scheduling
Abhishek Nagar
 
Interprocess Communication
Interprocess CommunicationInterprocess Communication
Interprocess Communication
Deepak H L
 

Viewers also liked (19)

Inter process communication using Linux System Calls
Inter process communication using Linux System CallsInter process communication using Linux System Calls
Inter process communication using Linux System Calls
 
Sockets in unix
Sockets in unixSockets in unix
Sockets in unix
 
Sun RPC (Remote Procedure Call)
Sun RPC (Remote Procedure Call)Sun RPC (Remote Procedure Call)
Sun RPC (Remote Procedure Call)
 
Remote procedure call on client server computing
Remote procedure call on client server computingRemote procedure call on client server computing
Remote procedure call on client server computing
 
RPC: Remote procedure call
RPC: Remote procedure callRPC: Remote procedure call
RPC: Remote procedure call
 
Rpc (Distributed computing)
Rpc (Distributed computing)Rpc (Distributed computing)
Rpc (Distributed computing)
 
Introduction to Remote Procedure Call
Introduction to Remote Procedure CallIntroduction to Remote Procedure Call
Introduction to Remote Procedure Call
 
5 Process Scheduling
5 Process Scheduling5 Process Scheduling
5 Process Scheduling
 
Process Scheduling
Process SchedulingProcess Scheduling
Process Scheduling
 
Process scheduling
Process schedulingProcess scheduling
Process scheduling
 
Os Threads
Os ThreadsOs Threads
Os Threads
 
Mobile Ad hoc Networks
Mobile Ad hoc NetworksMobile Ad hoc Networks
Mobile Ad hoc Networks
 
Threads (operating System)
Threads (operating System)Threads (operating System)
Threads (operating System)
 
RPC
RPCRPC
RPC
 
remote procedure calls
  remote procedure calls  remote procedure calls
remote procedure calls
 
Process scheduling
Process schedulingProcess scheduling
Process scheduling
 
Operating System-Threads-Galvin
Operating System-Threads-GalvinOperating System-Threads-Galvin
Operating System-Threads-Galvin
 
Process Scheduling
Process SchedulingProcess Scheduling
Process Scheduling
 
Interprocess Communication
Interprocess CommunicationInterprocess Communication
Interprocess Communication
 

Similar to Inter process communication

Inter Process Communication PPT
Inter Process Communication PPTInter Process Communication PPT
Inter Process Communication PPT
Sowmya Jyothi
 
Linux Systems Programming: Semaphores, Shared Memory, and Message Queues
Linux Systems Programming: Semaphores, Shared Memory, and Message QueuesLinux Systems Programming: Semaphores, Shared Memory, and Message Queues
Linux Systems Programming: Semaphores, Shared Memory, and Message Queues
RashidFaridChishti
 
Lab8
Lab8Lab8
Unit_ 5.3 Interprocess communication.pdf
Unit_ 5.3 Interprocess communication.pdfUnit_ 5.3 Interprocess communication.pdf
Unit_ 5.3 Interprocess communication.pdf
AnilkumarBrahmane2
 
ipc.pptx
ipc.pptxipc.pptx
ipc.pptx
SuhanB
 
Usp message queues
Usp message queuesUsp message queues
Usp message queues
RohitK71
 
Operating System 4 1193308760782240 2
Operating System 4 1193308760782240 2Operating System 4 1193308760782240 2
Operating System 4 1193308760782240 2
mona_hakmy
 
Operating System 4
Operating System 4Operating System 4
Operating System 4
tech2click
 
project_531
project_531project_531
project_531
Srivats Bharadwaj
 
Multicore
MulticoreMulticore
25-MPI-OpenMP.pptx
25-MPI-OpenMP.pptx25-MPI-OpenMP.pptx
25-MPI-OpenMP.pptx
GopalPatidar13
 
System Programming - Interprocess communication
System Programming - Interprocess communicationSystem Programming - Interprocess communication
System Programming - Interprocess communication
HelpWithAssignment.com
 
IPC in Microkernel Systems, Capabilities
IPC in Microkernel Systems, CapabilitiesIPC in Microkernel Systems, Capabilities
IPC in Microkernel Systems, Capabilities
Martin Děcký
 
Project Jugaad
Project JugaadProject Jugaad
Bab 4
Bab 4Bab 4
Bab 4
n k
 
3rd Meet Lecturer Notes.pdf
3rd Meet Lecturer Notes.pdf3rd Meet Lecturer Notes.pdf
3rd Meet Lecturer Notes.pdf
hermanto838202
 
ch 7 POSIX.pptx
ch 7 POSIX.pptxch 7 POSIX.pptx
ch 7 POSIX.pptx
sibokac
 
Inter Process Comunication
Inter Process ComunicationInter Process Comunication
Inter Process Comunication
Laura Sofia Bruges Holguin
 
Lecture1
Lecture1Lecture1
Lecture1
Asad Abbas
 
My ppt hpc u4
My ppt hpc u4My ppt hpc u4

Similar to Inter process communication (20)

Inter Process Communication PPT
Inter Process Communication PPTInter Process Communication PPT
Inter Process Communication PPT
 
Linux Systems Programming: Semaphores, Shared Memory, and Message Queues
Linux Systems Programming: Semaphores, Shared Memory, and Message QueuesLinux Systems Programming: Semaphores, Shared Memory, and Message Queues
Linux Systems Programming: Semaphores, Shared Memory, and Message Queues
 
Lab8
Lab8Lab8
Lab8
 
Unit_ 5.3 Interprocess communication.pdf
Unit_ 5.3 Interprocess communication.pdfUnit_ 5.3 Interprocess communication.pdf
Unit_ 5.3 Interprocess communication.pdf
 
ipc.pptx
ipc.pptxipc.pptx
ipc.pptx
 
Usp message queues
Usp message queuesUsp message queues
Usp message queues
 
Operating System 4 1193308760782240 2
Operating System 4 1193308760782240 2Operating System 4 1193308760782240 2
Operating System 4 1193308760782240 2
 
Operating System 4
Operating System 4Operating System 4
Operating System 4
 
project_531
project_531project_531
project_531
 
Multicore
MulticoreMulticore
Multicore
 
25-MPI-OpenMP.pptx
25-MPI-OpenMP.pptx25-MPI-OpenMP.pptx
25-MPI-OpenMP.pptx
 
System Programming - Interprocess communication
System Programming - Interprocess communicationSystem Programming - Interprocess communication
System Programming - Interprocess communication
 
IPC in Microkernel Systems, Capabilities
IPC in Microkernel Systems, CapabilitiesIPC in Microkernel Systems, Capabilities
IPC in Microkernel Systems, Capabilities
 
Project Jugaad
Project JugaadProject Jugaad
Project Jugaad
 
Bab 4
Bab 4Bab 4
Bab 4
 
3rd Meet Lecturer Notes.pdf
3rd Meet Lecturer Notes.pdf3rd Meet Lecturer Notes.pdf
3rd Meet Lecturer Notes.pdf
 
ch 7 POSIX.pptx
ch 7 POSIX.pptxch 7 POSIX.pptx
ch 7 POSIX.pptx
 
Inter Process Comunication
Inter Process ComunicationInter Process Comunication
Inter Process Comunication
 
Lecture1
Lecture1Lecture1
Lecture1
 
My ppt hpc u4
My ppt hpc u4My ppt hpc u4
My ppt hpc u4
 

Recently uploaded

Building Electrical System Design & Installation
Building Electrical System Design & InstallationBuilding Electrical System Design & Installation
Building Electrical System Design & Installation
symbo111
 
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdfBPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
MIGUELANGEL966976
 
introduction to solar energy for engineering.pdf
introduction to solar energy for engineering.pdfintroduction to solar energy for engineering.pdf
introduction to solar energy for engineering.pdf
ravindarpurohit26
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
IJECEIAES
 
bank management system in java and mysql report1.pdf
bank management system in java and mysql report1.pdfbank management system in java and mysql report1.pdf
bank management system in java and mysql report1.pdf
Divyam548318
 
PPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testingPPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testing
anoopmanoharan2
 
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
awadeshbabu
 
digital fundamental by Thomas L.floydl.pdf
digital fundamental by Thomas L.floydl.pdfdigital fundamental by Thomas L.floydl.pdf
digital fundamental by Thomas L.floydl.pdf
drwaing
 
Hierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power SystemHierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power System
Kerry Sado
 
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
insn4465
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
Aditya Rajan Patra
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
thanhdowork
 
Generative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of contentGenerative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of content
Hitesh Mohapatra
 
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理
zwunae
 
Technical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prismsTechnical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prisms
heavyhaig
 
22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt
KrishnaveniKrishnara1
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
SUTEJAS
 
Low power architecture of logic gates using adiabatic techniques
Low power architecture of logic gates using adiabatic techniquesLow power architecture of logic gates using adiabatic techniques
Low power architecture of logic gates using adiabatic techniques
nooriasukmaningtyas
 
一比一原版(UC Berkeley毕业证)加利福尼亚大学|伯克利分校毕业证成绩单专业办理
一比一原版(UC Berkeley毕业证)加利福尼亚大学|伯克利分校毕业证成绩单专业办理一比一原版(UC Berkeley毕业证)加利福尼亚大学|伯克利分校毕业证成绩单专业办理
一比一原版(UC Berkeley毕业证)加利福尼亚大学|伯克利分校毕业证成绩单专业办理
skuxot
 
Swimming pool mechanical components design.pptx
Swimming pool  mechanical components design.pptxSwimming pool  mechanical components design.pptx
Swimming pool mechanical components design.pptx
yokeleetan1
 

Recently uploaded (20)

Building Electrical System Design & Installation
Building Electrical System Design & InstallationBuilding Electrical System Design & Installation
Building Electrical System Design & Installation
 
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdfBPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
 
introduction to solar energy for engineering.pdf
introduction to solar energy for engineering.pdfintroduction to solar energy for engineering.pdf
introduction to solar energy for engineering.pdf
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
 
bank management system in java and mysql report1.pdf
bank management system in java and mysql report1.pdfbank management system in java and mysql report1.pdf
bank management system in java and mysql report1.pdf
 
PPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testingPPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testing
 
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
 
digital fundamental by Thomas L.floydl.pdf
digital fundamental by Thomas L.floydl.pdfdigital fundamental by Thomas L.floydl.pdf
digital fundamental by Thomas L.floydl.pdf
 
Hierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power SystemHierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power System
 
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
 
Generative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of contentGenerative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of content
 
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理
 
Technical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prismsTechnical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prisms
 
22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
 
Low power architecture of logic gates using adiabatic techniques
Low power architecture of logic gates using adiabatic techniquesLow power architecture of logic gates using adiabatic techniques
Low power architecture of logic gates using adiabatic techniques
 
一比一原版(UC Berkeley毕业证)加利福尼亚大学|伯克利分校毕业证成绩单专业办理
一比一原版(UC Berkeley毕业证)加利福尼亚大学|伯克利分校毕业证成绩单专业办理一比一原版(UC Berkeley毕业证)加利福尼亚大学|伯克利分校毕业证成绩单专业办理
一比一原版(UC Berkeley毕业证)加利福尼亚大学|伯克利分校毕业证成绩单专业办理
 
Swimming pool mechanical components design.pptx
Swimming pool  mechanical components design.pptxSwimming pool  mechanical components design.pptx
Swimming pool mechanical components design.pptx
 

Inter process communication

  • 1.
  • 2. IPC TYPES  SHARED MEMORY  MAPPED MEMORY  PIPE  FIFO  MASSEGE QUEUE  SOCKET  SIGNAL
  • 3. SHARED MEMORY  Simplest and fastest form of IPC.  All process shares same piece of memory.  This memory is shared between some different processes so synchronization needed. Means, only one process should be allowed to read/write at a time.(we can do this by using semaphore).  First create shared memory with a specific key using shmget.  Attach that memory to process’s address space to make it available for that process using shmat.  ipcs –m. (To see the list of shared memory in our pc.)
  • 4. Shmget & shmat  shm_id = shmget( key , bytes , flag).  Key - unrelated process can access same shared segment by specifying same key.  Bytes – number of bytes in segment.  Flag – IPC_CREAT | IPC_EXCL | S_IRUSR | S_IWUSR.  char *shm = shmat(shm_id, ptr, flag);  shm_id – shared segment identifier returned by shmget.  ptr – pointer that specifies where in your process’s address space you want to map shared memory.  flag – SHM_RND, SHM_RDONLY.  shmdt(shm) – detach shared memory from our process address space.  shmctl( shm_id, flag, NULL). flag = IPC_STAT , IPC_RMID etc.
  • 5. MAPPED MEMORY  Permit different process to communicate via a shared file.  Mapped memory forms an association between a file and a process’s memory.  Linux splits the file into page-sized chunks and then copies them into virtual memory pages so that they can be made available in a process’s address space.  mmap call is used.
  • 6. Mmap()  mmap( addr, len, prot, flag, fd, offset). o Addr – address at which you would like linux to map the file into your process’s address space(NULL). o Len – length of map In bytes. o Prot – PROT_READ | PROT_WRITE | PROT_EXEC. o Flag – MAP_FIXED, MAP_PRIVATE (store write to new file), MAP_SHARED(store write immediately to file, do not buffer it). o Fd – file descriptor opened to file to be mapped. o Offset – offset from beginning of file from which to start the map.
  • 7. PIPE & FIFO  PIPE permits sequential communication from one process to a related process.  Data written to the “write end” of the pipe is read back from the “read end.”  Eg. ls | less : output of “ls” will be written to pipe and on other side it becomes input for “less”.  Int pipe( int fd[2]);  FIFOs : fifo are similar to pipes, except that unrelated processes can communicate.  Write mkfifo foo (on first terminal).  Write echo hello > foo (first terminal).  Write cat < foo (second terminal).
  • 8. MESSAGE QUEUE  Two (or more) processes can exchange information via access to a common system message queue.  The sending process places via some (OS) message passing module a message onto a queue which can be read by another process.  Each message is given an identification or type so that processes can select the appropriate message.  Before we start sending/receiving message, we have to initialize message queue.  Initializing msgq : int msgget( key_t key , int msgflg ).
  • 9. Msgget, msgsnd, msgrcv  msgid = msgget( key_t key, int msgflg)  Key : processes must share common key to gain access to the queue.  Msdflg : IPC_CREAT | IPC_EXCL | 0666;  Int msgsnd( int msgid, void *msgp, size_t msgsz, int msgflg ). // man msgsend.  Int msgrcv( int msgid , void *msgp , size_t msgsz, long msgtyp , int msgflg ).  struct mymsg { long mtype; /* message type */ char mtext[MSGSZ]; /* message text of length MSGSZ */ } *msgp;
  • 10. SIGNAL  Used to signal asynchronous events to one or more processes.  An application program can specify a function called a signal handler to be invoked when specific signal is received.  Signal hander than catches the signal by using : int (*signal(int sig , void (*func())));  “ Kill –l ” gives list of different signals.  Process can ignores most of signals except SIGSTOP and SIGKILL.