

{"id":100390,"date":"2021-09-04T09:00:11","date_gmt":"2021-09-04T03:30:11","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=100390"},"modified":"2021-09-11T11:59:06","modified_gmt":"2021-09-11T06:29:06","slug":"interprocess-communication-in-operating-system","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/interprocess-communication-in-operating-system\/","title":{"rendered":"Interprocess Communication in Operating System"},"content":{"rendered":"<p>Inter-process communication helps exchange data between multiple threads in one (or more) process or program. It doesn\u2019t matter whether the process is running on single or multiple computers (connected by a network). It allows coordination of activities among various program processes running concurrently in an OS.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/09\/Inter-process-communication.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-100505\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/09\/Inter-process-communication.jpg\" alt=\"IPC in OS\" width=\"684\" height=\"191\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/09\/Inter-process-communication.jpg 684w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/09\/Inter-process-communication-520x145.jpg 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/09\/Inter-process-communication-320x89.jpg 320w\" sizes=\"auto, (max-width: 684px) 100vw, 684px\" \/><\/a><\/p>\n<p>This is a set of programming interfaces that allow a program to handle multiple user requests at the same time. As every user request results in multiple processes running in the OS, it is necessary for processes to communicate with each other. There are two types of communications:<\/p>\n<ul>\n<li>First is between related processes. This is initiated by one process only, like parent and child processes.<\/li>\n<li>Second is between unrelated processes. This can be between two or more different processes.<\/li>\n<\/ul>\n<h3>Synchronization in Interprocess Communication<\/h3>\n<p>Synchronization is an important part of IPC that is either handled by the communicating processes or provided by an interprocess control mechanism. Following are some methods that help provide synchronization:<\/p>\n<ul>\n<li><strong>Semaphore:<\/strong> This is a variable that controls access to a common resource through multiple processes and has two types namely, binary and counting.<\/li>\n<li><strong>Mutual Exclusion:<\/strong> In this, only one process thread can enter the critical section at a time. This prevents race conditions.<\/li>\n<li><strong>Barrier:<\/strong> It prevents individual processes from proceeding until all the processes reach it. Some parallel languages and collective routines are the ones that usually impose barriers.<\/li>\n<li><strong>Spinlock:<\/strong> A type of lock for which processes need to wait in a loop while checking if the lock is available or not. This waiting of processes is called busy waiting as processes are not performing any useful operation despite being active.<\/li>\n<\/ul>\n<h3>Approaches in Inter-Process Communication<\/h3>\n<p>Following are some important methods for interprocess communication:<\/p>\n<p><strong>Pipes:<\/strong> This half-duplex method allows communication between two related processes. A half-duplex method allows the first process to communicate with the second process. In order to achieve a full-duplex, we need to add another pipe.<\/p>\n<p><strong>Message Passing:<\/strong> It helps a process communicate and synchronize with each other without resorting to shared variables. IPC provides two operations on message passing, namely, sending a message of either fixed or variable size and receiving a message.<\/p>\n<p><strong>Message Queues:<\/strong> A linked list that stores messages in the kernel and is identified by a message queue identifier. It provides communication between one or many processes with full-duplex capacity.<\/p>\n<p><strong>Direct Communication:<\/strong> This requires processes to name each other explicitly. A single link is then established between a pair of communicating processes.<\/p>\n<p><strong>Indirect Communication:<\/strong> This is established when processes share a common mailbox. Each pair of processes can share multiple communication links. Similarly, one link can communicate with several processes and it can either be bi-directional or unidirectional.<\/p>\n<p><strong>Shared Memory:<\/strong> This is the shared memory between two or more processes, established using shared memory between all the processes. It requires protection from each process that can be achieved through synchronized access among processes.<\/p>\n<p><strong>FIFO:<\/strong> A full-duplex method where the first process can communicate with the second process, and vise-versa. This is communication between two unrelated processes.<\/p>\n<h3>Need of IPC<\/h3>\n<p>Following are the reasons we need IPC<\/p>\n<ul>\n<li>Increases modularity.<\/li>\n<li>It is computational.<\/li>\n<li>Allows privilege separation.<\/li>\n<li>Convenient to use.<\/li>\n<li>Helps OS communicate with each other and in action synchronization.<\/li>\n<\/ul>\n<h3>Terms Used in IPC<\/h3>\n<p>Following are some terms in IPC:<\/p>\n<ul>\n<li><strong>Semaphores:<\/strong> This is a signaling mechanism that either allows or disallows access to resources. This depends on how it is set up.<\/li>\n<li><strong>Signals:<\/strong> This helps set up communication between multiple processes through signals. The destination process recognizes the signal sent by the source process by number and handles it accordingly.<\/li>\n<\/ul>\n<h3>Like FIFO vs Unlike FIFO<\/h3>\n<table style=\"height: 243px;\" width=\"907\">\n<tbody>\n<tr>\n<td><b>LIKE FIFO<\/b><\/td>\n<td><b>UNLIKE FIFO<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Follows FIFO method<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Pulls particular urgent messages before they reach the front<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Is independent of sending and receiving processes<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Ever-ready, there is no need to open or close it<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Data transfer among unrelated processes<\/span><\/td>\n<td><span style=\"font-weight: 400;\">No synchronization problems between open &amp; close<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>Summary<\/h3>\n<p>IPC helps exchange data between multiple threads in one (or more) process or program. It is a set of programming interfaces that allow a program to handle multiple user requests at the same time. Following are the approaches of IPC:<\/p>\n<ul>\n<li>Pipes<\/li>\n<li>Message passing<\/li>\n<li>Message queues<\/li>\n<li>Direct communication<\/li>\n<li>Indirect communication<\/li>\n<li>Shared memory<\/li>\n<li>FIFO<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Inter-process communication helps exchange data between multiple threads in one (or more) process or program. It doesn\u2019t matter whether the process is running on single or multiple computers (connected by a network). It allows&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":100503,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[24565],"tags":[25027,25028,25029],"class_list":["post-100390","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-operating-system-tutorials","tag-interprocess-communication","tag-like-fifo-vs-unlike-fifo","tag-need-of-ipc"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Interprocess Communication in Operating System - DataFlair<\/title>\n<meta name=\"description\" content=\"Learn what is interprocess communication in Operating System. See its need and synchronization in IPC. See Like FIFO vs Unlike FIFO.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/interprocess-communication-in-operating-system\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Interprocess Communication in Operating System - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Learn what is interprocess communication in Operating System. See its need and synchronization in IPC. See Like FIFO vs Unlike FIFO.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/interprocess-communication-in-operating-system\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2021-09-04T03:30:11+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-09-11T06:29:06+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/09\/OS-Inter-process-communication.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Interprocess Communication in Operating System - DataFlair","description":"Learn what is interprocess communication in Operating System. See its need and synchronization in IPC. See Like FIFO vs Unlike FIFO.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/data-flair.training\/blogs\/interprocess-communication-in-operating-system\/","og_locale":"en_US","og_type":"article","og_title":"Interprocess Communication in Operating System - DataFlair","og_description":"Learn what is interprocess communication in Operating System. See its need and synchronization in IPC. See Like FIFO vs Unlike FIFO.","og_url":"https:\/\/data-flair.training\/blogs\/interprocess-communication-in-operating-system\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2021-09-04T03:30:11+00:00","article_modified_time":"2021-09-11T06:29:06+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/09\/OS-Inter-process-communication.jpg","type":"image\/jpeg"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/interprocess-communication-in-operating-system\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/interprocess-communication-in-operating-system\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/b49855299264df5e27e3ec6c2cd9fde9"},"headline":"Interprocess Communication in Operating System","datePublished":"2021-09-04T03:30:11+00:00","dateModified":"2021-09-11T06:29:06+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/interprocess-communication-in-operating-system\/"},"wordCount":701,"commentCount":0,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/interprocess-communication-in-operating-system\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/09\/OS-Inter-process-communication.jpg","keywords":["Interprocess Communication","Like FIFO vs Unlike FIFO","Need of IPC"],"articleSection":["Operating System Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/interprocess-communication-in-operating-system\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/interprocess-communication-in-operating-system\/","url":"https:\/\/data-flair.training\/blogs\/interprocess-communication-in-operating-system\/","name":"Interprocess Communication in Operating System - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/interprocess-communication-in-operating-system\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/interprocess-communication-in-operating-system\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/09\/OS-Inter-process-communication.jpg","datePublished":"2021-09-04T03:30:11+00:00","dateModified":"2021-09-11T06:29:06+00:00","description":"Learn what is interprocess communication in Operating System. See its need and synchronization in IPC. See Like FIFO vs Unlike FIFO.","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/interprocess-communication-in-operating-system\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/interprocess-communication-in-operating-system\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/interprocess-communication-in-operating-system\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/09\/OS-Inter-process-communication.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/09\/OS-Inter-process-communication.jpg","width":1200,"height":628,"caption":"OS Inter-process communicationOS Inter-process communication"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/interprocess-communication-in-operating-system\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"Operating System Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/operating-system-tutorials\/"},{"@type":"ListItem","position":3,"name":"Interprocess Communication in Operating System"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/b49855299264df5e27e3ec6c2cd9fde9","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/ef46b745ddad2fad690af626c6ef29b91809ad0a9f5ef398d07817d8cad042f5?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/ef46b745ddad2fad690af626c6ef29b91809ad0a9f5ef398d07817d8cad042f5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ef46b745ddad2fad690af626c6ef29b91809ad0a9f5ef398d07817d8cad042f5?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"DataFlair Team is a group of passionate educators and industry experts dedicated to providing high-quality online learning resources on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. With years of experience in the field, the team aims to simplify complex topics and help learners advance their careers. At DataFlair, we believe in empowering students and professionals with the knowledge and skills needed to thrive in today\u2019s fast-paced tech industry. Follow us for Free courses, expert insights, tutorials, and practical tips to boost your learning journey.","url":"https:\/\/data-flair.training\/blogs\/author\/datafbdad\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/100390","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=100390"}],"version-history":[{"count":4,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/100390\/revisions"}],"predecessor-version":[{"id":100506,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/100390\/revisions\/100506"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/100503"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=100390"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=100390"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=100390"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}