IDMS

  • 1.  Deadlock question

    Posted Aug 10, 2011 01:21 AM
    Does anyone know the algorithm that IDMS uses to determine which task is the victim in a deadlock resolution?

    Kay Rozeboom
    Information Technology Enterprise
    Iowa Department of Administrative Services
    Email: Kay.Rozeboom@iowa.gov


  • 2.  RE: Deadlock question

    Posted Aug 10, 2011 05:26 AM
    It's not the [color=#1c02ff]BYsquared[color] algorithm is it ? [color=#2d04fd]By[color] Gosh [size=5]*[size] [color=#2d04fd]By[color] Golly[size=5] =[size] [color=#2d04fd]BY[color]squared ?
    :grin:
    Just a thought - cheers - Gary

    Gary Cherlet


  • 3.  RE: Deadlock question
    Best Answer

    Posted Aug 10, 2011 05:39 AM
    38.7.1 How the System Detects a Deadlock
    Deadlock detection is a process performed on a time interval basis. It is carried out in four major phases:

    1. Identifying stalled tasks -- To identify tasks that are stalled, all dispatch control elements (DCEs) in the system are examined. Any DCE found stalled while waiting on an internal resource is entered into the deadlock detection matrix (DDM). All subsequent processing begins with the DCE address stored in the DDM table. This eliminates the need to scan all DCEs in the system.
    2. Identifying task dependencies -- Next, the dependencies between the stalled tasks are identified. The deadlock detection matrix is updated. For each task on which another task is waiting, a bit in the deadlock detection matrix is set to one.
    3. Identifying deadlocks -- To determine which tasks are involved in a deadlock cycle, a transformation is performed on the matrix. From this process, a pair of deadlocked tasks is identified. From this pair, a victim is selected.
    4. Selecting a victim -- The task running for the shortest period of time is chosen as the victim of the two tasks as long as:
    [o] The priority of the victim task is less than that of the other task
    [o] The victim task's wait was not entered with COND=NONE and the other task's wait was entered with COND=DEAD

    The task running for the shortest period of time is chosen as the victim because it is more likely that it will have consumed fewer resources than a longer running task. As a result, less duplication of work should be required when the victim is restarted, with these exceptions:
    [o] If the other task is of a higher priority, implying that it is of more importance
    [o] If the victim task entered the deadlock with COND=NONE and the other task specified COND=DEAD. In this case, the task specifying COND=DEAD is chosen as the victim since COND=DEAD indicates that the task is designed to handle and recover from deadlock situations. This prevents an abend.

    Victim Selection User Exit: The algorithm used to select a victim in a deadlock situation may not be optimal for your installation or applications. User exit 30 allows victims to be selected based upon specific requirements. The exit is passed the DCE addresses of each pair of deadlocked tasks and may take one of two actions:
    [o] Choose one of the tasks as the victim task
    [o] Return control to the deadlock detector by requesting that the default deadlock detection logic be applied

    >> For a discussion of user exit 30, refer to Advantage CA-IDMS System Operations.

    Deadlock Detection Interval:
    You can control the frequency with which the deadlock detection mechanism searches for deadlocked tasks using the DEADLOCK DETECTION parameter of the SYSTEM statement.

    The DEADLOCK DETECTION parameter allows you to specify the amount of time that elapses before the deadlock detection mechanism searches for deadlocked tasks. Note that in an idle system, deadlock detection is also idled until new tasks are started. This eliminates CPU consumption for deadlock detection when no tasks could possibly be deadlocked.

    You can use the DCMT VARY DEADLOCK command at runtime to override the system generation specification.
    For further information on the DEADLOCK DETECTION parameter of the SYSTEM statement, refer to Advantage CA-IDMS System Generation. For further information on the DCMT VARY DEADLOCK command, refer to Advantage CA-IDMS System Tasks and Operator Commands.
    --------------------------------------------------------------------------------
    George Lewandowski
    Database Administrator
    GIS


  • 4.  RE: Deadlock question

    Posted Aug 10, 2011 06:04 AM
    Kate,

    As far as i know is the task with the highest tasknumber(when priotity is equal) or with the lowest priority the victem.

    Peter van de Ven Atos


  • 5.  RE: Deadlock question

    Posted Aug 10, 2011 06:05 AM
    Kay,

    how idms detects a deadlock situation and how it's selects a victim can be found in the CA[b] IDMS System generation guide chapter 3.7.2 deadlock detection.

    The task running for the shortest period of time is chosen as the victim because most likely is has consumed fewer resources than a longer running task.

    But there are some exceptions, these are described in sysgen guide as said above.

    Best regards,

    Frank Vanderveken


  • 6.  RE: Deadlock question

    Posted Aug 10, 2011 09:42 AM
    Hi Kay,

    It says in the Systems Operations Guide in Section 7.5.5.27 EXIT 30 Deadlock Victim Selection Exit
    ■ If one of the tasks is COND=NONE and the other task is COND=DEAD, the COND=DEAD task will be selected as the victim.
    ■ If both tasks have the same COND specification, the task having the lower priority will be chosen.

    What it does not say is what happens if both tasks have the same priority. I am pretty sure that the task that has been running for the SHORTEST time is chosen as the victim but I could be wrong. Pretty easy to test if you have DMLO and start session 1 then session 2 and make them deadlock and see which one goes away.

    HTH - Pete


  • 7.  RE: Deadlock question

    Posted Aug 10, 2011 06:01 AM
    AISTR,

    When the two tasks have differing priorities, the higher priority task wins.

    When the two tasks have equal priorities, the one executing longer wins.

    Dick
    Richard Pierce


  • 8.  RE: Deadlock question

    Posted Aug 10, 2011 06:03 AM
    Peter's recollection matches mine from what back in the 12.0 days when this first came out .....

    Chris Hoelscher


  • 9.  RE: Deadlock question

    Posted Aug 10, 2011 06:04 PM
    Thanks for all the responses in such a short time!

    Kay


  • 10.  RE: Deadlock question

    Posted Aug 10, 2011 06:12 PM
    I tried to reply but unfortunately my priority was the same as Pete Charles and I haven't been running quite so long. So I got rolled out.

    Spare me some sympathy. [color=#0717ff]I have been fixing 1211 abends for 3 days solid due to ridiculous trading.[color] Please don't let the US Credit Rating be lowered again. Am I too old to cope with this all night working.

    Chris Trayler

    Desperately holding a Swiss Bank together with no sleep. But at least I get paid in Swiss Francs.