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

  • Home
  • SEARCH
  • 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 8115267
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T03:24:51+00:00 2026-06-06T03:24:51+00:00

I am programming a server daemon from which users can query data in C.

  • 0

I am programming a server daemon from which users can query data in C. The data can also be modified from clients.

I thought about keeping the data in memory.

For every new connection I do a fork().

First thing I thought about that this will generate a copy of the db every time a connection takes places, which is a waste of memory.

Second problem I have is that I don’t know how to modify the database in the parent process.

What concepts are there to solve these problems?

  • 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-06-06T03:24:54+00:00Added an answer on June 6, 2026 at 3:24 am

    What concepts are there to solve these problems?

    Just a few observations:

    1. fork() only clones the memory of the process it executes at the time of execution. If you haven’t opened or loaded your database at this stage, it won’t be cloned into the child processes.
    2. Shared memory – that is, memory mapped with mmap() and MAP_SHARED will be shared between processes and will not be duplicated.
    3. The general term for communicating between processes is Interprocess communication of which there are several types and varieties, depending on your needs.

    Aside On modern Linux systems, fork() implements copy-on-write copying of process memory. Actually, you won’t end up with two copies of a process in memory – you’ll end up with one copy that believes it has been copied twice. If you write to any of the memory, then it will be copied. This is an efficiency saving that makes use of the fact that the majority of processes alter only a small fraction of their memory as they run, so in fact even if you went for the copy the whole database approach, you might find the memory usage less that you expect – although of course that wouldn’t fix your synchronisation problems!

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

Sidebar

Related Questions

I'm currently in the process of programming a server which can let clients interact
I am programming a http server. There is the main daemon spawning a bunch
I'm programming a client server app. I'm wondering to end the connection, which side
I wanted to ask a question about server data. I am new to server
I'm programming a game which sends the position of the player to the server
Possible Duplicate: File Upload to HTTP server in iphone programming How can i upload
I can still be considered 'new' to web development and server-side programming especially. I
While working in client-server programming, I have passed 3 strings in client, which will
I like to which server side programming is used by website Like if I
I have 4 different application running.so every application can send data to server. now

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.