---
title: "sys.dm_os_waiting_tasks (Transact-SQL) | Microsoft Docs"
ms.custom: ""
ms.date: "03/13/2017"
ms.prod: "sql-non-specified"
ms.reviewer: ""
ms.suite: ""
ms.technology:
- "database-engine"
ms.tgt_pltfrm: ""
ms.topic: "language-reference"
f1_keywords:
- "dm_os_waiting_tasks"
- "sys.dm_os_waiting_tasks_TSQL"
- "dm_os_waiting_tasks_TSQL"
- "sys.dm_os_waiting_tasks"
dev_langs:
- "TSQL"
helpviewer_keywords:
- "sys.dm_os_waiting_tasks dynamic management view"
ms.assetid: ca5e6844-368c-42e2-b187-6e5f5afc8df3
caps.latest.revision: 30
author: "JennieHubbard"
ms.author: "jhubbard"
manager: "jhubbard"
---
# sys.dm_os_waiting_tasks (Transact-SQL)
[!INCLUDE[tsql-appliesto-ss2008-all_md](../../includes/tsql-appliesto-ss2008-all-md.md)]
Returns information about the wait queue of tasks that are waiting on some resource.
> [!NOTE]
> To call this from [!INCLUDE[ssSDWfull](../../includes/sssdwfull-md.md)] or [!INCLUDE[ssPDW](../../includes/sspdw-md.md)], use the name **sys.dm_pdw_nodes_os_waiting_tasks**.
|Column name|Data type|Description|
|-----------------|---------------|-----------------|
|**waiting_task_address**|**varbinary(8)**|Address of the waiting task.|
|**session_id**|**smallint**|ID of the session associated with the task.|
|**exec_context_id**|**int**|ID of the execution context associated with the task.|
|**wait_duration_ms**|**bigint**|Total wait time for this wait type, in milliseconds. This time is inclusive of **signal_wait_time**.|
|**wait_type**|**nvarchar(60)**|Name of the wait type.|
|**resource_address**|**varbinary(8)**|Address of the resource for which the task is waiting.|
|**blocking_task_address**|**varbinary(8)**|Task that is currently holding this resource|
|**blocking_session_id**|**smallint**|ID of the session that is blocking the request. If this column is NULL, the request is not blocked, or the session information of the blocking session is not available (or cannot be identified).
-2 = The blocking resource is owned by an orphaned distributed transaction.
-3 = The blocking resource is owned by a deferred recovery transaction.
-4 = Session ID of the blocking latch owner could not be determined due to internal latch state transitions.|
|**blocking_exec_context_id**|**int**|ID of the execution context of the blocking task.|
|**resource_description**|**nvarchar(3072)**|Description of the resource that is being consumed. For more information, see the list below.|
|**pdw_node_id**|**int**|**Applies to**: [!INCLUDE[ssSDWfull](../../includes/sssdwfull-md.md)], [!INCLUDE[ssPDW](../../includes/sspdw-md.md)]
The identifier for the node that this distribution is on.|
## resource_description column
The resource_description column has the following possible values.
**Thread-pool resource owner:**
- threadpool id=scheduler\
**Parallel query resource owner:**
- exchangeEvent id={Port|Pipe}\ WaitType=\ nodeId=\
**Exchange-wait-type:**
- e_waitNone
- e_waitPipeNewRow
- e_waitPipeGetRow
- e_waitSynchronizeConsumerOpen
- e_waitPortOpen
- e_waitPortClose
- e_waitRange
**Lock resource owner:**
- \ id=lock\ mode=\ associatedObjectId=\
**\ can be:**
- For DATABASE: databaselock subresource=\ dbid=\
- For FILE: filelock fileid=\ subresource=\ dbid=\
- For OBJECT: objectlock lockPartition=\ objid=\ subresource=\ dbid=\
- For PAGE: pagelock fileid=\ pageid=\ dbid=\ subresource=\
- For Key: keylock hobtid=\ dbid=\
- For EXTENT: extentlock fileid=\ pageid=\ dbid=\
- For RID: ridlock fileid=\ pageid=\ dbid=\
- For APPLICATION: applicationlock hash=\ databasePrincipalId=\ dbid=\
- For METADATA: metadatalock subresource=\ classid=\ dbid=\
- For HOBT: hobtlock hobtid=\ subresource=\ dbid=\
- For ALLOCATION_UNIT: allocunitlock hobtid=\ subresource=\ dbid=\
**\ can be:**
Sch-S, Sch-M, S, U, X, IS, IU, IX, SIU, SIX, UIX, BU, RangeS-S, RangeS-U, RangeI-N, RangeI-S, RangeI-U, RangeI-X, RangeX-, RangeX-U, RangeX-X
**External resource owner:**
- External ExternalResource=\
**Generic resource owner:**
- TransactionMutex TransactionInfo Workspace=\
- Mutex
- CLRTaskJoin
- CLRMonitorEvent
- CLRRWLockEvent
- resourceWait
**Latch resource owner:**
- \:\:\
- \
- \ (\)
## Permissions
On [!INCLUDE[ssNoVersion_md](../../includes/ssnoversion-md.md)], requires `VIEW SERVER STATE` permission.
On [!INCLUDE[ssSDS_md](../../includes/sssds-md.md)] Premium Tiers, requires the `VIEW DATABASE STATE` permission in the database. On [!INCLUDE[ssSDS_md](../../includes/sssds-md.md)] Standard and Basic Tiers, requires the **Server admin** or an **Azure Active Directory admin** account.
## Example
This example will identify blocked sessions. Execute the [!INCLUDE[tsql](../../includes/tsql-md.md)] query in [!INCLUDE[ssManStudioFull](../../includes/ssmanstudiofull-md.md)].
```tsql
SELECT * FROM sys.dm_os_waiting_tasks
WHERE blocking_session_id IS NOT NULL;
```
## See Also
[SQL Server Operating System Related Dynamic Management Views (Transact-SQL)](../../relational-databases/system-dynamic-management-views/sql-server-operating-system-related-dynamic-management-views-transact-sql.md)