Home > Articles > Operating Systems, Server > Microsoft Servers

  • Print
  • + Share This

Resource Charges and Quotas

If a process opens a handle to an object, the process must "pay" for the usage of system resources caused by this operation. The paid dues are called charges, and the upper limit a process may spend for resources is called quota. By default, an object's OBJECT_TYPE determines the charges to be applied for paged/non-paged pool usage and security. However, this default can be overridden by adding an OBJECT_QUOTA_CHARGES structure to the object header. The location of this data relative to the OBJECT_HEADER base address is specified by the QuotaChargesOffset member of the OBJECT_HEADER as an inverse offset, as usual. Listing 5 shows the structure definition. The usages of the paged and non-paged pools are charged separately. If the object requires security, an additional SecurityCharge is added to the paged-pool usage. The default security charge is 0[ts]800.

Listing 5 The OBJECT_QUOTA_CHARGES Structure

#define OB_SECURITY_CHARGE 0x00000800

typedef struct _OBJECT_QUOTA_CHARGES
    {
/*000*/ DWORD PagedPoolCharge;
/*004*/ DWORD NonPagedPoolCharge;
/*008*/ DWORD SecurityCharge;
/*00C*/ DWORD Reserved;
/*010*/ }
    OBJECT_QUOTA_CHARGES,
   * POBJECT_QUOTA_CHARGES,
  **PPOBJECT_QUOTA_CHARGES;

If the OB_FLAG_CREATE_INFO bit of the ObjectFlags in the OBJECT_HEADER is zero, the QuotaBlock member points to a QUOTA_BLOCK structure (Listing 6) that contains statistical information about the current resource usage of the object.

Listing 6 The QUOTA_BLOCK Structure

typedef struct _QUOTA_BLOCK
    {
/*000*/ DWORD Flags;
/*004*/ DWORD ChargeCount;
/*008*/ DWORD PeakPoolUsage [2]; // NonPagedPool, PagedPool
/*010*/ DWORD PoolUsage   [2]; // NonPagedPool, PagedPool
/*018*/ DWORD PoolQuota   [2]; // NonPagedPool, PagedPool
/*020*/ }
    QUOTA_BLOCK,
   * PQUOTA_BLOCK,
  **PPQUOTA_BLOCK;
  • + Share This
  • 🔖 Save To Your Account

Related Resources

There are currently no related titles. Please check back later.