INF: Information on CPU and Physical_io Columns of SysprocessesID: Q170360
|
The CPU and physical_io columns of the sysprocesses system table are often queried to inspect the status of running processes. SQL Enterprise Manager queries these columns when you click Current Activity on the Server menu, and then click the Detail Activity tab. If an operation is taking a long time to complete, some questions may arise about the meaning of these columns and how the information is calculated. This article is intended to provide answers to these questions.
Each database connection forms a row in sysprocesses, sometimes called a
Server Process ID, or spid. In SQL Server terminology, each connection is
also called a "process," but this does not imply a separate process context
in the usual sense. In SQL Server 6.0 and 6.5, each process is roughly
analogous to and serviced by a separate operating system thread. Each
database connection also consists of server data structures that keep track
of process status, transaction state, locks held, and so on. One of these
structures is called the Process Slot Structure (PSS), of which there is
one per connection. The server scans the list of PSSs to materialize the
sysprocesses virtual table. The CPU and physical_io columns from
sysprocesses are derived from the equivalent values in each PSS.
Sysprocesses.cpu indicates the CPU milliseconds of user-mode time the
process has consumed. It is derived from the Win32 API GetThreadTimes().
See the Win32 documentation for more details. Sysprocesses.cpu is updated
at the start of each language or remote procedure call (RPC) event, when
doing cursor asynchronous keyset generation, or when sending a data buffer
or done token to the client. See the SQL Server documentation under "Open
Data Services" for details on language and RPC events.
Therefore, sysprocesses.cpu is accurate but only updated at certain points.
For lengthy operations that do not return any data to the client, it may
not be updated for long intervals of time. Some of these operations may
include DBCC CHECKDB, CREATE INDEX, database recovery, long-running joins,
and so on. From a practical standpoint, it may often appear to be updated
only at the end of each command.
If you need to determine if a spid is consuming CPU resources under
conditions where sysprocesses.cpu is not incrementing, you can do this by
correlating the spid to a particular operating system thread and inspecting
it with Windows NT Performance Monitor. For more information, see the
following article in the Microsoft Knowledge Base:
Q117559 : How to Correlate Spid, Kpid, and Thread Instance
Additional query words: column
Keywords : kbusage SSrvGen
Version : WINNT:6.5 6.0
Platform : winnt
Issue type : kbinfo
Last Reviewed: April 17, 1999