Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 190813
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T16:17:17+00:00 2026-05-11T16:17:17+00:00

What are the pros and cons of using a file for interprocess communication? Let

  • 0

What are the pros and cons of using a file for interprocess communication? Let me give some background of the context I am asking this question in.

The problem is the classical producer consumer problem with some constraints. The producers are set of cooperative process running on a cluster of machines and communicate with each other using broadcasts. Each process has local users which it knows about and also lets the other processes know about them by the above broadcast mechanism. Till now the state information being broadcasted/shared was not being persisted but now it needs to be.

This system has been running on production for years now supporting thousands of users and folks are understandbly very apprehensive about adding any extra dependency to this to add the support for persistence. The path we chose was to spawn a new thread in the existing process that writes the local traffic to a file on the filesystem which is then read by a new process( lets call it the consumer) and persisted. The advantages we see with this approach are:

  1. We get persistence for free. Incase the new process has issues we are not loosing any of the local traffic as we are writing it to the file system. As long as the consumer knows where it left off, whenever it comes up it can start processing data.
  2. There is no learning curve for using queuing libraries its plain old unix file IO.
  3. The biggest pro is that we dont affect the current producer process at all, except the new thread for file writes.

Some of the concerns with this approach are:

  1. File locking and contention and its affects on performance.
  2. Making sure the write buffers are flushed and producer only releases the file lock once a full event has been written to the file. The consumer should read incomplete records.

Thoughts? Is this approach to naive and should we just pay the initial cost for the ramp up time for using an off the shelf persistent queue library? The main point here being we want to have the minimum possible impact on the current process and add no dependencies to it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T16:17:17+00:00Added an answer on May 11, 2026 at 4:17 pm

    I was faced with this choice recently and considered learning enough about Berkeley DB to use its queue mechanism. But ultimately I decided instead to use the Unix filesystem and write my own atomic queue primitives using Posix semaphores. If all processes are on one machine this is pretty easy. The atomic put function is about a dozen lines of code; the atomic get, because it has to wait if the queue is empty, is about three times the size.

    My advice is that you design an atomic-queue API that will hide these details. (Classic example of following Parnas’s advice of using an interface to hide design details that are likely to change.) You can do the first version of the API using plain Unix file I/O. Then you can try variations like locking, Berkeley DB, or semaphores—all with the “minimum impact on the current process”.

    You won’t know performance impacts until you try something. File locking on real filesystems is pretty good; file locking on NFS is a bear.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What are pros and cons of using a .htc file in CSS?
What are the pros/cons of using black-box reuse over white-box reuse?
What's pros and cons of using Enterprise Library Unity vs other IoC containers (Windsor,
What are the pros and cons of using table aliases in SQL? I personally
What are the pros and cons of using a hosting provider for a Subversion
What are the pros and cons of using Criteria or HQL ? The Criteria
What are the pros and cons of using nested public C++ classes and enumerations?
What are the pros and cons of using System.Security.Cryptography.RNGCryptoServiceProvider vs System.Random . I know
I wish to know all the pros and cons about using these two methods.
I would like to have a reference for the pros and cons of using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.