• Welcome to Overclockers Forums! Join us to reply in threads, receive reduced ads, and to customize your site experience!

Two people accessing the same file?

Overclockers is supported by our readers. When you click a link to make a purchase, we may earn a commission. Learn More.

caddi daddi

Godzilla to ant hills
Jan 10, 2012
How does an operating system handle two people accessing the same file at the same time.
We ran into this at work yesterday, two people had the same file open at the same time, one could modify the file the other could only open and read the file.
how does the operating system know that the file is open on one client when the second tries to open the file?
how does the operating system make one full access and the second read only?
it puts the file being read into read only mode generally if its like a office document or something like that. i run into this at work often because me and our accountant use the same files alot on our server.

when someone opens a file for editing it put a small hidden file next to it that temp holds changes (atleast on word and excel) till the file is saved and closed.

it does that depending on who opens it first.

actually after typing that... i just opened up a .bat file for editing on my server, opened the same .bat file from my pc and its currently open for editing on both machines. im guessing whoever saves changes last wins. lol

i guess it really just depends on the file type, i know you can have multiple people running one installer at the same time because that's how i do updates il go through and run an installer on several pc's at once from the same network location.

because really in the end when you open a file all it does is pulls the information and loads it into your computers memory after that you are no longer accessing the file from disk, like on a file server, say im streaming a movie from my server, and someone else starts streaming the movie in the other room, now, my movie files average 20gb not all that is going to be put in memory but it will read the file piece by piece and load it into the devices memory not only that the server itself stores the files into its memory cache as well, atleast what it can fit. so really its almost never being read by two different machines at the same time when you really think about it.

websites serve the same files to thousands of people at the same time which are just fancy file servers that use different protocols.
reading up on this a little, there is a lot to this, ownership, permissions and a whole lot of other stuff.
There is a way in microsoft office to set up a file so as to allow 2 people to work in the same file as well. This can work well when you are trying to collaborate on a project as long as you know what each other are doing.