Concurrency in Collaborative Editing
Let us explore different methods for conflict resolution in concurrent collaboration on a document.
Introduction
We have discussed the design for a collaborative document editing service, but we have not yet addressed how we will deal with concurrent changes in the document by different users. However, before discussing concurrency issues, we will need to understand (collaborative) text editor.
What is a document editor?
A document is a composition of characters in a specific order. Each character has a value and a positional index. The character can be an alphabet, a number, enter (↵
), or space, whereas an index represents the character’s position within the ordered list of characters.
The job of the text/document editor is to perform operations like insert()
, delete()
, edit()
, etc. on the characters within the document. A depiction of a document and how the editor will perform these operations is provided below.
Concurrency issues
Collaboration on the same document by different users can lead to concurrency issues. Conflicts may arise whenever multiple users edit the same portion of a document. Because users have a local copy of the document, the final status of the document may be different at the server from what the users see at their end. After the server pushes the updated version, users realize the unexpected outcome.
Example 1
Let’s consider a scenario where two users want to add some characters at the same positional index. ...
Create a free account to access the full course.
By signing up, you agree to Educative's Terms of Service and Privacy Policy