A New Operational Transformation Framework For Real-Time Group Editors

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 13

IEEE TRANSACTIONS ON PARALLEL AND DISTRIBUTED SYSTEMS, VOL. 18, NO.

3, MARCH 2007 307

A New Operational Transformation Framework


for Real-Time Group Editors
Rui Li, Student Member, IEEE, and Du Li, Member, IEEE

Abstract—Group editors allow a group of distributed human users to edit a shared multimedia document at the same time over a
computer network. Consistency control in this environment must not only guarantee convergence of replicated data, but also attempt to
preserve intentions of operations. Operational transformation (OT) is a well-established method for optimistic consistency control in
this context and has drawn continuing research attention since 1989. However, counterexamples to previous works have often been
identified despite the significant progress made on this topic over the past 15 years. This paper analyzes the root of correctness
problems in OT and establishes a novel operational transformation framework for developing OT algorithms and proving their
correctness.

Index Terms—Consistency control, group editors, groupware, operational transformation.

1 INTRODUCTION

G ROUP editors are a classic model and research vehicle


for distributed interactive groupware applications
because they typically manipulate shared data in a
The remainder of this paper is organized as follows:
Section 2 gives background on OT algorithms and motivates
this research. Section 3 formalizes the operation effects
coordinated manner [5]. Operational transformation (OT) relation and a consistency model. Section 4 establishes the
has been well accepted in group editors for achieving sufficient conditions of transformation functions. Section 5
optimistic consistency control [6], [19]. OT allows local shows how to choose the right transformation paths. Section 6
operations to execute in a nonblocking manner to achieve gives an example of the algorithm. Section 7 summarizes
high local responsiveness and unconstrained collaboration. the contributions and future directions of this work.
Remote operations are transformed before they are executed
such that inconsistencies are repaired.
Despite the significant progress that has been achieved 2 BACKGROUND AND MOTIVATION
over the past 15 years, a notable fact in the history of OT is 2.1 Background on Group Editors and OT
that the discovery and solution of various OT puzzles (i.e.,
Following the established conventions [6], we model the
correctness problems in previous OT algorithms) have been a
shared data as a linear string s. Let the position of the first
main driver of research [10], [17], [19]. In our opinion, character in any nonempty string be zero. Assume that every
however, the existence of OT puzzles can be largely appearance of any character has a different object id. Note
attributed to the lack of a suitable theoretical framework for that this assumption only serves analysis purposes and we
guiding the design and verification of OT algorithms. More do not really need object ids for characters in actual
specifically, the well-established frameworks [14], [16], [17], implementation. In this paper, a “character” refers to the
[20] rely on conditions that are difficult to verify in practice object that carries the character, whose ASCII code is
and do not address how to develop correct OT algorithms. possibly only one of its attributes. If c is the ith character in
In this paper, we propose a novel OT framework to any nonempty string s, we say s½c ¼ i and c ¼ s½i. For
address this weakness of previous work. Based on a concept convenience, we also use s to denote the set of characters in s.
called “operation effects relation,” we define two criteria, For simplicity, we only consider two primitive opera-
causality preservation and operation effects relation pre- tions: insðp; cÞ, which inserts a character c at position p, and
servation, for verifying the correctness of OT algorithms. delðpÞ, which deletes the character at position p. Apparently,
Our framework comes with a practicable approach to
the position parameter p of any operation o is defined
developing and proving OT algorithms. In this approach,
relative to some state s. If o is generated in s, then s is called
the sufficient conditions for transformation functions are
first identified and a special transformation path is chosen its generation state. If o is executed in s, then s is called its
to satisfy those conditions. Thus, the correctness of the execution state. Due to concurrency, an operation’s execution
whole algorithm is guaranteed. state is not necessarily equivalent to its generation state if
the operation is executed at a remote site [19].
Given operation o, function posðoÞ returns its position
. The authors are with the Department of Computer Science, Texas A&M value, typeðoÞ returns its operation type (ins or del), charðoÞ
University, College Station, Texas 77843-3112. returns the effect character to be inserted or deleted, idðoÞ
E-mail: ruili@neo.tamu.edu, lidu@cs.tamu.edu.
returns the id of the site that generates o, gstðoÞ denotes its
Manuscript received 17 Jan. 2005; revised 12 Aug. 2005; accepted 23 Mar. generation state, and estðoÞ denotes its execution state. The
2006; published online 25 Jan. 2007.
Recommended for acceptance by P. McKinley.
fact that the execution of o in state s yields s0 is denoted by
For information on obtaining reprints of this article, please send e-mail to: execðs; oÞ ¼ s0 . As in [6], [13], [20], we use two long-
tpds@computer.org, and reference IEEECS Log Number TPDS-0036-0105. established relations without further definition: For any
1045-9219/07/$25.00 ß 2007 IEEE Published by the IEEE Computer Society
308 IEEE TRANSACTIONS ON PARALLEL AND DISTRIBUTED SYSTEMS, VOL. 18, NO. 3, MARCH 2007

in which user interface effects are not interesting. Hence,


convergence often suffices and can be achieved by enfor-
cing a total order of writes. However, the example in Fig. 1
reveals that serialization may violate the operation inten-
tions, e.g., when o2 is executed after o1 as it is.
The general assumption underlying interactive group-
ware applications, such as group editors, is that users are
aware of the changes made by collaborators and are able to
discover and resolve semantic conflicts (e.g., grammatic
errors) in a timely manner [6], [7], [20]. Hence, the OT
Fig. 1. OT transforms o2 and then executes o02 . algorithms generally do not consider reads. Writes are often
distinguished as two primitive operations, insert and delete,
two operations o1 and o2 , o1 ! o2 iff o1 happened before o2 for creating new objects and removing existing objects. This
and o1 k o2 iff o1 is concurrent with o2 . distinction of writes makes it possible to achieve a high
The basic idea of OT is to execute any local operation as level of concurrency while reducing the chance of operation
soon as it is generated for high local responsiveness. Remote conflicts and overwriting.
operations are transformed against concurrent operations The main purpose of Internet-based productivity appli-
that have been executed locally before its execution. A cations, such as group editors, is to promote the productiv-
history buffer HB is maintained at each site to keep track of ity of human users as a group. It is accepted in this context
all executed operations in their order of execution. that high local responsiveness and high concurrency are
As a simple example, consider the scenario in Fig. 1. conducive to individual and group productivity [6], [20].
Suppose two sites start from the same initial state s01 ¼ s02 ¼ Traditional consistency control methods such as locking
‘‘ab:’’ Site 1 performs o1 ¼ insð1; ‘x’Þ to insert character ‘x’ and serialization [3] generally sacrifice responsiveness and
concurrency when they are pessimistic and may cause the
before ‘b’, yielding s11 ¼ execðs01 ; o1 Þ ¼ ‘‘axb; ’’ while site 2
loss of interaction results when optimistic. OT seems a
concurrently performs o2 ¼ delð1Þ to delete character ‘b’, promising consistency control method that is able to
yielding s12 ¼ execðs02 ; o2 Þ ¼ ‘‘a:’’ When o2 ¼ delð1Þ arrives at achieve high responsiveness, high concurrency, and con-
site 1, if it is executed as it is, then the wrong character ‘x’ will vergence while preserving interaction results and operation
be deleted. This is because o2 is generated in s02 without the intentions [20].
knowledge of o1 , but its execution state s11 has been changed Preserving the interaction results of all collaborators does
by the execution of o1 , which invalidates its position not necessarily lead to a chaotic system. The results can be
parameter. The intuition of OT [6] is to shift the position of presented to users, e.g., in different colors and multiple
o2 to incorporate the effect of o1 such that the result o02 can be versions [21], which is essentially a user interface problem
and beyond the scope of this paper. However, the system
correctly executed in state s11 . This process is called inclusion
should do as much work as it can to reduce the cognitive
transformation (IT) [20]. overheads of users. That is, the data replicas must
Because a character has been inserted by o1 on the left of eventually converge (after all generated operations are
its intended position, o2 should delete the character cur- executed at all sites) and the converged final state must be
rently at position 2 instead of 1, i.e., o02 ¼ ITðo2 ; o1 Þ ¼ delð2Þ. somehow constrained, e.g., by preserving causality and
The execution of o02 in s11 leads to the correct state s21 ¼ ‘‘ax; ’’ operation intentions [20].
which is identical to the final state at site 2 after o2 and o1 are
executed in tandem. As a result, OT seems able to achieve 2.3 Previous OT Frameworks
convergence and preserve intentions of operations despite A framework consists of a theory, which defines a
the different orders of execution at different sites. consistency model of the system, and a technical approach,
Another type of transformation function is called which guides the development of algorithms that fulfill the
exclusion transformation (ET) [20]. In the above example, model. Two OT frameworks have been proposed in the
given o1 defined in s01 and o02 defined in s11 ¼ execðs01 ; o1 Þ, literature.
ETðo02 ; o1 Þ excludes the effect of o1 from o02 as if o1 had not The first OT framework is established in Ressel et al.
been executed in s01 . The result o2 ¼ ETðo02 ; o1 Þ ¼ delð1Þ is [14]. In the theory part, it formalizes two consistency
exactly the execution form of o2 as defined relative to s01 . criteria, causality preservation and convergence (CC). In the
It has been generally accepted [19] that each OT approach part, it proves that any OT-based algorithm can
algorithm consists of two parts: a set of transformation achieve convergence in the presence of arbitrary transfor-
functions (such as IT and ET) that determine how one mation paths if its IT function satisfies two properties, as
operation is transformed against another and a control defined below:
procedure that determines how an operation is transformed
against a given operation sequence (e.g., the history buffer). Definition 1. Given three concurrent operations o1 , o2 , and o3
The control procedure is also responsible for generating and that are defined in the same state s, let o01 ¼ ITðo1 ; o2 Þ and
propagating local operations as well as executing remote o02 ¼ ITðo2 ; o1 Þ. TP1 and TP2 are defined as follows:
operations.
TP1: execðs; ½o1 ; o02 Þ ¼ execðs; ½o2 ; o01 Þ.
2.2 Convergence in Group Editors TP2: ITðITðo3 ; o1 Þ; o02 Þ ¼ ITðITðo3 ; o2 Þ; o01 Þ.
Most existing consistency control methods, e.g., [1], [3], [23], TP1 originally appears in [6] and TP2 is first discussed in
[24], are motivated in traditional noninteractive applications [8]. TP1 ensures that, if o1 k o2 , the effect of executing o1
LI AND LI: A NEW OPERATIONAL TRANSFORMATION FRAMEWORK FOR REAL-TIME GROUP EDITORS 309

before o2 is the same as executing o2 before o1 . TP2 ensures 3 THE CONSISTENCY MODEL
that transforming any operation o3 along different paths, As revealed in Example 1, the main problem of the
½o1 ; o02  and ½o2 ; o01 , will yield the same result. These two established CCI model [17], [20] is that it only considers
properties ensure that arbitrary transformation paths can the “intentions” or effects of single operations in their
lead to a consistent final state. In other words, it is not generation states while failing to capture a global picture of
necessary to enforce a global total order between operations the whole system. Conversely, if a global picture was
in order to achieve convergence because divergence can present when transforming the two operations, o1 and o2 ,
always be repaired by operational transformation. we would know how to correctly determine the relation
The CC framework has influenced most of the OT between their effect characters, ‘x’ and ‘y.’
We address this problem by introducing a new concept
algorithms developed since it was proposed in 1996,
of effects relation  to denote the order between characters.
including adOPTed [14], GOT [20], GOTO [19], [17], [4],
In Example 1, we have ‘b’  ‘x’  ‘c’ when o1 is generated
NICE [15], SOCT [16], [22], TIBOT [12], and SDT [9], [10], as
and ‘a’  ‘y’  ‘b’ when o2 is generated. Then, by transitiv-
they more or less struggle on the TP2 condition. Influential
ity, we infer ‘y’  ‘x’ based on which we can always
as it is, this framework is flawed in the following ways: correctly transform o1 and o2 . In this way, we can model
First, the consistency model does not explicitly constrain both effects of single operations and the relation between
convergence. Hence, it is theoretically acceptable in the effects of concurrent operations.
model that the system always converges in an empty state Our early result, as presented in [10], [11], introduced but
no matter what the users do. Second, in the technical did not rigorously formalize the concept of effects relation.
approach part, TP1 and TP2 are only for constraining IT. As Additionally, it was developed under the influence of CCI
revealed later [16], [17], [19], [20], ET is conceptually an and still strived to satisfy TP1 and TP2. Nevertheless, the
inverse of IT and indispensable for implementing group TP2 proofs in [11] are very complicated although they only
undo and building transformation paths. However, the CC treat two characterwise primitives. How to scale the proofs
framework does not constrain ET. Additionally, it does not to handle more sophisticated string operations [20] is still an
provide guidelines on how to develop IT functions that open problem. Related works in [12], [15], [20], [22] free TP2
satisfy TP2. In fact, TP2 had never been verified until in our by enforcing a unique transformation path. However, they
recent work [9], [10], [11]. are developed under the CCI framework and must verify
The second framework is established in Sun et al. [20] the condition of intention preservation as required in CCI.
with three consistency criteria: causality preservation, The purposes of the present paper are two-fold: First, we
convergence, and intention preservation (CCI). The inten- will present a rigorous definition of the effects relation.
tion preservation condition is the first attempt in the Second, we will explore a more practicable approach that no
literature to explicitly constrain convergence in interactive longer requires the verification of TP1 and TP2.
groupware. Due to its intuitiveness, this model has been 3.1 Effects Relation
well-accepted in group editors, such as [2], [4], [16], [18],
Suppose there is an observer to the system (group editor)
[22]. However, Sun et al. did not clearly formalize exactly
who observes the progress (every operation execution) at
what is intention-preserving and what is not in the original
each site. A virtual global data structure  is maintained to
work [20] and its main follow-up [17]. Hence, it is difficult indicate the effects relation  .  is initialized by the initial
to evaluate the correctness of OT algorithms under the CCI system state s0 and incrementally updated by the execution
framework. of operations. Before we define rules for initializing and
Example 1. A well-known controversial scenario follows: updating , we study the order in which  is updated.
Suppose three sites start from the same initial state “abc”. Note that the same operation is invoked to update 
Concurrently, site 1 performs o1 ¼ insð2; ‘x’Þ to insert ‘x’ multiple times because it is executed once at every site in
between ‘b’ and ‘c’, site 2 performs o2 ¼ insð1; ‘y’Þ to the system. Hence, we have to examine these invocations at
insert ‘y’ between ‘a’ and ‘b,’ and site 3 performs o3 ¼ the event level. An allowed updating path is a sequence of
delð1Þ to delete ‘b.’ Intuitively, the only correct final operations (invocations), o1 ; o2 ; . . . ; on , in which, for any two
result must be “ayxc.” However, result “axyc” is also operations oi and oj , oi precedes (or is invoked before) oj ,
referred to as intention-preserving in [20]. 1  i < j  n, iff one of the following conditions holds: 1) oi
is executed earlier than oj at the same site, 2) oi is the local
In the technical approach part of [17], the CCI framework
execution and oj is a remote execution of the same
inherits the TP1 and TP2 constraints on IT, while still not
operation, or 3) there exists another execution ok such that
providing guidelines for developing such IT functions. It oi precedes ok and ok precedes oj .
also defines several constraints that relate IT and ET, e.g., We annotate  with a superscript to denote its incre-
reversibility and transpose properties. However, ET is mental construction process. 0 contains the initial effects
treated as a second-class citizen and no standalone relation: For any two characters ci ; cj 2 s0 , we add pair
constraints are defined. As an important contribution, Sun < ci ; cj > or ci  cj into 0 iff s0 ½ci  > s0 ½cj . Given any
et al. [20], [17] define the precondition of ITðo1 ; o2 Þ as updating path P ¼ ½o1 ; o2 ; . . . ; on , the execution of oi
estðo1 Þ ¼ estðo2 Þ and the precondition of ETðo1 ; o2 Þ as updates i1 to i , where 1  i  n. For convenience, we
estðo1 Þ ¼ execðestðo2 Þ; o2 Þ. However, these two conditions assume that there are two invisible characters: cb and ce in
are not really sufficient, as will be illustrated later in any state s such that s½cb  ¼ 1 and s½ce  ¼ jsj and, for any
Examples 3 and 4 in Section 4. visible character c 2 s, we have cb  c  ce .
310 IEEE TRANSACTIONS ON PARALLEL AND DISTRIBUTED SYSTEMS, VOL. 18, NO. 3, MARCH 2007

Assume the execution of any operation o in its generation executing o1 , Site 3 generates o3 ¼ insð1; ‘z’Þ to get “azxb”.
state s is “correct.” If o ¼ insðp; cÞ, it inserts a new character We have o1 k o2 , o1 ! o3 and o2 k o3 . Suppose an
c between two existing characters s½p  1 and s½p. Hence, updating path is ½o1 ; o3 ; o2 . The question is how to
we add two pairs < s½p  1; c > and < c; s½p > into . On determine the order between ‘y’ and ‘z’ and the order
the other hand, if o ¼ delðpÞ, it deletes the existing character between ‘y’ and ‘x’. If we directly compared their site ids,
s½p. Its execution does not change the ordering between we would get ‘y’  ‘z’ and ‘x’  ‘y; ’ which violates the
existing characters. Hence, all pairs in  carry over. established order of ‘z’  ‘x’. By Rule 5, to determine the
Obviously, 0 defines a total order over all characters in order between ‘y’ and ‘z,’ we first determine the order
s0 . We would like  to be maintained as a total order over between ‘y’ and ‘x,’ which is ‘x’  ‘y’ by Rule 5b. Then,
all characters that have appeared in the system upon every by transitivity (Rule 5a), we infer ‘z’  ‘x’  ‘y:’ Hence,
update. To achieve this, we require that 1) every execution the final result must be “azxyb.”
of a deletion deletes the character it intended at its Theorem 1. The effects relation  is a total order.
generation state and 2) only insertions at their generation
states introduce new pairs while any remote execution of an Definition 3 (Landmark Characters). For any two characters
ci and cj that are originally inserted by oi and oj , respectively,
insertion does not introduce pairs that contradict existing
character c is a landmark character between them iff 1) ci 
pairs in . Therefore, we only need to consider the local
c  cj or cj  c  ci and 2) c 2 s0 or the operation that
execution of insertions when we define the effects relation.
originally inserted c happened before at least one of oi and oj .
Definition 2 (Effects Relation). Assume 0 is initialized from The set of the landmark characters between ci and cj is denoted
the system initial state s0 by adding ci  cj into 0 for any ci by Cld ðci ; cj Þ.
and cj such that s0 ½ci  < s0 ½cj . Given an updating path P ,
assume j1 is a total order produced by the first j  1 exec- For example, in the scenario of Example 1, let c1 ¼ ‘x’
utions in P . Now, we consider how the jth execution oj and c2 ¼ ‘y’. By Definition 2, the set of landmark characters
extends j1 into j . Without loss of generality, assume oj ¼ between them is Cld ðc1 ; c2 Þ ¼ f‘b’g. In some updating paths,
insðpj ; cj Þ is an insertion to be executed in its generation state such as ½o3 ; o1 ; o2 , when o2 is transformed with o1 , the
s. Suppose cj is to be inserted between  ¼ s½pj  1 and landmark character ‘b’ is not present in the current state.
 ¼ s½pj . Let  be the set of characters that appear in j1 . This causes tie-breaking problems in previous work such as
Let B ¼ fg [ fc 2 jc  g, A ¼ fg [ fc 2 j  cg, GOTO [19], which will be further explained in Example 3.
and D ¼   A  B ¼ fc 2 j  c  g. For any charac- The concept of landmark character will be used in our
ter ci 2 , we decide the relation between ci and cj by the correctness analyses. The reason we exclude operations
following rules and add the new relation to j : that are concurrent with, or are generated after, both oi and
oj is that, due to causality, the effects relation between ci
1. if ci 2 B, then ci  cj ; and cj should not depend on the effects of those operations.
2. if ci 2 A, then cj  ci ; By the following lemma, landmark characters will play
3. if ci 2 D and ci 2 s0 , we mandate cj  ci ; an important role in determining the effects relation of
4. if ci 2 D and ci 62 s0 , assuming ci is originally operations:
inserted by oi and oi ! oj , we mandate cj  ci ; and
Lemma 1. Suppose that two characters, ci and cj , are originally
5. if ci 2 D and ci 62 s0 , assuming ci is originally
inserted by oi and oj , respectively, and that oi precedes oj in
inserted by oi and oi k oj , we first (recursively) derive
an updating path and ci 62 gstðoj Þ. If Cld ðci ; cj Þ ¼ ;, then we
the relation between cj and every character c 2 D,
only need Rules 4 and 5b to determine the relation between ci
where c 2 s0 or c is originally inserted by some o such
and cj .
that o ! oi or o ! oj , and then consider the following
rules: 3.2 Correctness Criteria
a. if there exists c in D such that either ci  c  cj A quiescent state in a group editor means all generated
operations have been executed at all sites [6]. System
or cj  c  ci is implied, then we add ci  cj or
consistency requires not only that all sites have the same set
cj  ci accordingly;
of objects (characters), but also that all these objects are
b. if no such relation can be inferred, we mandate
ordered the same way. Based on the above notion of effects
ci  cj if idðoi Þ < idðoj Þ, or cj  ci if otherwise.
relation, we define the following correctness conditions:
In the above definition, rules 1 and 2 are straight-
Definition 4 (Correctness Criteria). A group editor is correct
forward. Rules 3 and 4 are to mandate an order between cj
if it always maintains the following two properties:
and those that have been deleted before oj is generated in
state s. Rule 5 conceptually breaks ties between two 1. Causality preservation: For any two operations o1
characters that are inserted concurrently between the same and o2 , if o1 ! o2 , then o1 is executed before o2 at all
two characters. It appears complicated because the ties sites.
cannot be safely broken by simply comparing their site ids 2. Effects relation preservation: The effects relation is
directly, as is illustrated by the following example: preserved at every operation execution.
Example 2. Suppose three sites start from s0 ¼ ‘‘ab:’’ By Causality preservation is a fundamental criterion in
definition,  is initialized to include ‘a’  ‘b:’ Site 1 typical distributed systems as well as group editors [6],
generates o1 ¼ insð1; ‘x’Þ to get “axb” and, concurrently, [14], [16], [20]. The effects relation preservation as a system-
Site 2 generates o2 ¼ insð1; ‘y’Þ to get “ayb”. After specific measure constrains convergence in a group editor
LI AND LI: A NEW OPERATIONAL TRANSFORMATION FRAMEWORK FOR REAL-TIME GROUP EDITORS 311

and its behavior. It is easy to show that a correct group editor number at that site. Due to the established state vector
converges in any quiescent state because all sites have the maintenance protocol [6], [20], no two different operations
same set of characters that are ordered in the same way. share the same key value. Unlike posðoÞ, the value of keyðoÞ
Corollary 1. Any correct group editor converges in quiescent does not change. Since each operation has a unique effect
states. character, charðoÞ can be safely replaced by keyðoÞ in
algorithm implementation. The relation ER is implemented
In the following, we further study how to constrain all as a hash table, which stores pairs of operation keys: We
the possible states and operation executions in a group infer charðox Þ  charðoy Þ if pair < keyðox Þ, keyðoy Þ > is
editor: found in ER, or equivalently, < charðox Þ, charðoy Þ >2 ER.
In this section, we define the IT/ET functions based on
Definition 5 (Reachable States). Any state s is reachable iff,
relation  and study sufficient conditions under which
for any c1 ; c2 2 s, if s½c1  > s½c2 , then c1  c2 .
relation  can be correctly determined using only local
Conceptually, a reachable state is such that the ordering information stored in ER and HB and the basic operation
of its characters is consistent with the effects relation. parameters posðoÞ, idðoÞ, and typeðoÞ.

Definition 6 (Admissible Operations). Given an operation o 4.1 Inclusion Transformation and Correctness
that is defined in a reachable state s, i.e., s ¼ estðoÞ, we say o The purpose of o01 ¼ ITðo1 ; o2 Þ, where s ¼ estðo1 Þ ¼ estðo2 Þ
is admissible in s iff one of the following conditions holds: and s0 ¼ execðs; o2 Þ, is to incorporate the effect of o2 into o1
1) typeðoÞ ¼ del and the execution of o in s only leads such that the result o01 can be correctly executed in state s0 .
charðoÞ to be deleted, 2) typeðoÞ ¼ ins and s ¼ gstðoÞ, or As defined in Algorithm 1, we first call Algorithm 2
3) typeðoÞ ¼ ins, s 6¼ gstðoÞ, and for any c 2 s: posðoÞ  s½c (get_er_IT) to determine the effects relation of o1 and o2 and
iff charðoÞ  c or s½c < posðoÞ iff c  charðoÞ. then use this relation to decide how to compute o01 .

Intuitively, when executing a deletion, the system should Algorithm 1 ITðo1 ; o2 Þ: o01
not delete any character that is not intended by the original 1: get er ITðo1 ; o2 Þ
operation; when executing an insertion, the new character 2: if charðo1 Þ ¼ charðo2 Þ then
ordering should not violate the effects relation definition. 3: return o01  {//  means identity operation }
As an example of admissible operations, consider the 4: else
execution of o1 and o2 in Fig. 1. At site 1, if o02 ¼ delð2Þ is 5: o01 o1
executed, it is not admissible because it targets the wrong 6: if charðo2 Þ  charðo1 Þ then
character. At site 2, if o01 ¼ insð0; ‘x’Þ is executed instead, 7: if typeðo2 Þ ¼ ins then
then ‘x’ is inserted at the wrong position, which violates the 8: posðo01 Þ posðo1 Þ þ 1
effects relation established by o1 when it is generated. 9: else { // typeðo2 Þ ¼ del }
Lemma 2. If o is admissible in a reachable state s, then s0 ¼ 10: posðo01 Þ posðo1 Þ  1
execðs; oÞ is reachable. 11: end if
Lemma 3. Given an admissible operation o in a reachable state s, 12: end if
if o ¼ delðpÞ, we have charðoÞ ¼ s½p, or if o ¼ insðp; cÞ, we 13: return o01
have s½i  c  s½j for any i and j such that 1  i < p and 14: end if
p  j  jsj. Recall that s½cb  ¼ 1 and s½ce  ¼ jsj. If charðo1 Þ  charðo2 Þ, it means that charðo2 Þ is on the right
side of charðo1 Þ and the execution of o2 does not affect o1 .
Based on the concept of admissible operations, we may Hence, o1 is returned as it is. In the case of charðo2 Þ  charðo1 Þ,
further simplify the verification of system correctness by the however, if o2 inserted a character on the left of charðo1 Þ, the
following lemma: position of o1 should be increased by one, or if o2 deleted a
Lemma 4. If every operation a system executes is admissible, the character on the left, the position of o1 should be decreased
system preserves the effect relation. by one.
Assuming that every insertion introduces a new char-
acter, it is impossible that o1 has the same effect character as
4 TRANSFORMATION FUNCTIONS AND CONDITIONS another operation o2 . However, two concurrent deletions
The concept of effects relation lays a theoretical foundation may intend to delete the same existing character. To handle
for analyzing system behavior. However, it relies on a this situation, we adopt a policy in which this character is
global data structure that is expensive to maintain in only deleted once. The deletion received later is trans-
practice. Here, we explore an approach that only uses local formed into an identity operation , which will not be
information. More specifically, each site maintains a local executed. This corresponds to lines 1-2 in Algorithm 1 and
history buffer HB for recording operations in their lines 8-9 in Algorithm 2.
execution order and a local table ER for recording the
derived effects relation. The effects relation is derived only Algorithm 2 get er ITðo1 ; o2 Þ: relation of charðo1 Þ and
by information in HB and ER. charðo2 Þ
We use operation keys to uniquely identify operations. 1: return the relation if it is found in ER
The key of any operation o, denoted by function keyðoÞ, is a 2: er charðo2 Þ  charðo1 Þ
pair of the id of its generation site idðoÞ and its sequence 3: if posðo1 Þ < posðo2 Þ then
312 IEEE TRANSACTIONS ON PARALLEL AND DISTRIBUTED SYSTEMS, VOL. 18, NO. 3, MARCH 2007

4: er charðo1 Þ  charðo2 Þ Since Cld ðcharðo1 Þ; charðo2 ÞÞ ¼ ;, from Definition 2, we


5: else if posðo1 Þ ¼ posðo2 Þ then can deduce the relation between charðo1 Þ and charðo2 Þ by
6: if typeðo1 Þ ¼ typeðo2 Þ ¼ ins ^ idðo1 Þ < idðo2 Þ then comparing site ids. From get_er_IT(), if posðo1 Þ ¼ posðo2 Þ
7: er charðo1 Þ  charðo2 Þ in state s, we break the tie by comparing site ids, the
8: else if typeðo1 Þ ¼ typeðo2 Þ ¼ del then result of which is consistent with that by Definition 2. tu
9: er charðo1 Þ ¼ charðo2 Þ Lemma 6. get er ITðo1 ; o2 Þ is correct if
10: else if typeðo1 Þ ¼ ins ^ typeðo2 Þ ¼ del then
11: er charðo1 Þ  charðo2 Þ typeðo1 Þ ¼ typeðo2 Þ ¼ del:
12: end if
Proof. Since both o1 , o2 are admissible deletions, charðo1 Þ
13: end if
and charðo2 Þ must be both present in s. Hence, by
14: record er in ER
Lemma 3, we can determine their relation by comparing
15: return er
posðo1 Þ ¼ s½charðo1 Þ and posðo2 Þ ¼ s½charðo2 Þ. In parti-
We define Algorithm 2 for determining the effects cular, if posðo1 Þ ¼ posðo2 Þ, they must be referencing the
relation between any two given operations. It returns the same character, i.e., charðo1 Þ ¼ charðo2 Þ. u
t
relation if it has already been recorded in ER. Otherwise, it
Lemma 7. get er ITðo1 ; o2 Þ is correct if typeðo1 Þ ¼ ins,
derives the relation by a set of rules and records the result in
typeðo2 Þ ¼ del, and charðo1 Þ 6¼ charðo2 Þ.
ER. In the following lemmas, we study by cases the
sufficient conditions of get er ITðo1 ; o2 Þ or, more specifi- Lemma 8. get er ITðo1 ; o2 Þ is correct if typeðo1 Þ ¼ del,
cally, the rules in lines 2-13. They all assume that state s ¼ typeðo2 Þ ¼ ins, and charðo1 Þ 6¼ charðo2 Þ.
estðo1 Þ ¼ estðo2 Þ is reachable and o1 ; o2 are admissible in s. Corollary 2. Given that o1 and o2 are admissible in a reachable
We say get er ITðo1 ; o2 Þ is correct iff the relation between state s ¼ estðo1 Þ ¼ estðo2 Þ, then IT is correct or o01 ¼ ITðo1 ; o2 Þ
charðo1 Þ and charðo2 Þ as determined by its rules is identical is admissible in state s0 ¼ execðs; o2 Þ if the effects relation
to the effects relation obtained by Definition 2. between charðo1 Þ and charðo2 Þ can be found in ER or can be
It is well-accepted that the two operations in IT be correctly determined by the rules of get er ITðo1 ; o2 Þ.
defined relative to the same state, i.e., estðo1 Þ ¼ estðo2 Þ, for,
otherwise, it does not make sense to compare their position 4.2 Exclusion Transformation and Correctness
parameters [16], [20]. However, condition estðo1 Þ ¼ estðo2 Þ The purpose of o02 ¼ ETðo2 ; o1 Þ, where
alone is not sufficient for correctly determining the relation
estðo2 Þ ¼ execðestðo1 Þ; o1 Þ;
between charðo1 Þ and charðo2 Þ in IT, as is shown in the
following scenario: is to exclude the effect of o1 from o2 such that estðo02 Þ ¼
Example 3. In Example 1, consider how operations o2 and o1 estðo1 Þ and o02 is admissible in estðo1 Þ, as if o1 had not been
are executed at Site 3 by (the IT and control procedure of) executed. As in Algorithm 3, we first call Algorithm 4 to
GOTO [19]. Suppose o2 is received first. We get o02 ¼ determine the effect relation between o1 and o2 and then use
ITðo2 ; o3 Þ ¼ insð1; ‘y’Þ and the history buffer is ½o3 ; o02 . this relation to compute o02 .
When o1 arrives, we first get o01 ¼ ITðo1 ; o3 Þ ¼ insð1; ‘x’Þ Algorithm 3 ETðo2 ; o1 Þ: o02
and then perform o001 ¼ ITðo01 ; o02 Þ. Because their positions 1: get er ETðo1 ; o2 Þ
tie, if we naively compare their site ids to break the tie, 2: if charðo2 Þ ¼ charðo1 Þ then
we get o001 ¼ insð1; ‘x’Þ and the final state “axyc”, which is 3: halt
wrong due to our analysis in Example 1. In this scenario, 4: else
the precondition estðo01 Þ ¼ estðo02 Þ is satisfied, but the 5: o02 o2
system results in the wrong state and violates the correct 6: if charðo1 Þ  charðo2 Þ then
effects relation in which ‘y’ should precede ‘x.’ 7: if typeðo1 Þ ¼ ins then
Lemma 5. get er ITðo1 ; o2 Þ can correctly determine the effects 8: posðo02 Þ posðo2 Þ  1
relation between o1 and o2 if typeðo1 Þ ¼ typeðo2 Þ ¼ ins, 9: else { // typeðo1 Þ ¼ del }
o1 k o2 , and ðposðo1 Þ 6¼ posðo2 Þ or 10: posðo02 Þ posðo2 Þ þ 1
11: end if
ðposðo1 Þ ¼ posðo2 Þ ^ Cld ðcharðo1 Þ; charðo2 ÞÞ ¼ ;ÞÞ:
12: end if
Proof. If posðo1 Þ 6¼ posðo2 Þ, then there must exist at least 13: return o02
one character c between posðo1 Þ and posðo2 Þ in s. That 14: end if
is, Cld ðcharðo1 Þ; charðo2 ÞÞ 6¼ ;. Without loss of gener- If charðo1 Þ and charðo2 Þ are the same, meaning that o2 is
ality, by Lemma 3, suppose charðo1 Þ  c  charðo2 Þ, to delete the character inserted by o1 , it does not make sense
posðo1 Þ < posðo2 Þ, and posðo1 Þ  s½c < posðo2 Þ. By get_ if o1 had not been executed before o2 due to causality. In this
er_IT(), we derive charðo1 Þ  charðo2 Þ, which is consis- case, the system is halted. This corresponds to lines 13-14 in
tent with Definition 2. Algorithm 4 and lines 2-3 in Algorithm 3.
If posðo1 Þ ¼ posðo2 Þ, there is no landmark character If charðo2 Þ  charðo1 Þ, meaning that charðo1 Þ is on the right
between charðo1 Þ and charðo2 Þ in state s. Suppose there is side of charðo2 Þ, then excluding the effect of o1 does not
an execution path in which o2 precedes o1 and all impact o2 . Hence, o2 is returned as it is. If charðo1 Þ  charðo2 Þ,
operations preceding o2 happened before o1 or o2 or both. however, the position parameter of o2 should be decreased
LI AND LI: A NEW OPERATIONAL TRANSFORMATION FRAMEWORK FOR REAL-TIME GROUP EDITORS 313

by one had o1 not inserted charðo1 Þ on its left, or the position Proof. Since o1 and o2 are admissible and o1 is executed
parameter of o2 should be increased by one had o1 not before o2 , the character charðo1 Þ must be present in state
deleted on its left. s ¼ execðestðo1 Þ; o1 Þ. Due to Lemma 3, by comparing
In Algorithm 4, we define rules for determining the their positions posðo1 Þ ¼ s½charðo1 Þ and posðo2 Þ, we can
relation of charðo2 Þ and charðo1 Þ in ET only by their position correctly infer their effects relation. Specifically, we get
parameters. Previous work [19], [20] proposed that the charðo2 Þ  charðo1 Þ if posðo2 Þ  posðo1 Þ or charðo1 Þ 
precondition of ET be estðo2 Þ ¼ execðestðo1 Þ; o1 Þ. However, charðo2 Þ if otherwise. u
t
this condition alone is not sufficient for determining the
Lemma 10. get er ETðo1 ; o2 Þ is correct if typeðo1 Þ ¼ ins,
relation of charðo1 Þ and charðo2 Þ in ET, as shown in the
following scenario: typeðo2 Þ ¼ del, and o1 ! o2 .

Example 4. Suppose three sites start from the same state Proof. By the given conditions and Lemma 3, charðo1 Þ must
s0 ¼ ‘‘abc}. Site 1 generates o1 ¼ delð1Þ to yield “ac.” be present in s ¼ estðo2 Þ and posðo1 Þ ¼ s½charðo1 Þ. Since
Concurrently, site 2 generates o2 ¼ insð2; ‘x’Þ to yield o2 is a deletion and it is admissible in s, it must be that
“abxc.” At site 3, assume o1 is executed first, yielding posðo2 Þ ¼ s½charðo2 Þ. Hence, we can correctly determine
s13 ¼ execðs0 ; o1 Þ ¼ ‘‘ac}. After that, o2 is received. We have their effects relation by comparing their position para-
o02 ¼ ITðo2 ; o1 Þ ¼ insð1; ‘x’Þ and s23 ¼ execðs13 ; o02 Þ ¼ ‘‘axc:’’. meters. In particular, if posðo1 Þ ¼ posðo2 Þ, it must be that
Then, site 3 generates o3 ¼ insð2; ‘y’Þ, yielding s33 ¼ ‘‘axyc:’’ charðo1 Þ ¼ charðo2 Þ. u
t
By Definition 2, we know charðo1 Þ  charðo2 Þ  charðo3 Þ, Lemma 11. get er ETðo1 ; o2 Þ is correct if
namely, charðo1 Þ  charðo3 Þ. Now, examine how the
effects of o02 and o1 are excluded from o3 in turn. typeðo1 Þ ¼ typeðo2 Þ ¼ del;
First, process o03 ¼ ETðo3 ; o02 Þ. According to get_er_ET(), charðo1 Þ 6¼ charðo2 Þ, and o1 ! o2 .
we infer charðo2 Þ  charðo3 Þ because posðo02 Þ < posðo3 Þ.
Lemma 12. get er ETðo1 ; o2 Þ is correct if typeðo1 Þ ¼ del,
Hence, o03 ¼ insð1; ‘y’Þ. Next, consider o003 ¼ ETðo03 ; o1 Þ.
typeðo2 Þ ¼ ins, charðo1 Þ 6¼ charðo2 Þ, o1 ! o2 , and
According to get_er_ET(), we have charðo3 Þ  charðo1 Þ
because their positions tie, which contradicts the correct ðposðo1 Þ 6¼ posðo2 Þ or posðo1 Þ ¼ posðo2 Þ and
relation charðo1 Þ  charðo3 Þ. Cld ðcharðo1 Þ; charðo2 ÞÞ ¼ ;Þ:

Algorithm 4 get er ETðo1 ; o2 Þ: relation of charðo1 Þ and Proof. Let s1 ¼ estðo1 Þ and s2 ¼ estðo2 Þ. Since o1 is a
charðo2 Þ deletion admissible in s1 , by Lemma 3, it must be
1: return the relation if it is found in ER posðo1 Þ ¼ s1 ½charðo1 Þ. If posðo1 Þ < posðo2 Þ, there must be
2: if posðo1 Þ < posðo2 Þ then at least one character between posðo1 Þ and posðo2 Þ in s2 .
3: er charðo1 Þ  charðo2 Þ Hence, we infer charðo1 Þ  charðo2 Þ. If posðo1 Þ > posðo2 Þ,
4: else if posðo1 Þ > posðo2 Þ then similarly, we infer charðo2 Þ  charðo1 Þ.
5: er charðo2 Þ  charðo1 Þ In the case that posðo1 Þ ¼ posðo2 Þ, by Lemma 3, it must
6: else { // posðo1 Þ ¼ posðo2 Þ } be that o2 inserts a character between the two characters
7: if typeðo1 Þ ¼ typeðo2 Þ ¼ ins then s2 ½posðo2 Þ  1 ¼ s1 ½posðo1 Þ  1 and
8: er charðo2 Þ  charðo1 Þ
s2 ½posðo2 Þ ¼ s1 ½posðo1 Þ þ 1:
9: else if typeðo1 Þ ¼ typeðo2 Þ ¼ del then
10: er charðo1 Þ  charðo2 Þ By Definition 2, Cld ðcharðo1 Þ; charðo2 ÞÞ considers all the
11: else if typeðo1 Þ ¼ del ^ typeðo2 Þ ¼ ins then characters that are present before either o1 or o2 is
12: er charðo2 Þ  charðo1 Þ generated. If Cld ðcharðo1 Þ; charðo2 ÞÞ ¼ ;, by Definition 2,
13: else { // typeðo1 Þ ¼ ins ^ typeðo2 Þ ¼ del } we infer charðo2 Þ  charðo1 Þ. u
t
14: er charðo1 Þ ¼ charðo2 Þ
15: end if
Corollary 3. Given that o1 is admissible in a reachable state s and
16: end if
o2 is admissible in s0 ¼ execðs; o1 Þ, then ET is correct or o02 ¼
17: record er in ER
ETðo2 ; o1 Þ is admissible in s if the effects relation between
18: return er
charðo1 Þ and charðo2 Þ can be found in ER or can be correctly
In the following lemmas, we examine by cases the determined by the rules of get er ETðo1 ; o2 Þ.
sufficient conditions of get er ETðo1 ; o2 Þ or, more specifi-
cally, the rules defined in lines 2-16. They all require the
following conditions: estðo2 Þ ¼ execðestðo1 Þ; o1 Þ, estðo1 Þ and 5 OPERATION INTEGRATION
estðo2 Þ are reachable states, and o1 and o2 are admissible. To execute (integrate) a remote operation o, we often have
We say get er ETðo1 ; o2 Þ is correct iff the relation between to transform o against a sequence of operations sq. We
charðo1 Þ and charðo2 Þ as determined by its rules is identical denote the process of inclusively transforming o against sq
to the effects relation obtained by Definition 2. as ITSQðo; sqÞ and that of exclusively transforming o against
Lemma 9. get er ETðo1 ; o2 Þ is correct if typeðo1 Þ ¼ typeðo2 Þ ¼ sq as ETSQðo; sqÞ. In this section, we study how to execute
ins and o1 ! o2 . remote operations and how to transform sequences.
314 IEEE TRANSACTIONS ON PARALLEL AND DISTRIBUTED SYSTEMS, VOL. 18, NO. 3, MARCH 2007

respectively. Intuitively, we somehow transpose sqh into


sqhi þ sqhd such that sqhi includes all insertions that
happened before o and sqhd includes all deletions that
happened before o. Let Pb be sqhd and Pf be sqhd þ sqc . We
further transpose Pf into sqi þ sqd such that sqi only
includes insertions and sqd includes all deletions. As a
result, s00 is the state in which all characters deleted by sqhd
are recovered. Hence, we can always correctly process
ITSQðo00 ; sqi þ sqd Þ because no landmark character between
Fig. 2. Different transformation paths from state s to state s0 .
insertion o00 and any insertion in sqi has been deleted, and IT
between o00 and any deletion in sqd is correct. How to build
5.1 Problem and Analysis such Pb and Pf and how to ensure the correctness of IT or
Conceptually, to integrate a remote operation o, we must ET at every step are the remaining problems.
first compute its admissible form o0 relative to the current In the following, we discuss how to fulfill the above
state and then execute it. This problem can be abstracted in intuition. Section 5.2 first introduces some notations. In
the following way: Given an operation o generated (admissible) Section 5.3 and 5.4, we study some special sequences that
in a given reachable state s, compute its admissible form o0 in ensure correctness of ITSQ and ETSQ, respectively. Sec-
another reachable state s0 , where s 6¼ s0 . tions 5.5 and 5.6 define some utility functions for transpos-
In the abstract sense, computing o0 includes two steps: ing sequences and building special sequences. Section 5.7
1) choose or build a proper path (or sequence) P from s to s0 shows how to integrate remote operations by constructing
and 2) transform o against P . There may exist more than Pb and Pf .
one path from s to s0 . As shown in Fig. 2, some paths are
unidirectional such that we only need to transform o with 5.2 Some Notations
some P . Some other paths may be bidirectional in that they Two operations o1 and o2 are contextually serialized
first consider a path Pb from s to a significant intermediate if execð estð o1 Þ; o1 Þ ¼ est ðo2 Þ. A sequence of operations
state s00 and then a path Pf from s00 to s0 . ½o1 ; o2 ; . . . ; on  is contextually serialized if, for any
Specifically, we maintain an operation log HB at every
site to record operations in their order of execution. When a i; 1  i  n  1; execðestðoi Þ; oi Þ ¼ estðoiþ1 Þ:
remote operation o is received, we integrate o iff all
A contextually serialized sequence is referred to as a
operations that happened before o have been executed
sequence. Given a sequence sq, sq½0 refers to the first
locally. Suppose HB can be somehow transposed into
operation in sq, sq½1 the second, and so forth. Notation jsqj
sqh þ sqc , where sqh includes all operations that happened
denotes the size of sq or the total number of operations in
before o and sqc includes all operations in HB that are
sq. Notation sq½i; j denotes the subsequence ranging from
concurrent with o. It must be that s ¼ execðs0 ; sqh Þ and
the ith to the jth operations in sq, inclusively, where
s0 ¼ execðs0 ; HBÞ.
0  i  j < jsqj.
Most previous OT algorithms use sqc as the transforma-
We generalize function s0 ¼ execðs; oÞ to sequences:
tion path from s to s0 and compute o0 ¼ ITSQðo; sqc Þ, such as
Given state s0 and sequence sq, where s0 ¼ estðsq½0Þ and
adOPTed [14], GOTO [19], [17], SOCT2 [16], and SDT [9],
[10]. However, the ordering between concurrent operations jsqj ¼ n, sn ¼ execðs0 ; sqÞ ¼ execðexecðs0 ; sq½0Þ; sq½1; n  1Þ.
in sqc is not constrained, except the causal order between That is, executing a sequence sq in state s0 is equivalent to
them. It means that concurrent operations may be ordered executing sq½0 in s0 , which results in s1 ¼ execðs0 ; sq½0Þ,
arbitrarily at different sites. As a result, their IT functions then executing sq½1 in s1 ¼ execðs1 ; sq½1Þ, and so forth.
must verify TP1 and TP2 to achieve convergence [14], which Given two operation sequences sq1 and sq2 , if
have turned out extremely difficult in practice [17], [20], [22].
estðsq2 ½0Þ ¼ execðestðsq1 ½0Þ; sq1 Þ;
Previous works in [12], [15], [20], [22] achieve convergence
by enforcing a unique transformation path at all sites and we also say that sq1 and sq2 are contextually serialized. For
avoid verification of TP2. However, the transformation the same reason, operation sq1 ½n  1 and sequence sq2 , and
paths they choose are effectively unconstrained in the same sequence sq1 and operation sq2 ½0, are also contextually
way. That is, arbitrary transformation path is still allowed as serialized. Notation sq1 þ sq2 concatenates two sequences
in adOPTed, GOTO, SOCT2, and SDT. sq1 , sq2 into one sequence. Two sequences sq1 , sq2 are effects
In this work, we explore an alternative strategy which equivalent, denoted as sq1  sq2 ; if executed in the same
avoids arbitrary transformation paths. Instead, we build state, they produce the same result, i.e., s ¼ estðsq1 ½0Þ ¼
some special paths out of HB such that our IT and ET can estðsq2 ½0Þ and execðs; sq1 Þ ¼ execðs; sq2 Þ.
always work correctly. The idea is to first find a backward
5.3 IT-Safe Operation Sequences
path Pb from s to s00 and then a forward path Pf from s00 to
s0 . With these two paths, we first compute an admissible Function ITSQðo; sqÞ requires that o and sq be defined in the
same state, or estðoÞ ¼ estðsq½0Þ. It inclusively transforms o
operation o00 ¼ ETSQðo; Pb Þ relative to s00 and then compute
against sq½0; sq½1; . . . ; sq½jsqj  1 in turn. To ensure the
the admissible o0 ¼ ITSQðo00 ; Pf Þ relative to s0 .
correctness of every IT, we further require that sq is a
However, our analyses in Section 4 reveal that ITðo1 ; o2 Þ
special sequence, as defined below:
and ETðo1 ; o2 Þ do not always work correctly. There are extra
conditions in addition to estðo1 Þ ¼ estðo2 Þ and Algorithm 5 ITSQðo; sqÞ: o0
1: o0 o;
estðo1 Þ ¼ execðestðo2 Þ; o2 Þ;
2: for ði ¼ 0; i < jsqj; i þ þÞ do
LI AND LI: A NEW OPERATIONAL TRANSFORMATION FRAMEWORK FOR REAL-TIME GROUP EDITORS 315

3: o0 ITðo0 ; sq½iÞ 14: end for


4: if o0 ¼  then 15: return o0
5: break
6: end if Definition 8. A given sequence sq is an ET-Safe Operation
Sequence (ETSOS) if, for any i; j, where 0  i < j  n  1
7: end for
and jsqj ¼ n, either 1) charð sq½ i  Þ  charð sq½ j  Þ or
8: return o0
2) charð sq½ i  Þ ¼ charð sq½ j  Þ and typeð sq½ i  Þ ¼ ins and
Definition 7. A sequence sq is an IT-Safe Operation Sequence typeðsq½jÞ ¼ del. If jsqj < 2, we also say that sq is (trivially)
(ITSOS) iff for any two operations sq½i and sq½j, if an ETSOS.
typeðsq½iÞ ¼ ins and typeðsq½jÞ ¼ del, then i < j holds. If
jsqj < 2, we also say that sq is (trivially) an ITSOS. Operations in an ETSOS sq are ordered by their effects
relation, except that inverse operations are ordered by their
An ITSOS sq can be rewritten as sqi þ sqd , where sqi causal order, i.e., a deletion od that deletes the character
includes all insertions in sq and sqd all deletions in sq. inserted by some oi appears after oi . As a simple example,
given an initial state s0 ¼ ‘‘b’’ and three operations executed
Lemma 13. Given operation o and sequence sq, o0 ¼ ITSQðo; sqÞ
in tandem: o1 ¼ insð0; ‘a’Þ, o2 ¼ delð1Þ, and o3 ¼ insð1; ‘c’Þ.
is admissible if estðsq½0Þ ¼ estðoÞ and either 1) typeðoÞ ¼ del
The effects relation is ‘a’  ‘b’  ‘c’ and ½o1 ; o2 ; o3  is an
or 2) typeðoÞ ¼ ins ^ sq is an ITSOS ^ for any insertion sq½i:
ETSOS.
Cld ðcharðsq½iÞ; charðoÞÞ  estðsq½iÞ.
Lemma 14. Given operation o and an ETSOS sq, if there exists
Proof. If typeðoÞ ¼ del, by Lemmas 6 and 8, ITðo; sq½iÞ
some sq½i, 0  i  jsqj  1, such that charðsq½iÞ  charðoÞ,
is correct for any operation sq½i. Consider case
then charðsq½jÞ  charðoÞ for all j: 0  j  i  1.
typeðoÞ ¼ ins. Because sq is an ITSOS, let sq ¼ sqi þ sqd
and ITSQðo; sqÞ ¼ ITSQðo; sqi þ sqd Þ. By the given con-
The correctness of Lemma 14 is straightforward by the
dition, for any insertion
definition of ETSOS. The result can simplify the imple-
sqi ½j : Cld ðcharðsqi ½jÞ; charðoÞÞ  estðsqi ½jÞ; mentation of ETSQðo; sqÞ. When o encounters some sq½i
in ETSQ(), if charðsq½iÞ  charðoÞ, the effects relation
meaning that all characters in Cld ðcharðsqi ½jÞ; charðoÞÞ between o and any operation sq½j, where j < i, must be
must appear in estðsqi ½jÞ. That is, posðsqi ½jÞ ¼ posðoÞ if charðsq½jÞ  charðoÞ. As a result, the remaining operations
Cld ðcharðsqi ½jÞ; charðoÞÞ is ;, or posðsqi ½jÞ 6¼ posðoÞ if in sq can be correctly excluded from o without get_er_ET().
otherwise. Then, by Lemma 5, when inclusively trans- This property is used in ETSQ() to avoid calling ET(), as
forming o against any insertion in sqi , no landmark shown in lines 4-6 and 8-14. In addition, if o and some
character between them has been lost (or deleted). operation sq½i have the same effect character, namely,
Hence, ITðo; sqi ½jÞ is correct for any insertion sqi ½j. By charðoÞ ¼ charðsq½iÞ, or o deletes a character inserted by
Lemma 7, ITðo; sqd ½kÞ is correct for any deletion sqd ½k.tu some sq½i, it does not make sense to perform this and the
remaining ET’s due to causality. The system is halted in this
5.4 ET-Safe Operation Sequences
case. Other algorithms that call ETSQ() will prevent this
ETSQðo; sqÞ requires that sq and o be contextually serial- from happening.
ized, i.e., estðoÞ ¼ execðestðsq½0Þ; sqÞ. As shown in Algo-
rithm 6, to compute ETSQðo; sqÞ, we exclusively transform Lemma 15. Given operation o and sequence sq, where jsqj ¼ n
o against sq½n  1; sq½n  2; . . . ; sq½0 in turn. To ensure the and estðoÞ ¼ execðestðsq½0Þ; sqÞ, let Csq denote the set of
correctness of every ET, we further require that sq be a characters that appear in estðsq½0Þ and sq, that is,
special sequence, as defined below. Due to properties of this
[
n1
sequence, we break the loop of lines 2-7 when some Csq ¼ fcharðsq½iÞg [ estðsq½0Þ:
condition is satisfied because it is no longer necessary to call i¼0
ET() on the remaining operations in sq. Instead, effects of
Then, o0 ¼ ETSQðo; sqÞ is admissible if 1) sq is an ET SOS
those operations are excluded directly as in lines 8-14.
and 2) Cld ðcharðoÞ; charðsq½iÞÞ  Csq for any sq½i ! o.
Algorithm 6 ETSQðo; sqÞ: o0 Proof. Due to Lemmas 9 through 12 and Corollary 3 in
1: o0 o Section 4.2, the only case under which ETðo; sq½iÞ can
2: for ði ¼ jsqj  1; i  0; i  Þ do be unsafe for some sq½i is when posðsq½iÞ ¼ posðoÞ,
3: o0 ETðo0 ; sq½iÞ sq½i ! o, typeðsq½iÞ ¼ del, and typeðoÞ ¼ ins. Hence, we
4: if charðsq½iÞ  charðo0 Þ then only need to prove the correctness of ETðo; sq½iÞ under
5: break this unsafe condition. We prove this by induction.
6: end if Base: Consider ETðo; sq½n  1Þ. First, by definition
7: end for of ETSOS, we know charðsq½kÞ  charðsq½n  1Þ for
8: for ðj ¼ i  1; j  0; j  Þ do 0  k < n  1. By condition
9: if typeðsq½jÞ ¼ ins then
Cld ðcharðoÞ; charðsq½n  1ÞÞ  Csq ;
10: posðo0 Þ ¼ posðo0 Þ  1
11: else for any sq½k, where 0  k < n  1, it is impossible to
12: posðo0 Þ ¼ posðo0 Þ þ 1 {// typeðsq½jÞ ¼ del} have charðsq½n  1Þ  charðsq½kÞ  charðoÞ. Second, un-
13: end if der the above-identified unsafe condition of ET,
316 IEEE TRANSACTIONS ON PARALLEL AND DISTRIBUTED SYSTEMS, VOL. 18, NO. 3, MARCH 2007

typeðsq½n  1Þ ¼ del, typeðoÞ ¼ ins, sq½n  1 ! o, and contextually serialized before sq0 . In general, all the
posðsq½n  1Þ ¼ posðoÞ, it is impossible to have any c in transposition functions in this paper produce effects-
estðoÞ such that charðsq½n  1Þ  c  charðoÞ. Otherwise, equivalent sequences. Specifically, ½o01 ; o02   ½o2 ; o1  in
we would have posðsq½n  1Þ < posðoÞ, which contra- Transposeðo2 ; o1 Þ, o0 þ sq0  sq þ o in TransposeOSqðsq; oÞ,
dicts posðsq½n  1Þ ¼ posðoÞ. Since sqh þ sqc  sq in TransposePreConðo; sqÞ, sqi þ sqd  sq in
TransposeInsDelðsqÞ, and sq0  sq in BuildETSOSðsqÞ.
estðoÞ ¼ execðestðsq½0Þ; sqÞ
Sn1 Algorithm 9 TransposePreConðo; sqÞ: < sqh ; sqc >
and Csq ¼ i¼0 fcharðsq½iÞg [ estðsq½0Þ, with the above 1: sqh ;; sqc ;
two conclusions combined, we infer that there is no 2: for ði ¼ 0; i < jsqj; i þ þÞ do
character c in Csq such that charðsq½n  1Þ  c  charðoÞ. 3: if sq½i k o then
Therefore, we conclude Cld ðcharðoÞ; charðsq½n  1ÞÞ ¼ ;, 4: sqc sqc þ sq½i
or there exists at least one character c such that 5: else
charðoÞ  c  charðsq½n  1Þ. In either case, by the def-
6: < oi ; sqc > TransposeOSqðsqc ; sq½iÞ
inition of relation  , we get charðoÞ  charðsq½n  1Þ.
7: sqh sqh þ oi
Hence, ETðo; sq½n  1Þ is correct.
8: end if
Induction: Assume that processing of ETSQðo; sq½i þ
9: end for
1; n  1Þ is correct. Let o0 be the execution form of o
10: return < sqh ; sqc >
relative to estðsq½i þ 1Þ. By Lemma 14 and Algorithm 6, at
the time ETðo0 ; sq½iÞ is processed, o0 must have been Functions TransposePreCon() and TransposeInsDel()
exclusively transformed with all operations from sq½n  1 have similar structures. TransposePreConðo; sqÞ is adopted
to sq½i þ 1, inclusively. Hence, charðoÞ  charðsq½kÞ from [16], [19]. It transposes sq into sqh þ sqc , such that sqh ,
must hold, where i þ 1  k  n  1. Otherwise, the all operations that happened before o, are contextually
ET process should have stopped for some k. Since serialized before sqc , all those concurrent with o. It scans sq
Cld ðcharðoÞ; charðsq½iÞÞ  Csq , similar to the base case, from left to right and appends every sq½i that is concurrent
there must not exist c such that charðsq½iÞ  c  charðoÞ, with o to sqc . For every sq½i that happened before o, it first
or we would have posðsq½iÞ < posðoÞ, which contradicts transposes sq½i and sqc and then appends sq½i to sqh .
Similarly, TransposeInsDelðsqÞ transposes sq such that all
posðsq½iÞ ¼ posðoÞ. Then, by the definition of relation  ,
insertions ðsqi Þ are contextually serialized before all
no matter whether or not there exists c such that
deletions ðsqd Þ.
charðoÞ  c  charðsq½iÞ, we get charðoÞ  charðsq½iÞ.
Hence, ETðo; sq½iÞ is correct. u
t Algorithm 10 TransposeInsDelðsqÞ: < sqi ; sqd >
1: sqi ;; sqd ;
5.5 Transposing Sequences
2: for ði ¼ 0; i < jsqj; i þ þÞ do
Transposeðo2 ; o1 Þ is to transpose two contextually serialized 3: if typeðsq½iÞ ¼ del then
operations o2 and o1 such that in the output o01 is 4: sqd sqd þ sq½i
contextually serialized before o02 . Since o2 is contextually 5: else
serialized before o1 , we first do o01 ¼ ETðo1 ; o2 Þ such that o01
6: < oi ; sqd > TransposeOSqðsqd ; sq½iÞ
and o2 are defined in the same state, and then do o02 ¼
7: sqi sqi þ oi
ITðo2 ; o01 Þ such that o02 is defined in state execðestðo01 Þ; o01 Þ.
8: end if
Note, if o1 depends on o2 , i.e., typeðo2 Þ ¼ ins, typeðo1 Þ ¼ del,
9: end for
o2 ! o1 , and posðo1 Þ ¼ posðo2 Þ, we know charðo1 Þ ¼ charðo2 Þ
10: return < sqi ; sqd >
and return < o1 ; o2 > .
Algorithm 7 Transposeðo2 ; o1 Þ: < o01 ; o02 > 5.6 Building ET-Safe Sequences
1: {// determined as in get_er_ET} Given a sequence sq, function BuildETSOSðsqÞ incremen-
2: if charðo1 Þ ¼ charðo2 Þ then tally builds an ETSOS sq0 . Initially, sq0 only includes sq½0.
3: return < o1 ; o2 > Then, each time a new element sq½i is added into sq0 . It
4: else transposes sq½i with operations in sq0 from right to left until
5: o01 ETðo1 ; o2 Þ some sq0 ½j is found (line 12) such that charðsq0 ½jÞ  charðoÞ,
6: o02 ITðo2 ; o01 Þ which is exactly the condition defined in Lemma 14. Under
7: return < o01 ; o02 > this case, o is inserted after sq0 ½j (line 13). The relation
8: end if between charðoÞ and other operations in the rest of sq is
known and directly recorded in the local effects relation ER
Algorithm 8 TransposeOSqðsq; oÞ: < o0 ; sq0 > (line 10). If the condition never appears, as in lines 20-22,
1: o0 o; sq0 sq then o is added to the head of sq0 .
2: for ði ¼ jsqj  1; i  0; i  Þ do Lemma 16. Given an admissible sequence sq defined in the initial
3: < o0 ; sq0 ½i > Transposeðsq0 ½i; o0 Þ system state s0 , which preserves the causal order of operations,
4: end for sq0 ¼ BuildETSOSðsqÞ is correct, i.e., sq0 is an ETSOS and
5: return < o0 ; sq0 > every operation in sq0 is admissible.
The precondition of TransposeOSqðsq; oÞ is that sq is Proof. Examine the process of building an ETSOS sq0 from
contextually serialized before o. The output is such that o0 is sq: Each time we add a new operation sq½i into the
LI AND LI: A NEW OPERATIONAL TRANSFORMATION FRAMEWORK FOR REAL-TIME GROUP EDITORS 317

partial result sq0 that was built from sq½0; i  1, sequence remote operation o is queued until it is causally-ready, i.e.,
sq0 is scanned from right to left to find the right position all operations that happened before o are in HB. Suppose
to insert sq½i. Note that each operation in sequence sq0 the initial state is s0 , the current state is s0 , and o is generated
actually represents a state transition. Hence, to insert in state s. Then, function Integrateðo; HBÞ is called to derive
sq½i before some position sq0 ½j, we have to transpose an o0 such that o0 is admissible in s0 . If o0 ¼ , it is discarded.
sq0 ½j; i  1 and sq½i. That is, the correctness of BuildET- Otherwise, o0 is executed and appended to HB. Apparently,
HB is a contextually serialized sequence.
SOS() depends on the correctness of Transpose().
In function Transposeðo1 ; o2 Þ, ET is always called Algorithm 12 Integrateðo; HBÞ: o0
before IT. If o01 ¼ ETðo1 ; o2 Þ is correct, then the relation 1: < sqh ; sqc > TransposePreConðo; HBÞ
of charðo1 Þ and charðo2 Þ is known, which ensures the 2: if sqc ¼ ; then
correctness of ITðo2 ; o01 Þ. Hence, we only need to prove 3: return o0 o
the correctness of ETSQðsq½i; sq0 ½j; i  1Þ. This can be 4: end if
further reduced to prove that the conditions of Lemma 15 5: if typeðoÞ ¼ del then
can be satisfied before calling BuildETSOS(). We prove 6: return o0 ITSQðo; sqc Þ
this by induction.
7: else { // typeðoÞ ¼ ins }
Algorithm 11 BuildETSOSðsqÞ: sq0 8: sqh0 BuildETSOSðsqh Þ
1: if jsqj < 1 then 9: < sqhi ; sqhd > TransposeInsDelðsqh0 Þ
2: return sq0 sq 10: sqhdc BuildETSOSðsqhd þ sqc Þ
3: end if 11: < sqi ; sqd > TransposeInsDelðsqhdc Þ
4: sq0 ½sq½0 12: o00 ETSQðo; sqhd Þ {// Pb ¼ sqhd }
5: for ði ¼ 1; i < jsqj; i þ þÞ do 13: o0 ITSQðo00 ; sqi þ sqd Þ {// Pf ¼ sqi þ sqd }
6: o sq½i 14: return o0
7: flag false 15: end if
8: for ðj ¼ jsq0 j  1; j  0; j  Þ do In Integrateðo; HBÞ, we first call TransposePreConðo; HBÞ
9: if flag ¼ true then to transpose HB into two sequences: sqh , which includes all
10: record charðsq0 ½jÞ  charðoÞ into ER operations that happened before o, and sqc , which includes
11: else {//effects relation determined as in get_er_ET} all operations that are concurrent with o. Due to causality,
12: if charðsq0 ½jÞ  charðoÞ then we have os ¼ gstðoÞ ¼ execðs0 ; sqh Þ.
13: sq0 sq0 ½0; j þ o þ sq0 ½j þ 1; jsq0 j  1 If sqc is empty, it means s0 ¼ gstðoÞ. Then, o is returned
14: flag true as it is (lines 2-3) and will be executed in s0 directly. If sqc
15: else contains concurrent operations, we must incorporate the
16: < o; sq0 ½j > Transposeðsq0 ½j; oÞ effects of those operations into o to get its execution form
17: end if o0 in s0 . By the above analyses, we cannot perform
ITSQðo; sqc Þ until the preconditions defined in Lemma 13
18: end if
are satisfied. If typeðoÞ ¼ del, ITSQðo; sqc Þ is guaranteed to
19: end for
be correct (lines 5-6).
20: if flag ¼ false then However, if typeðoÞ ¼ ins, we must first construct
21: sq0 o þ sq0 Pb and Pf , then compute o00 ¼ ETSQðo; Pb Þ, and, finally,
22: end if o0 ¼ ITSQðo00 ; Pf Þ. Sequence Pb is constructed in lines 8-9:
23: end for We first build an ETSOS sqh0 from sqh , the sequence of all
24: return sq0 operations that happened before o, and then transpose sqh0
Base: Consider ETðsq½1; sq½0Þ. If sq½1 k sq½0, then into two subsequences, sqhi and sqhd , such that sqhi
includes all insertions that happened before o and sqhd
ETðsq½1; sq½0Þ is correct because the effects relation
includes all deletions that happened before o. Then, sqhd is
between concurrent operations has been recorded.
just the transformation path Pb we need.
Otherwise, it must be sq½0 ! sq½1 by causality. Because
Next, we construct Pf as in lines 10-11: We first build an
gstðsq½0Þ ¼ s0 and there is no other operation, we have
ETSOS sqhdc from sqhd þ sqc and then transpose sqhdc into
Cld ðcharðsq½0Þ; charðsq½1ÞÞ  Csq . Hence, ETðsq½1; sq½0Þ two sequences, sqi and sqd , such that sqi includes all the
is correct. insertions and sqd all the deletions. Sequence Pf is just
Induction: Suppose sq0 is the ETSOS correctly built sqi þ sqd , the concatenation of sqi and sqd .
from sq½0; iS 1. Now, check how sq½i is added into sq0 .
Let Csq0 ¼ i1 0 0 0 Theorem 2. o0 ¼ Integrateðo; HBÞ is admissible in state s0 .
j¼0 ðcharðsq ½jÞÞ [ s . Since sq ½0 is defined
0
on s and all operations that happened before sq½i are in Proof. The assertion is easily verified if typeðoÞ ¼ del.
sq0 , it is obvious that Cld ðcharðsq½iÞ; charðsq0 ½jÞÞ  Csq0 When typeðoÞ ¼ ins, the correctness of Integrate() relies
for any 0  j < jsq0 j and sq0 ½j ! sq½i. By Lemma 15, on four steps:
ETSQðsq½i; sq0 Þ is correct. u
t
1. TransposePreCon() in line 1,
5.7 The Integration Procedure 2. the construction of Pb in lines 8-9 and Pf in
The top-level control algorithm executes local and remote lines 10-11,
operations. For best responsiveness, any local operation is 3. ETSQðo; Pb Þ in line 12, and
executed and appended to HB once it is generated. Any 4. ITSQðo00 ; Pf Þ in line 13.
318 IEEE TRANSACTIONS ON PARALLEL AND DISTRIBUTED SYSTEMS, VOL. 18, NO. 3, MARCH 2007

First, in TransposePreConðo; HBÞ, the cause-effect


order between operations in HB are preserved. It can
be shown that the Transpose algorithm is called only
between concurrent operations. The reason is that,
due to the definition of Algorithm 9, all operations
in sqc are concurrent with o. Each time we call
TransposeOSqðsqc ; sq½iÞ or Transposeðsqc ½j; sq½iÞ for
some sqc ½j, due to causality preservation, sq½i must
have happened before o, or sq½i ! o. In addition, since
sq½i is stored after sqc ½j in HB due to Algorithm 9, we
cannot have sq½i ! sqc ½j due to causality. Hence, we
have either sqc ½j ! sq½i or sqc ½j k sq½i. The former
case cannot happen because, if otherwise, we would
Fig. 3. Four sites start from state “1” and converge in “acb.”
have sqc ½j ! sq½i ! o and sqc ½j ! o by transitivity,
which contradicts sqc ½j k o. Therefore, sqc ½j k sq½i must
performs o2 ¼ delð0Þ and site 4 performs o3 ¼ insð0; ‘a’Þ.
be true and the effects relation between them must have
After o3 is executed, site 3 performs o4 ¼ insð1; ‘c’Þ. We have
been recorded in the local memory ER, which ensures
o1 k o2 , o2 k o3 , o1 k o3 , o3 ! o4 , o1 k o4 , and o2 k o4 . Suppose
the correctness of Transpose of ET/IT at each step.
the execution order at site 4 is o3 , o2 , o4 , o1 . For space
Second, by Lemma 16, sqh0 ¼ BuildETSOSðsqh Þ in
reasons, we only consider how o1 and o4 are integrated at
line 8 is correct. As a result, operations in sqh0 are ordered site 4 to illustrate the working of our approach.
by their effects relation and, additionally, if deletion od When o4 arrives at site 4, HB ¼ ½o3 ; o02 , where o02 ¼
deletes the character inserted by some oi , then oi always ITðo2 ; o3 Þ ¼ delð1Þ and the current state
appears before od . Consequently, in the algorithm of
TransposeInsDelðsqh0 Þ in line 9, for any insertion sqh0 ½i and s24 ¼ execðs0 ; ½o3 ; o02 Þ ¼ ‘‘a:’’
any deletion sqhd ½j in Transposeðsqhd ½j; sqh0 ½iÞ, the case
of charðsqh0 ½iÞ ¼ charðsqhd ½jÞ will never happen. Due to To compute o04 relative to s24 , we first construct Pb , which
the effects relation recorded in BuildETSOSðsqh Þ, all ET/ includes all deletions that happened before o4 . Hence, Pb is
empty by definition. Then, we construct Pf , which is
IT in TransposeInsDelðsqh0 Þ can be correctly processed.
initially sqhd þ sqc ¼ sqc ¼ ½o02 . Therefore,
Rewrite HB as sqh þ sqc ¼ sqhi þ sqhd þ sqc . When
building an ETSOS out of sqhd þ sqc , no character has o04 ¼ ITSQðo4 ; ½o02 Þ ¼ insð1; ‘c’Þ:
been lost (or deleted) in the definition state of sqhd þ sqc or
state s00 ¼ execðs0 ; sqhi Þ due to the execution of sequence After o04 is executed, the state of site 4 becomes s34 ¼ ‘‘ac:’’
sqhi in s0 . Hence, the step of sqhdc ¼ BuildETSOSðsqhd þ When o1 arrives, HB ¼ ½o3 ; o02 ; o04 . Similarly, Pb is empty.
sqc Þ in line 10 is correct, the proof of which resembles that Hence, Pf is initially HB itself because all the operations
of Lemma 16. Similarly, TransposeInsDelðsqhdc Þ in line 11 are concurrent with o1 . We transpose Pf into sqi þ sqd such
is also correct. that sqi ¼ ½o3 ; o4  and sqd ¼ ½o002 , where o002 ¼ delð2Þ. Then,
Third, consider o00 ¼ ETSQðo; Pb Þ, where Pb ¼ sqhd . It o01 ¼ ITSQðo1 ; ½o3 ; o4 ; o002 Þ ¼ insð2; ‘b’Þ. After o01 is executed,
can be shown from the algorithm of TransposeInsDel() the final state of site 4 becomes s44 ¼ ‘‘acb:’’
that Pb preserves the effects relation-based order between
operations as a result of BuildETSOS(). Hence, Pb itself is 7 CONCLUSIONS
also anSETSOS, although all its operations are deletions. Let
jP j1
CPb ¼ i¼0b fcharðPb ½iÞg [ estðPb ½0Þ. Since Pb only con- The presented work makes the following two significant
contributions: First, it proposes a novel framework (called
tains deletions, for any Pb ½i ! o, when processing
CR due to its correctness criteria, causality preservation,
ET ðo; P b ½ i Þ, condition C ld ðchar ðoÞ; charðP b ½ i ÞÞ  C P b
and operation effects relation preservation) for interpreting
must hold. By Lemma 15, o00 is admissible in state
and developing OT algorithms. In the theory part, it
s00 ¼ execðs0 ; sqhi Þ ¼ estðPb ½0Þ. formalizes a new constraint, effects relation preservation,
Fourth, consider o0 ¼ ITSQðo00 ; Pf Þ, where Pf ¼ sqi þ for constraining convergence in interactive groupware
sqd is built from sequence sqhd þ sqc . Conceptually, o0 applications. Compared to the intention preservation
must incorporate the effects of sqc and, additionally, sqhd constraint in the state-of-the-art framework CCI [20], it is
because the effects of sqhd have been excluded from o00 well-formalized and subject to correctness proofs. The
earlier. Sequence Pf is an ITSOS because it is a effects relation is naturally defined when operations are
concatenation of an insertion sequence sqi and a deletion generated, except some “artificial” tie-breaking policies for
sequence sqd , which were correctly computed earlier. handling boundary cases.
Consequently, because sequences sqhi and sqi do not In the technical approach part, CR reveals an alternative
contain any deletions, the preconditions of Lemma 13 are way of developing OT algorithms, which follows three main
satisfied. Therefore, o0 ¼ ITSQðo00 ; Pf Þ is admissible in the steps: First, it defines an application-specific effects relation
current state s0 ¼ execðs0 ; HBÞ ¼ execðs00 ; Pf Þ. u
t between objects for constraining the execution of operations.
Second, it formulates a set of transformation functions and
provides sufficient conditions for them to satisfy the defined
6 AN EXAMPLE
effects relation. Third, it finds a special transformation path
As shown in Fig. 3, four sites start from the same initial state for computing an admissible operation and ensuring the
s0 ¼ ‘‘1:’’ Site 1 performs o1 ¼ insð1; ‘b’Þ. Concurrently, site 2 preconditions of the transformation functions.
LI AND LI: A NEW OPERATIONAL TRANSFORMATION FRAMEWORK FOR REAL-TIME GROUP EDITORS 319

To evaluate the proposed CR framework, we exemplify [8] M.J. Knister and A. Prakash, “A Framework for Undoing Actions
in Collaborative Systems,” ACM Trans. Computer-Human Interac-
a novel OT algorithm (called landmark-based transforma- tion, vol. 1, no. 4, pp. 295-330, Dec. 1994.
tion or LBT), which is testimony to the above design [9] D. Li and R. Li, “Ensuring Content and Intention Consistency in
guidelines. Specifically, the transformation functions in LBT Real-Time Group Editors,” Proc. 24th IEEE Int’l Conf. Distributed
Computing Systems (ICDCS ’04), pp. 748-755, Mar. 2004.
only use basic information such as operation type, position
[10] D. Li and R. Li, “Preserving Operation Effects Relation in Group
parameter, and site id. The concepts of IT/ET safe operation Editors,” Proc. ACM Conf. Computer-Supported Cooperative Work
sequences reveal practicable heuristics for constructing the (CSCW ’04), pp. 457-466, Nov. 2004.
special transformation paths. As demonstrated by the [11] D. Li and R. Li, “An Approach to Ensuring Consistency in Peer-to-
Peer Real-Time Group Editors,” Computer Supported Cooperative
design of the LBT algorithm, the CR framework simplifies Work: J. Collaborative Computing, Oct. 2005.
the design of transformation functions because it no longer [12] R. Li, D. Li, and C. Sun, “A Time Interval Based Consistency
demands that transformation functions (IT) work in all Control Algorithm for Interactive Groupware Applications,” Proc.
IEEE Int’l Conf. Parallel and Distributed Systems (ICPADS ’04),
possible cases. That is, it theoretically frees the difficult TP2 pp. 429-436, July 2004.
condition that is established in [14] and well-accepted in the [13] M. Raynal and M. Singhal, “Logical Time: Capturing Causality in
literature [16], [17], [19]. Distributed Systems,” Computer, pp. 49-56, Feb. 1996.
[14] M. Ressel, D. Nitsche-Ruhland, and R. Gunzenhäuser, “An
However, more work is necessary to evaluate these ideas
Integrating, Transformation-Oriented Approach to Concurrency
in a wider range of application domains. The proposed Control and Undo in Group Editors,” Proc. ACM Conf. Computer-
framework and algorithms seem generally applicable for Supported Cooperative Work (CSCW ’96), pp. 288-297, Nov. 1996.
optimistic consistency control on linear data structures. In [15] H. Shen and C. Sun, “Flexible Notification for Collaborative
Systems,” Proc. ACM Conf. Computer-Supported Cooperative Work
future research, we plan to extend this work to support tree- (CSCW ’02), pp. 77-86, Nov. 2002.
based data structures [4] and string operations [20]. Another [16] M. Suleiman, M. Cart, and J. Ferrié, “Concurrent Operations in a
possible direction is to support selective undo [17] such Distributed and Mobile Collaborative Environment,” Proc. IEEE
Int’l Conf. Data Eng. (ICDE ’98), pp. 36-45, Feb. 1998.
that any executed operation can be undone at any time. [17] C. Sun, “Undo as Concurrent Inverse in Group Editors,” ACM
Conceptually, computing an admissible operation in group Trans. Computer-Human Interaction, vol. 9, no. 4, pp. 309-361, Dec.
undo is an inverse process of that in group do. The 2002.
[18] C. Sun and D. Chen, “Consistency Maintenance in Real-Time
presented work seems to provide valuable insights into this Collaborative Graphics Editing Systems,” ACM Trans. Computer-
problem. In addition, this work defines a set of sufficient Human Interaction, vol. 9, no. 1, pp. 1-41, Mar. 2002.
conditions for IT/ET as a means to develop OT algorithms [19] C. Sun and C. Ellis, “Operational Transformation in Real-Time
Group Editors: Issues, Algorithms, and Achievements,” Proc.
and prove their correctness. In future work, it would also be ACM Conf. Computer-Supported Cooperative Work (CSCW ’98),
interesting to study necessary conditions and even suffi- pp. 59-68, Dec. 1998.
cient and necessary conditions. [20] C. Sun, X. Jia, Y. Zhang, Y. Yang, and D. Chen, “Achieving
Convergence, Causality-Preservation, and Intention-Preservation
in Real-Time Cooperative Editing Systems,” ACM Trans. Compu-
ACKNOWLEDGMENTS ter-Human Interaction, vol. 5, no. 1, pp. 63-108, Mar. 1998.
[21] D. Sun, S. Xia, C. Sun, and D. Chen, “Operational Transformation
The authors thank the associate editor, Dr. Philip K. for Collaborative Word Processing,” Proc. ACM Conf. Computer-
McKinley, and the anonymous expert referees for their Supported Cooperative Work (CSCW ’04), pp. 162-171, Nov. 2004.
[22] N. Vidot, M. Cart, J. Ferrie, and M. Suleiman, “Copies Conver-
insightful and constructive review comments, which sig- gence in a Distributed Realtime Collaborative Environment,” Proc.
nificantly improved the readability, technical quality, and ACM Conf. Computer-Supported Cooperative Work (CSCW ’00),
pp. 171-180, Dec. 2000.
presentation of this paper. This work was supported in part [23] W.E. Weihl, “Commutativity-Based Concurrency Control for
by the US National Science Foundation under CAREER Abstract Data Types,” IEEE Trans. Computers, vol. 37, no. 12,
award IIS-0133871. pp. 1488-1504, Dec. 1988.
[24] H. Yu and A. Vahdat, “Design and Evaluation of a Conit-Based
Continuous Consistency Model for Replicated Services,” ACM
Trans. Computer Systems, vol. 20, no. 3, pp. 239-282, Aug. 2002.
REFERENCES
[1] B.R. Badrinath and K. Ramamritham, “Semantics-Based Concur- Rui Li is a PhD candidate in the Department of
rency Control: Beyond Commutativity,” ACM Trans. Database Computer Science, Texas A&M University. His
Systems, vol. 17, no. 1, pp. 163-199, Mar. 1992. research interests include groupware, user
[2] P. Bellini, P. Nesi, and M.B. Spinu, “Cooperative Visual interfaces, and distributed systems. His PhD
Manipulation of Music Notation,” ACM Trans. Computer-Human dissertation focuses on operational transforma-
Interaction, vol. 9, no. 3, pp. 194-237, Sept. 2002. tion-based consistency control in group editors.
[3] P.A. Bernstein, V. Hadzilacos, and N. Goodman, Concurrency He is a student member of the IEEE.
Control and Recovery in Database Systems. Addison-Wesley, 1987.
[4] A.H. Davis, C. Sun, and J. Lu, “Generalizing Operational
Transformation to the Standard General Markup Language,”
Proc. ACM Conf. Computer-Supported Cooperative Work (CSCW ’02),
pp. 58-67, Nov. 2002.
[5] P. Dewan, R. Choudhary, and H. Shen, “An Editing-Based Du Li received the PhD degree from the
Characterization of the Design Space of Collaborative Applica- University of California, Los Angeles in 2000.
tions,” J. Organizational Computing, vol. 4, no. 3, pp. 219-240, 1994. He is currently an assistant professor in the
[6] C.A. Ellis and S.J. Gibbs, “Concurrency Control in Groupware Department of Computer Science, Texas A&M
Systems,” Proc. ACM SIGMOD Conf. Management of Data, pp. 399- University. His research interests include group-
407, 1989. ware, computer-supported cooperative work,
[7] S. Greenberg and D. Marwood, “Real-Time Groupware as a distributed systems, and software engineering.
Distributed System: Concurrency Control and Its Effect on the He is a member of the IEEE and the IEEE
Interface,” Proc. ACM Conf. Computer-Supported Cooperative Work Computer Society.
(CSCW ’94), pp. 207-217, Oct. 1994.

You might also like