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 7558725
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T12:26:43+00:00 2026-05-30T12:26:43+00:00

Will the shared memory be corrupted if two programs access it simultaneously, one writing

  • 0

Will the shared memory be corrupted if two programs access it simultaneously, one writing into it and the other one reading from it?

I have two programs, one will get some data from servers and web and save parsed data into the shared memory, and i have a read program, that will read until the last saved data set.

For example, if the first program has collected data from 100 servers and is currently in the 101th server, all the data until the 100th server will be read by the reader program. Once 101th is finished, then reader program will read the 101th data set.
Here data set from a server may have multiple data, like disk space, load etc.
So does this kind of access corrupt the data in the shared memory? Or is it ok the way i do 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-30T12:26:45+00:00Added an answer on May 30, 2026 at 12:26 pm

    What you have described is actually a common computing problem in concurrency called Readers-writers

    If you try to read from the memory while other program is writing to it, you will most likely get corrupted data. You should use one of synchronization primitives (locks, semaphores, monitors…) to ensure this situation will never happen.

    I recommend you to have a look at The Little Book of Semaphores, especially chapter 4.2 Readers-writers problem.

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

Sidebar

Related Questions

I have two programs interacting via a shared memory segment. When using the segment
I have two processes one will query other for data.There will be huge amount
I'm writing a shared memory program that on one side will create a piece
I have a shared memory pool from which many different threads may request an
Is it OK/possible to have a shared memory in a COM object which will
I have a variable named as [ThreadStatic] , will it shared across 2 app
I have a buffer in global memory that I want to copy in shared
I have program that uses shared memory and protects it with semaphore to communicate
I want to implement a one-producer, multiple-consumer model with shared memory in Unix Producer:
I have several blocks, each having some integers in a shared memory array of

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.