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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T16:01:00+00:00 2026-06-12T16:01:00+00:00

What are good algorithms to keep consistency in multiple files? This is a school

  • 0

What are good algorithms to keep consistency in multiple files?

This is a school project. I have to implement in C, some replication across a network.

I have 2 servers,

Server A1
Server A2

Both servers have their own file called “data.txt”

If I write something to one of them, I need the other to be updated.

I also have another scenario, with 3 Servers.

Server B1
Server B2
Server B3

I need these do do pretty much the same.

While this would be fairly simple to implement. If one, or two of the servers were to be down, When comming back up, they would have to update themselves.

I’m sure there are algorithms that solve this efficiently. I know what I want, I just don’t know exactly what I’m looking for!

Can someone point me to the right direction please?

Thank you!

  • 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-12T16:01:02+00:00Added an answer on June 12, 2026 at 4:01 pm

    The fundamental issue here is known as the ‘CAP theorem‘, which defines three properties that a distributed system can have:

    • Consistency: Reading data from the system always returns the most up-to-date data.
    • Availability: Every response either succeeds or fails (doesn’t just keep waiting until things recover)
    • Partition tolerance: The system can operate when its servers are unable to communicate with each other (a server being down is one special case of this)

    The CAP theorem states that you can only have two of these. If your system is consistent and partition tolerant, then it loses the availability condition – you might have to wait for a partition to heal before you get a response. If you have consistency and availability, you’ll have downtime when there’s a partition, or enough servers are down. If you have availability and partition tolerance, you might read stale data, or have to deal with conflicting writes.

    Note that this applies separately between reads and writes – you can have an Available and Partition-Tolerant system for reads, but Consistent and Available system for writes. This is basically a master-slave system; in a partition, writes might fail (if they’re on the wrong side of a partition), but reads will work (although they might return stale data).

    So if you want to be Available and Partition Tolerant for reads, one easy option is to just designate one host as the only one that can do writes, and sync from it (eg, using rsync from a cron script or something – in your C project, you’d just copy the file over using some simple network code periodically, and do an extra copy just after modifying it).

    If you need partition tolerance for writes, though, it’s more complex. You can have two servers that can’t talk to each other both doing writes, and later have to figure out what data wins. This basically means you’ll need to compare the two versions when syncing and decide what wins. This can just be as simple as ‘let the highest timestamp win’, or you can use vector clocks as in Dynamo to implement a more complex policy – which is appropriate here depends on your application.

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

Sidebar

Related Questions

I have a good basis on Evolutionary Algorithms, so now i started to read
I've been struggling to wrap my head around this for some reason. I have
Continuing from this thread: What are good algorithms for vehicle license plate detection? I've
I have a module which does some non constrained minimization. I'd like to keep
What are some good algorithms for automatically labeling text with the city / region
I need a recommendation for a good learning resource on drawing algorithms. I've found
After learning good amount of c++, i'm now into STL containers and algorithms template
Does anyone have a good algorithm to calculate what date Good Friday falls on
I am willing to ask if anyone has some good algorithm (or ways) to
I'm trying to understand the Select algorithm and I came across a good pivot

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.