this post was submitted on 17 Oct 2023
6 points (80.0% liked)
Programming
17667 readers
244 users here now
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Rules
- Follow the programming.dev instance rules
- Keep content related to programming in some way
- If you're posting long videos try to add in some form of tldr for those who don't want to watch videos
Wormhole
Follow the wormhole through a path of communities [email protected]
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
The format has nothing to do with it. If two processes are writing to the same file at the same time it will be corrupted. You can either figure out a solution with locks (one process requests a lock on the file, the other process has to wait), or look into using SQLite which is most likely a better option if you can.
There are other solutions, such as writing to temp files. If you post more information it will be easier to give you the right advice. Why do more than one process need to write to the same file at the same time?
That's not true. You just need to make sure the processes are writing to disjoint regions of the file. I wouldn't recommend it unless you have a good reason though.
It still can corrupt due to certain factors like writes not immediately being propagated to disk. In theory it's possible just harder than you'd think.