Quantcast
Channel: Forum SQL Server Database Engine
Viewing all articles
Browse latest Browse all 15694

Task versus Request -- referring to sys.dm_os_tasks v/s sys.dm_exec_requests

$
0
0

Hello...I am struggling to understand the definition of and difference between a task and a request. My understanding is

Task is something that is active and may or may not be executedin SQL Server later. SQL Server creates multiple tasks from a single batch to assign the task to sql server threads (for parallel execution, if possible). Per MSDN,sys.dm_os_tasks Returns one row for each task that is active in the instance of SQL Server.

Request is a Task that is being executed by SQL Server. Per MSDN,sys.dm_exec_requests Returns information about each request that is executing within SQL Server.

Questions-

1. Per MSDN sys.dm_exec_requests; Returns information about eachrequest that is executing within SQL Server. Why does not it say "Returns information about eachtask that is executing within SQL Server". Is there some catch here, for using different terms. Had they used task, it would mean that the task itself is being executed. But using the new term request, is confusing.. do they mean something else by the term Request?

2. I see few Tasks that are not there in requests view, and are suspended. What are these tasks? If its assumed that these are not being executed currently so this list shows up. But I see this list is consistently in suspended. What are these tasks waiting for?

SELECT *
FROM   sys.dm_os_tasks
WHERE  task_address NOT IN (SELECT task_address
                            FROM   sys.dm_exec_requests)
       AND task_state = 'SUSPENDED' 

3. Extending question no 2, there are tasks that are in SUSPENDED state in sys.dm_os_tasks, but not at exist in sys.dm_os_waiting_tasks. Why?? What are these tasks? Below is the T-SQL for that.

SELECT *
FROM   sys.dm_os_tasks
WHERE  task_address NOT IN (SELECT task_address
                            FROM   sys.dm_exec_requests)
       AND task_state = 'SUSPENDED' 
AND task_address NOT IN (
						select waiting_task_address from sys.dm_os_waiting_tasks )





Viewing all articles
Browse latest Browse all 15694

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>