2012年2月10日星期五
TAO from Facebook
2011年9月25日星期日
How to run customized ext4 under Linux 2.6.26
2011年9月21日星期三
Efficient Locking for Concurrent Operations on B-Trees
A Critique of ANSI SQL Isolation Level
From Microsoft, 1995
Summary
This paper discussed the definition of ANSI SQL(92) isolation level, and pointed out its ambiguity and failure to preclude some abnormality. The authors proposed a new set of definitions which could naturally map to the standard locking implementation of each level, and also discussed some additional isolation level, such as snapshot isolation.
The author first introduced the Dirty Read, Non-repeatable Rad and Phantom phenomena; and pointed out due to the ambiguity of their English statement, there could be a broad and a strict interpretation of each of the phenomena. They stated each interpretation in terms of execution history and defined different ANSI SQL Isolation level by how they preclude those phenomena.
The author then defined another set of isolation level in terms of different locking implementation. They discussed what kind of abnormality each of these isolation levels preclude, and noticed that their discrepancy with the ANSI isolation levels. They defined a new kind of phenomena, namely dirty write. A new set of isolation levels, defined by how they preclude those four phenomena (dirty write, dirty read, non-repeatable read and phantom) in the strict interpretation, are proposed. The author then showed that they are equivalent to their corresponding locking isolation levels.
The author discussed two additional kinds of isolation level: cursor stability and snapshot isolation. They clearly defined them by what abnormality they preclude, and showed that how they sit in the isolation level hierarchy.
Finally a summary has been given to show under the better definition, what kind of abnormality each isolation level precludes; and how they form an isolation level hierarchy.
On Optimistic Methods for Concurrency Control
paper here:
http://www.google.com/url?sa=t&source=web&cd=1&ved=0CCMQFjAA&url=http%3A%2F%2Fciteseerx.ist.psu.edu%2Fviewdoc%2Fdownload%3Fdoi%3D10.1.1.114.3052%26rep%3Drep1%26type%3Dpdf&rct=j&q=On%20optmistic%20method%20for%20concurrency%20control&ei=EPB5Tp6rFYWJsQLW28joAw&usg=AFQjCNGrkzBJkj-S35zwDWNlA5iYM--eWg&sig2=vLC4D24pmZlETmYNr0q4Kw
Summary:
In this paper the authors analyzed the drawbacks of doing concurrency control using traditional lock techniques: you have to pay the locking overhead even when you don't really need it. They then proposed optimistic concurrency control: let transactions proceed as if there's no conflict, and back-up them if a conflict is detected.
The main idea behind this optimistic approach is to divide the transactions into three phases: read, validation and write. In read phase, transactions only read database values and all updates take place in local copy; we also remember what we read and update in this transaction. In validation phase, we use some algorithm to detect whether there is a conflict during the read phase. If there is no conflict, we proceed to write phase and apply the updates to the global database; otherwise we just back-up and do necessary clean-up.
The authors discussed in detail how to validate a transaction. They laid out three conditions for transactions to meet serial equivalence (mainly about the read/write set of each transaction should not intersect with each other), and discussed how to assign each transaction a serial number to facilitate validation. Two families of validations algorithm are then proposed: one require serial write phase of all transactions; and the other allow concurrent write phases.
The author also discussed what kind of workload is suitable for optimistic concurrency control: query-dominate workload and other workload which conflict happen in a low probability. An example is given and analyzed (in paper) to show that optimistic concurrency control is promising in maintaining B-tree index. However, no experimental results are shown.
Comments:
1. This whole optimistic CC thing has a copy-on-write semantics. So note that it could break the original physical layout and extra caution should be taken.
2. The paper didn't quantify at all the overhead of the optimistic approach: maintaining sets, intersection, making local copies (memory copy is expensive!). The authors intentionally did that but you should let them manipulating you....
3. Optimistic Control has not yet been implemented in any commercial system as far as I know, but some techniques developed in this paper, like assigning transaction numbers, are very influential.
2011年9月1日星期四
Do NOT block make_request function!
1405 * We only want one ->make_request_fn to be active at a time, 1406 * else stack usage with stacked devices could be a problem. 1407 * So use current->bio_{list,tail} to keep a list of requests 1408 * submited by a make_request_fn function. 1409 * current->bio_tail is also used as a flag to say if 1410 * generic_make_request is currently active in this task or not. 1411 * If it is NULL, then no make_request is active. If it is non-NULL, 1412 * then a make_request is active, and new requests should be added 1413 * at the tail 1414 */
2011年7月23日星期六
关于何新有关六四演讲的一点感想
http://www.inmediahk.net/node/29225
我当然不同意何新的基本观点,虽然我同意他的许多技术性论断。美国和其他西方国家跟中国有没有战略利益冲突?当然有,而且他们必然会按照他们的最大利益行事。当时的学生是不是过于天真,他们的愤怒是不是过于泛化而缺乏建设性,甚至有破坏性?当然是,什么时候的学生不天真呢?但是,对于国家利益的维护,建立在对于国家利益的正确认知上。过于上纲上线的国家利益,从来都是危险而又靠不住的。而我以为,在坦克开出来,无辜学生的鲜血流出来的时候,所谓国家利益,已经受到了最大程度的破坏。
可是同样有趣的,是何新本人受到的很多不公正对待,以及一部分人,一部分北大学生对待何新的态度。那些文革化的语言,以及对待阶级敌人式的一棒子打死的态度,实在让人触目惊心。而这些语言或实际的迫害,来自于激烈主张民主,自由与基本权利的群体,多么讽刺!而八九到现在,二十年已经过去了,虽然大家对于政府的不信任,已经发展到了危险的地步;但是我们争取权利的技巧和素养,却并没有提高多少。从充斥着“广大网友”的新浪天涯,到以学生为主的未名水木,再到以留学生为主的未名空间;放眼望去,我只觉得辱骂和攻击满天飞。争取权利的一方,或者说弱势的一方,对于他人人格的漠视和权利的践踏,跟他们攻击的一方一样严重,如果没有更严重的话。这一点,真让人忧虑。
最后再aside一下关于国家利益的问题。上金融课的时候,老师讲到一战以后英国政府坚持不让英镑贬值,尽管彼时内忧外患,贬值看起来是一个如此诱人的选择。一个很重要的原因是因为当时社会上有巨大的声音,认为在一战中掏腰包购买债券,表达了对英国坚定支持的人,需要得到公正的对待。不能以国家利益之名,伤害他们的利益,同时也伤害大英帝国的荣誉。尽管英国政府维持币值的决定,后来看来并不明智。可是当时我坐在讲台下想的是,这个国家,多么的让人尊敬。