session id null in sys.dm_os_tasks
The session is sleeping if the session_id value of sys.dm_os_tasks is NULL. This is stated in the link above under the Examples section: Associating Session IDs with Windows threads.


  The following query does not return information for sessions that are
  sleeping.