Skip to content
    geeksforgeeks
    • Courses
      • DSA / Placements
      • ML & Data Science
      • Development
      • Cloud / DevOps
      • Programming Languages
      • All Courses
    • Tutorials
      • Python
      • Java
      • ML & Data Science
      • Programming Languages
      • Web Development
      • CS Subjects
      • DevOps
      • Software and Tools
      • School Learning
    • Interview Prep
      • Interview Corner
      • Practice DSA
      • GfG 160
      • Problem of the Day
    • OS Tutorial
    • Interview Questions
    • Quizzes
    • Notes
    • System Call
    • Paging
    • Virtual Memory
    • Deadlock Handling
    • DBMS
    • Computer Network
    • Digital Electronics
    • TOC
    • Compiler Design
    Open In App

    Inter Process Communication (IPC)

    Last Updated : 29 Aug, 2025
    Comments
    Improve
    Suggest changes
    224 Likes
    Like
    Report

    Processes need to communicate with each other in many situations. Inter-Process Communication or IPC is a mechanism that allows processes to communicate.

    • It helps processes synchronize their activities, share information and avoid conflicts while accessing shared resources.
    • There are two method of IPC, shared memory and message passing. An operating system can implement both methods of communication.

    Shared Memory

    Communication between processes using shared memory requires processes to share some variable and it completely depends on how the programmer will implement it. Processes can use shared memory for extracting information as a record from another process as well as for delivering any specific information to other processes.

    Shared_Memory
    Shared Memory
    • In the above shared memory model, a common memory space is allocated by the kernel.
    • Process A writes data into the shared memory region (Step 1).
    • Process B can then directly read this data from the same shared memory region (Step 2).
    • Since both processes access the same memory segment, this method is fast but requires synchronization mechanisms (like semaphores) to avoid conflicts when multiple processes read/write simultaneously.

    Message Passing

    Message Passing is a method where processes communicate by sending and receiving messages to exchange data.

    • In this method, one process sends a message and the other process receives it, allowing them to share information.
    • Message Passing can be achieved through different methods like Sockets, Message Queues or Pipes.
    Message_Passing_
    Message Passing
    • In the above message passing model, processes exchange information by sending and receiving messages through the kernel.
    • Process A sends a message to the kernel (Step 1).
    • The kernel then delivers the message to Process B (Step 2).
    • Here, processes do not share memory directly. Instead, communication happens via system calls (send(), recv(), or similar).
    • This method is simpler and safer than shared memory because there’s no risk of overwriting shared data, but it incurs more overhead due to kernel involvement.

    Please refer Methods in Inter process Communication for more details.

    Suggested Quiz
    Edit Quiz
    4 Questions

    Which of the following is an advantage of shared memory IPC?

    • A

      No need for synchronization

    • B

      Messages are delivered automatically by the kernel

    • C

      Faster communication since memory is accessed directly

    • D

      No need for the programmer to manage data sharing

    Explanation:

    Shared memory allows both processes to access the same memory region directly, making communication faster. However, it requires synchronization to prevent conflicts.

    In message passing IPC, communication occurs through:

    • A

      A shared memory region allocated by the programmer

    • B

      Direct access to physical memory

    • C

      A file system used as a buffer

    • D

      System calls such as send() and recv()

    Explanation:

    Message passing uses system calls like send() and recv(). The kernel handles message delivery, not shared memory.

    Which statement about shared memory is correct?

    • A

      Processes share a common memory region created by the kernel

    • B

      It is slower because every communication goes through the kernel

    • C

      It never requires synchronization mechanisms

    • D

      It avoids conflicts automatically

    Explanation:

    In shared memory, the kernel allocates a shared region that both processes can access. Synchronization is required to avoid data races

    Which IPC method is considered simpler and safer?

    • A

      Shared memory

    • B

      Message passing

    • C

      Direct I/O

    • D

      Interrupts

    Explanation:

    Message passing is safer and simpler because processes do not share memory directly. The kernel handles communication, reducing risk of overwriting or conflicts.

    Quiz Completed Successfully
    Your Score :   2/4
    Accuracy :  0%
    Login to View Explanation
    1/4 1/4 < Previous Next >

    K

    kartik
    Improve

    K

    kartik
    Improve
    Article Tags :
    • Operating Systems
    • GATE CS
    • Process Synchronization

    Explore

      OS Basics

      Introduction to Operating System

      5 min read

      Types of Operating Systems

      7 min read

      Kernel in Operating System

      3 min read

      System Call

      2 min read

      What happens when we turn on computer?

      3 min read

      Process Management

      Introduction of Process Management

      3 min read

      CPU Scheduling in Operating Systems

      7 min read

      Introduction to Process Synchronization

      4 min read

      Solutions to Process Synchronization Problems

      4 min read

      Classical IPC Problems

      2 min read

      Introduction of Deadlock in Operating System

      2 min read

      Handling Deadlocks

      2 min read

      Multithreading in OS - Different Models

      4 min read

      Memory Management

      Introduction to memory and memory units

      2 min read

      Memory Management in Operating System

      5 min read

      Buddy System - Memory Allocation Technique

      4 min read

      Overlays in Memory Management

      4 min read

      Virtual Memory in Operating System

      7 min read

      Page Replacement Algorithms in Operating Systems

      5 min read

      Operating system based Virtualization

      5 min read

      I/O Management

      File Systems in Operating System

      4 min read

      Implementing Directory Management using Shell Script

      3 min read

      Secondary Memory

      7 min read

      Disk Scheduling Algorithms

      9 min read

      Difference between Spooling and Buffering

      5 min read

      Important Links

      Last Minute Notes – Operating Systems

      15+ min read

      Operating System Interview Questions

      15+ min read
    top_of_element && top_of_screen < bottom_of_element) || (bottom_of_screen > articleRecommendedTop && top_of_screen < articleRecommendedBottom) || (top_of_screen > articleRecommendedBottom)) { if (!isfollowingApiCall) { isfollowingApiCall = true; setTimeout(function(){ if (loginData && loginData.isLoggedIn) { if (loginData.userName !== $('#followAuthor').val()) { is_following(); } else { $('.profileCard-profile-picture').css('background-color', '#E7E7E7'); } } else { $('.follow-btn').removeClass('hideIt'); } }, 3000); } } }); } $(".accordion-header").click(function() { var arrowIcon = $(this).find('.bottom-arrow-icon'); arrowIcon.toggleClass('rotate180'); }); }); window.isReportArticle = false; function report_article(){ if (!loginData || !loginData.isLoggedIn) { const loginModalButton = $('.login-modal-btn') if (loginModalButton.length) { loginModalButton.click(); } return; } if(!window.isReportArticle){ //to add loader $('.report-loader').addClass('spinner'); jQuery('#report_modal_content').load(gfgSiteUrl+'wp-content/themes/iconic-one/report-modal.php', { PRACTICE_API_URL: practiceAPIURL, PRACTICE_URL:practiceURL },function(responseTxt, statusTxt, xhr){ if(statusTxt == "error"){ alert("Error: " + xhr.status + ": " + xhr.statusText); } }); }else{ window.scrollTo({ top: 0, behavior: 'smooth' }); $("#report_modal_content").show(); } } function closeShareModal() { const shareOption = document.querySelector('[data-gfg-action="share-article"]'); shareOption.classList.remove("hover_share_menu"); let shareModal = document.querySelector(".hover__share-modal-container"); shareModal && shareModal.remove(); } function openShareModal() { closeShareModal(); // Remove existing modal if any let shareModal = document.querySelector(".three_dot_dropdown_share"); shareModal.appendChild(Object.assign(document.createElement("div"), { className: "hover__share-modal-container" })); document.querySelector(".hover__share-modal-container").append( Object.assign(document.createElement('div'), { className: "share__modal" }), ); document.querySelector(".share__modal").append(Object.assign(document.createElement('h1'), { className: "share__modal-heading" }, { textContent: "Share to" })); const socialOptions = ["LinkedIn", "WhatsApp","Twitter", "Copy Link"]; socialOptions.forEach((socialOption) => { const socialContainer = Object.assign(document.createElement('div'), { className: "social__container" }); const icon = Object.assign(document.createElement("div"), { className: `share__icon share__${socialOption.split(" ").join("")}-icon` }); const socialText = Object.assign(document.createElement("span"), { className: "share__option-text" }, { textContent: `${socialOption}` }); const shareLink = (socialOption === "Copy Link") ? Object.assign(document.createElement('div'), { role: "button", className: "link-container CopyLink" }) : Object.assign(document.createElement('a'), { className: "link-container" }); if (socialOption === "LinkedIn") { shareLink.setAttribute('href', `https://www.linkedin.com/sharing/share-offsite/?url=${window.location.href}`); shareLink.setAttribute('target', '_blank'); } if (socialOption === "WhatsApp") { shareLink.setAttribute('href', `https://api.whatsapp.com/send?text=${window.location.href}`); shareLink.setAttribute('target', "_blank"); } if (socialOption === "Twitter") { shareLink.setAttribute('href', `https://twitter.com/intent/tweet?url=${window.location.href}`); shareLink.setAttribute('target', "_blank"); } shareLink.append(icon, socialText); socialContainer.append(shareLink); document.querySelector(".share__modal").appendChild(socialContainer); //adding copy url functionality if(socialOption === "Copy Link") { shareLink.addEventListener("click", function() { var tempInput = document.createElement("input"); tempInput.value = window.location.href; document.body.appendChild(tempInput); tempInput.select(); tempInput.setSelectionRange(0, 99999); // For mobile devices document.execCommand('copy'); document.body.removeChild(tempInput); this.querySelector(".share__option-text").textContent = "Copied" }) } }); // document.querySelector(".hover__share-modal-container").addEventListener("mouseover", () => document.querySelector('[data-gfg-action="share-article"]').classList.add("hover_share_menu")); } function toggleLikeElementVisibility(selector, show) { document.querySelector(`.${selector}`).style.display = show ? "block" : "none"; } function closeKebabMenu(){ document.getElementById("myDropdown").classList.toggle("show"); }
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Campus Training Program
  • Explore
  • POTD
  • Job-A-Thon
  • Blogs
  • Nation Skill Up
  • Tutorials
  • Programming Languages
  • DSA
  • Web Technology
  • AI, ML & Data Science
  • DevOps
  • CS Core Subjects
  • Interview Preparation
  • Software and Tools
  • Courses
  • ML and Data Science
  • DSA and Placements
  • Web Development
  • Programming Languages
  • DevOps & Cloud
  • GATE
  • Trending Technologies
  • Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
  • Preparation Corner
  • Interview Corner
  • Aptitude
  • Puzzles
  • GfG 160
  • System Design
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences