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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T15:38:08+00:00 2026-05-28T15:38:08+00:00

I am writing a component in C which will be used by several different

  • 0

I am writing a component in C which will be used by several different processes all accessing the same file.

Each process will be accessing different parts of the file at the same time, mostly for reading but also for writing.

I am trying to figure out if the correct way is:

Opition A:
For each process to call CreateFileMapping once for the entire file and then use MapViewOfFile multiple times on different sections to access the parts it needs, meaning if I have 10 sections I wish to access I will call CreateFileMapping once for the whole file, end to end, and then MapViewOfFile 10 times, once for each part of the file.

OR

Option B:
For each process to call CreateFileMapping & MapViewOfFile on each specific section it wishes to access, meaning if I have 10 sections I wish to access I will call CreateFileMapping & MapViewOfFile each 10 times.

Thanks!

  • 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-28T15:38:08+00:00Added an answer on May 28, 2026 at 3:38 pm

    You will definitely need to call CreateFileMapping and MapViewOfFile at least once per process in order to access the data. However you don’t need to call them more than that once. Of course, if the mapping themselves are large, you might want to unmap and remap to save virtual address space, but if the amount of data is not that large you can skip this.

    Having mapped your file mapping, your process sees the data directly. Reading and writing operations occur instantly and in order to serialize access and prevent from thread racing conditions you need to use Interprocess Communication, such as semaphores.

    Something you might want to read and study sample code: Shared Memory. Also try a google search for MapViewOfFile + WaitForMultipleObjects for more information.

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

Sidebar

Related Questions

i'm writing a component that is to be used across multiple websites. each website
I am writing a component for a web app which will display some html,
I am working on a program which consists of two parts Service component will
I'm writing a c# component that will only be used internally at my company.
I'm writing and testing a ClassLoader component, which can be instantiated many times, with
I am writing a component that, given a ZIP file, needs to: Unzip the
I'm writing a wide component infrastructure, to be used in my projects. Since not
I'm writing a custom file selection component. In my UI, first the user clicks
Im writing a C# class library component which is going to act as a
I'm writing a rack middleware component for a rails app that will need to

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.