寓言故事

寒坳口的双桥

「坡叔,我走这坳口三十年了,今夜头一回走不动,」东岸的车夫说。「我把着窄拱,我的骡子不肯再迈一步,非要你的灯笼不可。」「灯在我手里,」西岸的老点灯人在另一拱上答,「可我不踩那石头,没你的骡子我不往前一步,桥面滑,我老了。」两人各自踩着不肯让出的板,请对方先走过来。

“Uncle Po, I have walked this pass thirty years, and tonight is the first I cannot,” said the carter from the eastern bank. “I hold the narrow arch and my mule refuses to move a step without your lantern.” “And I hold the lantern,” the old lamplighter answered from the western arch, “but I will not set one foot on that stone without your mule, for the bridge is slick and I am old.” Each stood on the plank they would not yield, asking the other to come across first.

「那我们就卡死了,」车夫说。「还没有,」点灯人答,「要四样同时齐了才算:板太窄容不得两人共;各攥着自己的,却还伸手要对方的;谁也不肯把谁掀下去;我等你、你等我,绕成一个环。」他在冻僵的手指上一条条数。「破了任何一条,小子,咱们就过得去。」

“Then we are stuck,” the carter said. “Not yet,” said the lamplighter. “Only if four things hold at once: the plank is too thin to share; each grips his own and still asks for the other’s; neither will knock the other off; and I wait on you while you wait on me, round in a ring.” He counted them on his cold fingers. “Break any one, child, and we cross.”

车夫苦笑:「板不能共——这是坳口的规矩,一畜一道宽。骡不能松手,松了深谷吞她。不能掀你,你一把老骨头。所以一切就压在那个环上。」「对,」老人说,「可环没有第一只手可握。」

The carter laughed bitterly. “I cannot share the plank—it is the law of the pass, one beast, one width. I will not let go of my mule, for the gorge would swallow her. I will not shove you, for you are frail. So everything turns on the ring.” “Yes,” said the old man. “And a ring has no first hand to shake.”

「那告诉我怎么破它,」车夫哀求,「我付你双倍的灯钱。」点灯人摇头:「有三条路,只能挑一条。雪未落时,守口人本可把每块板从一编到一百,只许依着升序过——那样环永远合不上。这条路如今关了,咱们已经踩在板上了。第二条:每一步之前先算,迈出去后两人是否都还留着回家的安路,是才迈。今夜没有守口人在旁算这笔账。第三条:由得咱们冻在这儿,天亮守口人来,割断一人,把他拖回他自己的岸。」

“Then tell me how to break it,” the carter pleaded, “and I will pay your fee doubled.” The lamplighter shook his head. “There are three roads, and we may choose but one. Before the snow ever fell, the wardens could have numbered every plank from one to a hundred and made us cross only in rising order—then no ring could ever close. That road is shuttered now, for we are already on the wood. The second road: before each step, ask whether taking it leaves some safe path home for both of us; step only when the answer is yes. Tonight no warden stands by to reckon it. The third: let us freeze here, and at dawn the wardens will come, cut one of us loose, and drag him back to his own bank.”

「第三条太狠,」车夫低声说。「可更南边的守口人索性把这种夜全当没看见,」点灯人说,「他们叫它鸵鸟:若祸事稀少,就闭上眼,由坳口照常走。」「若不稀少呢?」「那就总得割断一人,或撬开一人、把他滚回原岸,他带的货也就丢了。」骡子跺脚。灯笼晃。谁也没动。

“The third road is monstrous,” whispered the carter. “Yet the wardens farther south ignore such nights entirely,” said the lamplighter. “They call it the ostrich: if the harm be rare, shut your eyes and let the pass run.” “And when it is not rare?” “Then someone must be cut loose, or pried loose and rolled back, and the goods he carried lost.” The mule stamped. The lantern swung. Neither man moved.

「那么,这是谁的过错?」车夫的声音裂了,「我,攥着骡?你,攥着灯?」「不,」老人轻声说,「『过错』用错了词。板窄,夜冷,规矩是一畜一道宽,而咱们各自攥的,恰好是对方非过不可的那一样。环自己合上了。这儿没人选择站着不动——咱们只是动不了。」

“Is this, then, someone’s fault?” the carter asked, his voice cracking. “Mine, for gripping the mule? Yours, for the lantern?” “No,” said the old man softly. “Fault is the wrong word. The planks are narrow, the night is cold, the law is one-beast-one-width, and each of us holds the very thing the other must pass. The ring closed of itself. No one here chose to stand still—we simply cannot move.”

注解:这则寓言画的是死锁(deadlocks):两个以上的运算单元互相持有对方所需的资源、循环等待、谁也推不进;唯有四个条件——互斥、持有并等待、不可抢占、循环等待——同时成立时才会发生,三条出路分别对应预防(静态破坏至少一个条件,如给板编号)、避免(每步先算是否留有安全归路,即银行家算法的盘算)、检测与恢复(任其发生,再割断一人或把他撬回原岸)。它是由所持之物的结构造成的状态,并非任何人主动选择站着不动。

Annotation: This fable depicts a deadlock (deadlocks/死锁): two or more parties each hold the resource the other needs and wait in a cycle, so none can advance; it arises only when four conditions hold simultaneously — mutual exclusion, hold-and-wait, no preemption, and circular wait. The three ways out correspond to prevention (statically breaking at least one condition, such as numbering the boards), avoidance (checking each step for a safe path home, the reckoning of the banker's algorithm), and detection and recovery (letting it happen, then cutting one party loose or rolling him back to his own shore). It is a state produced by the structure of what is held, not an outcome anyone chose by standing still.