| OCR Text |
Show 78 3.3.1 Level stamp Genealogical dependencies among tasks can be monitored by a simple level numbering scheme. Assume that the root task carries a null level number, a task at level one will bear 1 unique one digit identification. Tasks in subsequent levels are stamped by appending one more digit to the number of their parents. The term digit is used generically and is not limited to decimal representation. Since each task is associated with a unique level stamp, it is obvious that ancestor-descendant relationships can be observed by comparing level stamps. A level stamp is not a time stamp. Its uniqueness is guaranteed by the program structure. Stamping of tasks is fully asynchronous in an applicative system. One objective in devising a level stamp scheme is to make stamping determinate. This means that a task has the same stamp in spite of any precedence which may be caused by processor communications or machine malfunctions. Determmacy of level stamping can be achieved by properly defining the meaning of the appended digit. An obvious approach to assign a digit is to sequentially number the level ~tamps generated from a parent. The first spawned child has digit 1 as its suffix, and so on. This method certainly satisfies the criterion of uniqueness. However, determinacy is not easily preserved.· If two child tasks of a parent are demanded by two processors at approximately the same time. there exists a race condition. Should recovery be needed, it becomes possible to mess up level stamps and crash the system. A solution is to define the last digit as the relative location of the child task in a parent function. Relative locations of the child tasks are fixed at compile time. This information can be appended to a parent's level stamp to form a new stamp for the child task. |