# What is google docs solution to handling multiple users editing and reading at the same time?

I have always been curious as to how google solved the solution of real time collaboration in their google docs product where they allow multiple users to edit and read the same document in real time.

I believe this is very similar to the well known readers and writers problem.

In some of the solutions that i have seen, we would need a mutex of some kind whereby the writers will have exclusive lock to the document itself and readers will not be able to read the document at all.

But in the google docs case, it is quite interesting whereby another user can read the document in real time and two users can both edit the same document at the same time without any conflicts which is very impressive to me.

• This is a question for Google. – Yuval Filmus Oct 19 at 6:24

As a very high-level basic overview, the fundamental idea behind OT is that each collaborator has their own local copy of the document, and the editor infers an operational transformation based on the user's inputs. These transformations can be very simple (insert character x at position y) or more complex (perform an extract method refactoring of the second code block in method foo and name the resulting method bar).