Difference between Runnable, Running, Conditional

  • Hi all,

    Would you plz, let me know difference between Runnable, Running, Conditional while query is executing?

  • I have never heard of conditional. Regarding running vs runnable taken from http://www.sqlskills.com/blogs/paul/wait-statistics-or-please-tell-me-where-it-hurts/ :

    "A thread is using the CPU (called RUNNING) until it needs to wait for a resource. It then moves to an unordered list of threads that are SUSPENDED. In the meantime, the next thread on the FIFO (first-in-first-out) queue of threads waiting for the CPU (called being RUNNABLE) is given the CPU and becomes RUNNING".

  • but I have conditional state !

  • Never heard of conditional. The states that a process may be in are running, runnable, suspended, background (for system processes) and sleeping.

    https://msdn.microsoft.com/en-us/library/ms177648.aspx

    Running means just that, the process is on the CPU, currently working.

    Runnable means it's waiting to be scheduled on to the CPU.

    Suspended means it's waiting for something (eg lock, latch, memory grant, etc)

    Sleeping is a session that has no work to do, no query to run.

    Conditional is not an execution state for a thread/process.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Hi,

    Gail and BL0B_EATER are right, no such thing as Conditional process status.

    I assume you are using sp_who2 or the Activity monitor.

    Are you sure you are checking the 'Status' column and not the 'Command'?

    CONDITIONAL in the 'Command' column could be shown when you use IF or WHILE statements. Also can be caused by some nasty cursor in you query.

    eg.: Status:RUNNABLE DBName: AdventureWorksDW2012Command:CONDITIONAL

    I just wrote a very basic (non-sense) long running WHILE statement for demonstration.

    Can you check what is the running query with your 'CONDITIONAL' finding?

    ________________________________________________________________
    "Accept conditions as they exist, or accept the responsibility for changing them."

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply