a***u 发帖数: 383 | 1 需要用到哪种protocol?
昨天面two sigma面的。面试题先是oo desing,要求设计一个 text editor,insert,
delete各种command,可以 redo/undo,因为曾经仔细读过design pattern那本书的第
二章,command pattern+ composite pattern。然后follow up 如何扩展成google
docs,直接答不会,最后跪了。 |
z******3 发帖数: 1 | 2 two sigma还问这种设计问题? 楼主你面的是什么职位? |
z****e 发帖数: 54598 | 3 这个就是分布式并发冲突的问题
你该扯蛋一下分布式lock
其实你把多线程的lock琢磨琢磨
然后套上网络这些,大概都能扯出点东西来 |
j**********3 发帖数: 3211 | |
w********s 发帖数: 1570 | 5 svn或者perforce用过么? 你提交代码的时候会检查server上的代码是否变化冲突, 然
后让你选择merge, accept theirs, accept mine, etc.
【在 a***u 的大作中提到】 : 需要用到哪种protocol? : 昨天面two sigma面的。面试题先是oo desing,要求设计一个 text editor,insert, : delete各种command,可以 redo/undo,因为曾经仔细读过design pattern那本书的第 : 二章,command pattern+ composite pattern。然后follow up 如何扩展成google : docs,直接答不会,最后跪了。
|
w********s 发帖数: 1570 | 6 In 2009 OT was adopted as a core technique behind the collaboration features
in Apache Wave and Google Docs.
https://en.m.wikipedia.org/wiki/Operational_transformation#Consistency_
models
【在 a***u 的大作中提到】 : 需要用到哪种protocol? : 昨天面two sigma面的。面试题先是oo desing,要求设计一个 text editor,insert, : delete各种command,可以 redo/undo,因为曾经仔细读过design pattern那本书的第 : 二章,command pattern+ composite pattern。然后follow up 如何扩展成google : docs,直接答不会,最后跪了。
|
w********s 发帖数: 1570 | 7 The basic idea of OT can be illustrated by using a simple text editing
scenario as follows. Given a text document with a string "abc" replicated at
two collaborating sites; and two concurrent operations:
O1 = Insert[0, "x"] (to insert character "x" at position "0")
O2 = Delete[2, "c"] (to delete the character "c" at position "2")
generated by two users at collaborating sites 1 and 2, respectively. Suppose
the two operations are executed in the order of O1 and O2 (at site 1).
After executing O1, the document becomes "xabc". To execute O2 after O1, O2
must be transformed against O1 to become: O2' = Delete[3, "c"], whose
positional parameter is incremented by one due to the insertion of one
character "x" by O1. Executing O2' on "xabc" deletes the correct character "
c" and the document becomes "xab". However, if O2 is executed without
transformation, it incorrectly deletes character "b" rather than "c". The
basic idea of OT is to transform (or adjust) the parameters of an editing
operation according to the effects of previously executed concurrent
operations so that the transformed operation can achieve the correct effect
and maintain document consistency.
【在 a***u 的大作中提到】 : 需要用到哪种protocol? : 昨天面two sigma面的。面试题先是oo desing,要求设计一个 text editor,insert, : delete各种command,可以 redo/undo,因为曾经仔细读过design pattern那本书的第 : 二章,command pattern+ composite pattern。然后follow up 如何扩展成google : docs,直接答不会,最后跪了。
|
w********s 发帖数: 1570 | 8 和分布式lock没关系, 人家问得是OT control (integration) algorithms
【在 z****e 的大作中提到】 : 这个就是分布式并发冲突的问题 : 你该扯蛋一下分布式lock : 其实你把多线程的lock琢磨琢磨 : 然后套上网络这些,大概都能扯出点东西来
|