Page 161 -
P. 161

5  Exception Handling                                           151
                           chosen for handling them needs to be as generic as possible to ensure that it has
                           broadest applicability.



                           5.2.2 Exception Handling at Work Item Level


                           The second factor that is associated with any exception handling strategy is the way
                           in which the work item that detected the exception will be handled. There are a
                           multitude of ways in which an exception may be dealt with; however, the actual
                           approach pursued will depend on the current execution state of the detecting work
                           item and its state after the exception has been dealt with.
                              To quantify the range of possible options, we first need to consider a general-
                           ized set of states that are associated with the execution life-cycle for a work item.
                           Figure 5.1 illustrates as solid arrows the states through which a work item progresses
                           during normal execution from a resourcing perspective (cf. Chap. 2). It is initially
                           offered to one or more resources for execution. A resource issues an allocate com-
                           mand to indicate that it wishes to execute the work item at some future time; the
                           work item is then allocated to that resource. Typically this involves adding the work
                           item to the resource’s work queue and removing any references to the work item that
                           other resources may have received, either on their work queues or via other means.
                           When the resource wishes to commence the work item, it issues a start command
                           and the state of the work item changes to started. Finally, once the work item is
                           finished, the resource issues a complete command and the state of the work item is
                           changed to completed. Note that there are two possible variations to this course of
                           events, shown as dotted arcs in Fig. 5.1, (1) where a work item offered to a resource
                           is selected by another resource, it is withdrawn from the first resource’s worklist and




                                                                       failed
                                                          force−fail−a
                                                 reoffer−s
                                                force−fail−o
                            continue−offer  continue−allocation  force−fail  fail


                                           allocate           start
                                 offered           allocated          started    continue−execution
                                          reoffer−a         reallocate−s

                                 reoffer           reallocate  force−complete  restart  complete
                                        withdraw
                                                          force−complete−a
                                withdrawn        force−complete−o    completed


                           Fig. 5.1 Options for handling work items
   156   157   158   159   160   161   162   163   164   165   166