Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm pretty good at programming (made a few apps and done a few internships), but really don't have much experience dealing with the nit & gritty workings of text editors/file systems. Here's some context as to what I'm trying to do:

I want to build a tool where a user can upload or mount any text file, open/edit it in any text editor, and also have another user do the same. Changes between the user would be handled and propagated to each user via this tool.

My initial thoughts were that doing something like this might be impossible because text editors may place a "lock" of some sort on a file, or that they store the file in memory first and then they save it to the disk. I also thought it may be possible to stream the file to the editor and then manipulate that stream...? I'm guessing it also might depend on each text editor and how it works as well.

So I'm wondering if anyone can give me some advice or insight into how text editors go about editing files? Do they load the file into memory like I thought? Is it even feasible to modify that memory once it's loaded, or is that protected?

share|improve this question
Usually this is solved by storing the files in a repository. ( See ). Changes can then be merged, even if different parts of the same file where edited at the same time. If you really need things sane time, try screen and share the terminal. – Hennes Apr 10 '13 at 13:53
Most of your hunches above are right (the editor slurps the file into memory and works there, writing all the time is just too slow; doing a synchronization dance over the network probably worse). If you really need this, I believe Google Docs (whatever it calls itself today) allows collaborative work. Or look for that keyword, it is a vast area of active research right now. Not exactly a weekend project. – vonbrand Apr 10 '13 at 14:03
Thanks so much for the comments guys. I definitely know this isn't going to be a cakewalk. However, what I'm really interested in is how any editor (say VIM or VS) could almost render the file on the fly as another person is using it. Like I said, I can't think of any way to do this automatically without doing insane low level/dangerous memory manipulation. Honestly the more I'm thinking about this, the more difficult I'm starting to realize it will be. However, I'm still curious so any input you guys give is awesome! – GGCO Apr 11 '13 at 3:17

First, most operating systems provide an API to register for notifcations when files change (e.g. on windows - That is useful after the other editor commited changes to disk, an alternative is polling (re-reading the file at predefined periods).

As to memory, accessing other processes' memory is not easy, the usual method is having them cooporate (e.g. by using inter process communication methods).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.