MSSQL一直以来被人们认为简单、好学,但等到大家掌握了入门操作,深入理解起来又觉得非常的“拧巴”,尤其是对用惯了Oracle的同学来说,究其根本原因,无非是MSSQL引入和暴露了太多的概念、细节和理论层,而Oracle恰恰屏蔽了这些,比如下面讲到的这些概念,即使是使用很久MSSQL的同学来说,也未必就真理解的正确,下面这段文字,很好的解释了MSSQL中的几个基本概念:

Scheduler (SOS Scheduler)– the object that manages thread scheduling in SQL Server and allows threads to be exposed to the CPU (described in sys.dm_os_schedulers). This is the all-powerful but benign and graceful master whom everyone abides.  He does not control things but lets the workers work with each other and relies on their cooperation (co-operative scheduling mode). Each scheduler /master (one per logical CPU) accepts new tasks and hands them off to workers. SOS Scheduler allows one worker at a time to be exposed to the CPU.

Task –a task represents the work that needs to be performed (sys.dm_os_tasks). A task contains one of the following requests: query request (RPC event or Language event), a prelogin request (prelogin event),  a login request (connect event), a logout request (disconnect event), a query cancellation request (an Attention event), a bulk load request (bulk load event), a distributed transaction request (transaction manager event). A task is what the Master is about – it is what defines its existence. Note these are tracked at the SOS scheduler layer (thus dm_OS_tasks)

Worker (worker thread) – This is the logical SQL Server representation of a thread (think of it as a wrapper on top of the OS thread). It is a structure within the Scheduler which maintains SQL Server-specific information about what a worker thread does. sys.dm_os_workers. Workers are the humble servants who carry out the task assigned to them by the Master (scheduler).

Thread – this is the OS thread sys.dm_os_threads that is created via calls like CreateThread()/_beginthreadex(). A Worker is mapped 1-to-1 to a Thread.

Request is the logical representation of a query request made from the client application to SQL Server (sys.dm_exec_requests). This query request has been assigned to a task that the scheduler hands off to a worker to process. This represents query requests as well as system thread operations (like checkpoint, log writer, etc); you will not find login, logouts, attentions and the like here. Also, note that this is a representation at the SQL execution engine level (thus dm_EXEC_requests) not at the SOS Scheduler layer.

Sessions – when the client application connects to SQL Server the two sides establish a "session" on which to exchange information. Strictly speaking a session is not the same as the underlying physical connection, it is a SQL Server logical representation of a connection. But for practical purposes, you can think of this as being a connection (session =~ connection). See sys.dm_exec_sessions. This is the old SPID that existed in SQL Server 2000 and earlier. You may sometimes notice a single session repeating multiple times in a DMV output. This happens because of parallel queries. A parallel query uses the same session to communicate with the client, but on the SQL Server side multiple worker (threads) are assigned to service this request. So if you see multiple rows with the same session ID, know that the query request is being serviced by multiple threads.

Connections – this is the actual physical connection established at the lower protocol level with all of its characteristics sys.dm_exec_connections . There is a 1:1 mapping between a Session and a Connection.tr

Scheduler & Task & Worker & Thread & Request & Session & Connection of SQL Server的更多相关文章

  1. 【总算解决了】A network-related or instance-specific error occurred while establishing a connection to SQL Server

    给别人做的网站莫名其妙连接不上数据库.百度了好多,总算知道自己的错在哪了. 报 "A network-related or instance-specific error occurred  ...

  2. 【SQL Server 问题记录】A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible.

    本文涉及的相关问题,如果你的问题或需求有与下面所述相似之处,请阅读本文 A network-related or instance-specific error occurred while esta ...

  3. idea Connection to SQL Server - 公网8 failed java

    Connection to SQL Server - 公网8 failed java.sql.SQLException: I/O Error: SSO Failed: Native SSPI libr ...

  4. A network-related or instance-specific error occurred while establishing a connection to SQL Server

    今天同事给我发了个图片过来,  服务器环境 sql 2000 + IIS7 看到这张图片,我先自己试了下,确实是有这个问题的,而且不是偶然性的,那么再看报错意思,在跟sql建立连接的时候发生了一个错误 ...

  5. Tosca Connection Validation error:40 - Could not open a connection to SQL Server (不知道怎么解决)

    谁知道下面这个错怎么解决,请给我留言,谢谢. 数据库能正常链接,服务也是 normal running

  6. Do waiting or suspended tasks tie up a worker thread?

      https://blogs.msdn.microsoft.com/askjay/2012/07/29/do-waiting-or-suspended-tasks-tie-up-a-worker-t ...

  7. WPF数据库连接错误:The user is not associated with a trusted SQL Server connection.

    我当初安装sql server的时候选的Window Authentication mode,没选SQL Server Windows Authentication. 后来做WPF时连接数据库时需要一 ...

  8. Exception thrown on Scheduler.Worker thread. Add `onError` handling

    <html> <head></head> <body> java.lang.IllegalStateException: Exception throw ...

  9. MS SQL错误:SQL Server failed with error code 0xc0000000 to spawn a thread to process a new login or connection. Check the SQL Server error log and the Windows event logs for information about possible related problems

          早晨宁波那边的IT人员打电话告知数据库无法访问了.其实我在早晨也发现Ignite监控下的宁波的数据库服务器出现了异常,但是当时正在检查查看其它服务器发过来的各类邮件,还没等到我去确认具体情 ...

随机推荐

  1. npm介绍和使用

    # npm 介绍 > 概念 : node 包管理工具 > 作用 : 通过 npm 来快速下载/安装项目中依赖的包 > 查看 版本号 : npm -v     # npm 基本使用演示 ...

  2. Android 4.0之后的日历控件拥挤的解决办法

    本意是想做成这个样子的控件: 发现使用datepicker之后,效果完全不同,把整个日历都显示出来了.非常拥挤. 在datepicker中加入android:calendarViewShown=&qu ...

  3. CZK 的饮料店

    [题目描述] 一天,小学生 cyx 向你请教了一道他不会做的小学数学题,你瞄了一眼题目,发现题目长下面这样. czk 老板开了个饮料连锁店,连锁店共有 n 家,出售的饮料种类相同. 为了促销,czk ...

  4. Python安装第三方库的安装技巧

    电脑:Windows10 64位. Python IDE 软件:JetBrains PyCharm Community Edition 2018.1.3 x64 Python version : Py ...

  5. MySql登陆密码忘记了怎么办?MySQL重置root密码方法

    本文主要介绍Windows和Linux系统下忘记密码重置root密码的方法,需要的朋友可以参考下. MySQL有时候忘记了root密码是一件伤感的事.这里提供Windows 和 Linux 下的密码重 ...

  6. ubuntu 安装cuda 9.1 pytorch 0.3.0

    毕业再没用配过机器学习的环境了,既亲切又陌生,久违了. 系统 mint18  x64 1安装cuda 按官网提示 选的9.1版  https://developer.nvidia.com/cuda-t ...

  7. 用友u8采购发票如何取消审核

    流程是应付系统---应付单据审核---过滤---选择日期+已审---选择相应发票---弃审

  8. Codeforces 1072 C - Cram Time

    C - Cram Time 思路:首先找到最大的x,使得x*(x+1)/2 <= a+b 那么一定存在一种分割使得 a1 <= a 且 b1 <= b 证明: 从x 到 1枚举过去, ...

  9. JAVA基础知识总结:十七

    一.转换流 作用:实现将字节流转换为字符流 a.InputStreamReader:字节字符转换输入流:字节输入流----->字符输入流 b.OutputStreamWriter:字节字符转换输 ...

  10. (转)stm32硬件IIC

    cube与I2C:https://www.cnblogs.com/121792730applllo/p/5044920.html I2C官网:https://www.i2c-bus.org/stand ...