Regulating file access rates according to file type

File access rates of processes are regulated according to file type. An association table stores entries associating processes to be regulated with specific access rates for various file types. System calls that access files are intercepted, and a system call wrapper executes. The system call wrapper determines the type of file that is being accessed by the process. The system call wrapper examines the association table in order to determine if the calling process is associated with an access rate for the file type being accessed. If so, the system call wrapper regulates access to the file according to the appropriate rate.

BACKGROUND

1. Field of Invention

The present invention relates generally to regulating access rates in a computer system, and specifically to regulating file access rates of software processes according to file type.

2. Background of Invention

Multitasking operating systems such as UNIX® and Microsoft WINDOWS NT®are widely utilized in commercial computing systems. Among their many commercial uses, these operating systems are commonly deployed on Internet and other network server computers. With the popularity and success of the Internet, server computer operating systems are currently of great commercial importance.

One function of a multitasking operating system is to allocate system resources to the multiple software processes that simultaneously execute under the control of the operating system. Control over the allocation of system resources by an operating system is commercially useful for a number of reasons. Multitasking operating system are commonly used on Internet web servers by Internet Service Providers (ISP's). Where an ISP provides host services to multiple customers on a single physical computer, it is desirable to allot to each virtual host a specific amount of computer resources appropriate to the needs of the customer, and preferably based upon the amount paid for the services.

For example, suppose two customers purchase host services from an ISP. The first customer is a large corporation providing financial services to thousands of clients internationally. The financial services host requires fast file access, as well as prompt response time to all client requests. Of course, the first customer is willing to compensate the ISP appropriately for providing such a level of host services. The second customer is a sole proprietorship that sells floral arrangements locally. The second customer has a very limited budget, but only requires minimal computer resources. Clearly, it is desirable for the ISP to allocate different percentages of the system resources to the two separate virtual hosts provided by the ISP for the two separate customers.

In the example above, the ISP may wish to provide the financial services host with the ability to access files at the rate of 1,000 bytes per second, but to allow the florist to access files at the rate of only 150 bytes per second. These different access rates would be based upon the different needs of the two customers, and the corresponding different compensation schemes of each. As multitasking operating systems operate today, it would be impossible for the ISP to regulate the file access rates of the different customers. Each process associated with either virtual host simply accesses the file system at the same unregulated rate, and thus it is impossible for the ISP to guarantee or restrict access rates based upon customer need and corresponding financial arrangement. What is needed is a method that facilitates the regulation of the rate at which individual processes access the file system of a multitasking operating system.

Many commercially popular operating systems such as UNIX® and Microsoft WINDOWS NT® treat communication channels as files. In such an operating system, when a process instructs the operating system to create a communication channel, the operating system returns a file descriptor. The communication channel is subsequently accessed via the file descriptor, in a similar manner as a file stored on media.

Communication channels and files stored on media are inherently different, despite the fact that both are accessed via file descriptors. It is often desirable to for an ISP to allow a single process to access files stored on media at one rate, and to access communication channels at another. For example, a customer of the ISP may need to receive and respond to client requests very quickly, but need only an average access time for files stored on the system storage device(s). Such a customer would require (and be willing to pay for) a fast communication channel access rate, but only need (and be willing to pay for) a slower access rate to files stored on media.

Multitasking operating systems today are not capable of regulating the file access rates of different processes generally, much less facilitating different access rates for specific processes based on file type. Currently, each process accesses both files stored on media and communication channels at unregulated rates, not controlled by the operating system. Thus, it is impossible for the ISP to provide customers with different access rates for files stored on media and for communication channels, based upon customer need and corresponding financial arrangement. What is further needed is a method that not only facilitates the regulation of the rate at which individual processes access the file system of a multitasking operating system, but which also allows processes to be regulated to different access rates for different file types.

It is further desirable to not only be able to set separate access rates for communication channels and files stored on media, but to be able set separate access rates for file types generally. Under some operating systems, entities other than communication channels and files stored on media are treated as files, and hence need separate access rates. For example, under the UNIX® operating system, hardware devices are treated as files. For the same reasons that it is desirable to set separate access rates for communication channels and files stored on media, it is further desirable to be able to set a separate access rate for any type of file. Accordingly, what is needed is a method to set separate access rates for individual processes according to file type.

SUMMARY OF INVENTION

The present invention allows regulation of the file access rates of processes according to file type. An association data structure stores associations between processes to be regulated and specific access rates for various file types. In order to regulate processes to their associated access rates, system calls that access files are intercepted. When a process to be regulated makes a system call that accesses a file, the system call is intercepted, and a system call wrapper executes instead. The system call wrapper determines the type of file that is being accessed by the process. The system call wrapper examines the association table in order to determine if the calling process is associated with an access rate for that file type. If not, then the process is not to be regulated for that file type, in which case the system call wrapper simply allows the file access to proceed. Otherwise, the system call wrapper regulates the rate of the access to the file according to the appropriate rate.

DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

I. System Overview

FIG. 1illustrates a high level overview of a system100for regulating file access rates of processes107based upon file type according to one embodiment of the present invention. A computer memory101includes user address space103and operating system address space105. A process107executes in user address space103. AlthoughFIG. 1illustrates only a single process107executing in user address space103, it is to be understood that within a given computer memory101, multiple processes107can execute simultaneously.

Preferably, a data structure for storing associations129between processes107and access rates for file types is inserted into the operating system117. In one embodiment, the data structure is an association table127, but in other embodiments other data structures are utilized, for example a linked list. In one embodiment, the association table127(or other data structure) is dynamically loaded into the operating system kernel109, while the kernel109is active. In another embodiment, the association table127is stored in user address space103. The maintenance and use of the association table127is discussed in detail below.

In order to regulate file access rates, system calls115that access files are intercepted. A system call wrapper111is utilized in order to intercept system calls115. In one embodiment, the system call wrapper111is dynamically loaded into the operating system kernel109, while the kernel109is active. In another embodiment, the system call wrapper is loaded in user address space103. The system call wrapper111is preferably in the form of object code, the functional features of which are described in detail below.

Pointers114to system calls115are located in an operating system call vector table113. It is to be understood that the term “system call vector table” as used herein denotes an area in operating system address space105in which there are stored the addresses of system calls. In the UNIX® operating system, this part of the operating system is called the “system call vector table,” and that term is used in this specification. Other operating systems employ different terminology to denote the sane system component. A system call vector table by any other name is still within the scope of the present invention.

A copy116is made of a pointer114to each system call115to be intercepted. These copies116of pointers114are preferably stored in operating system address space105, but in an alternative embodiment are stored in user address space103. Once the copies116have been made and saved, the pointers114in the system call vector table113to the system calls115to be intercepted are replaced with pointers118to the system call wrapper111, such that when a system call115to be intercepted is made, the system call wrapper111executes instead. In one embodiment, this copying, storing, and replacing of pointers is performed by the system call wrapper111. In other embodiments, copying, storing, and replacing of pointers is performed by a pointer management module executing in either operating system address space105or user address space103as desired. The pointer management module can either be a stand alone program, or a component of a larger application program as desired.

Executing alternative code when a system call115is made comprises intercepting the system call115. The steps of inserting a system call wrapper111into the operating system117, making a copy116of an operating system pointer114to a system call115, and replacing the operating system pointer114with a pointer118to the system call wrapper111facilitate interception of a system call115. When a system call115to be intercepted is made, the operating system117uses the pointer118in the system call vector table113to the system call wrapper111to execute the system call wrapper111.

It is to be understood that only system calls115that access files need be intercepted, and thus only pointers114to system calls115to be intercepted are replaced with pointers118to the system call wrapper111. Pointers114to system calls115which are not to be intercepted are not replaced. Thus, when a non-intercepted system call115is made, the system call115executes, not the system call wrapper111.

In one embodiment, a single system call wrapper111is loaded into operating system address space105. Thus, whenever any process107makes a system call115to be intercepted, the system call wrapper111executes. In another embodiment, techniques described in the “Selective Interception of System Calls” application are used to associate a specific system call wrapper111with each process to be regulated.

Processes107execute in user address space103under control of the operating system117, and make system calls115. When a process makes a system call115that accesses a file, the system call wrapper111determines the type of the file being accessed. The system call wrapper111also examines the association table127to determine whether the process107that made the system call115is associated with an access rate for that file type. If so, the system call wrapper111regulates the file access rate appropriately. Otherwise, the access is allowed to proceed normally. Note that even in the embodiment in which processes107to be regulated are associated with individual system call wrappers111, the system call wrapper still determines if the process107is associated with a rate for the file type being accessed, because an individual process107may be regulated for some file types and not for others.

II. Storing Associations by a Regulator Program

FIG. 2illustrates one embodiment of a system200for regulating file access rates of processes107based upon file type. In the embodiment illustrated byFIG. 2, the association table127is managed by an access rate regulator program201.

The access rate regulator program201modifies the operating system117of the computer to include the association table127. Preferably, the regulator program201loads the association table127into the kernel109of the operating system117while the kernel is active.

For each process107to be regulated, the regulator program201stores, in the association table127, an association129between the process107and an access rate for at least one file type. For example, suppose a process107associated with a financial services host is to be regulated to 1,000 bytes per second for files stored on media, and to 1,400 bytes per second for communication channels. The regulator program201would store two associations for the process107, the first indicating the access rate for files stored on media (1,000 bytes per second), and the second the access rate for communication channels (1,400 bytes per second). Of course, the regulator program201can add, modify, and delete associations129from the association table127, as desired.

III. Storing Associations by a Loader Program

FIG. 3illustrates another embodiment of a system300for regulating file access rates of processes107based upon file type. In the embodiment illustrated byFIG. 3, processes107to be regulated are loaded by the modified loader program301, which also stores the associations129.

A loader program is an operating system utility that is used to execute computer programs that are stored on static media. Typically, a loader program loads an executable image from static media into user address space103of computer memory101, and then initiates execution of the loaded image by transferring execution to the first instruction thereof.

Like a standard loader program, the modified loader301loads executable images from static media into user address space103. Additionally, the modified loader program301stores, in the association table127, at least one association129between the process107and a file access rate. Thus, whenever a process107to be regulated is loaded, the association table127is updated as needed.

In other embodiments, in addition to storing associations, the modified loader program301uses methodology described in detail in the “Selective Interception of System Calls” application in order to associate an individual system call wrapper111with the loaded process107. In different embodiments, the system call wrapper111associated with the process is loaded into process address space of the process, user address space103, or operating system address space105as described in the “Selective Interception of System Calls” application. In each of these embodiments, whenever the process107makes a system call115to be intercepted (i.e., a system call115that accesses a file) the system call wrapper111associated with the process107executes, and proceeds to manage the regulation of the file access rate. Regulation of file access rate by system call wrappers111generally is discussed in detail below.

IV. Determining the File Type

When a system call wrapper111executes, the system call wrapper determines the type of the file being accessed. Once the file type has been determined, the system call wrapper111examines the association table127to determine whether the process107that made the system call115is associated with an access rate for that file type. If so, the system call wrapper111regulates the file access rate appropriately. Otherwise, access of files of that type by the process107is not to be regulated, so the access is allowed to proceed normally. In one embodiment, the determination is made using methodology described in the “Disambiguating File Descriptors” application. Other techniques such as file extension or file name can also be used as desired.

V. Regulating the Access Rate

FIG. 4illustrates one embodiment of a system400for regulating file access rate. After determining the file type being accessed, the system call wrapper111executes a file access rate regulation module401in order to regulate the access rate of the file403by the process107. In one embodiment, the file access rate regulation module401executes in operating system address space105, as illustrated in FIG.4. In another embodiment, the file access rate regulation module401executes in user address space103. The file access rate regulation module401can either be a section of the system call wrapper (as illustrated), a stand alone program, or a component of a larger application program as desired. In any case, the file access rate regulation module401applies a known rate regulation technique to the access of the file403by the process107. More specifically, data being written to the file403by the process (input to the file405) is routed through the file access rate regulation module401. The file access rate regulation module401controls the rate at which the input405is sent to the file403by the process. Likewise, data read by the process107from the file (output from the file407) is also routed through the file access rate regulation module401, which controls the rate at which the output407is sent to the process107.

Many techniques for regulating access rate are known. In one embodiment, the file access rate regulation module401uses a leaky-bucket regulator to regulate the access rate. A leaky-bucket regulator is one specific example of a technique for regulating access rates. A leaky-bucket regulator is described inAn Engineering Approach to Computer Networking, Srinivasan Keshav, 1997, Addison Wesley, Chapter 7, at pp 403-405, which is incorporated herein by reference.

FIG. 5illustrates a leaky-bucket regulator501. As illustrated inFIG. 5, the leaky-bucket regulator501stores fixed sized tokens503in a data structure known as a token (or leaky) bucket505. Each token503constitutes permission for the regulator501to send a certain number of bits to a destination. The regulator501adds tokens503to the bucket505at a fixed rate, R. The bucket505overflows if the number of tokens503crosses some threshold, called its depth, D.

Data arrives at the regulator501as input507from a source. A test module509examines the bucket505, to determine the sum of the sizes of the tokens503therein. The regulator501only sends the data as output to a destination511if the sum equals or exceeds the size of the data. When data is sent as output511, the regulator501removes tokens503corresponding to the output511size from the token bucket505.

If the sum is less than the size of the input507, the input507is held as stored data513in a data buffer515. Once the bucket505contains sufficient tokens503, the stored data513is sent as output511.

A leaky-bucket regulator501limits the size of a burst of output511to a little more D. The size can be slightly greater than D because tokens503may be added to the bucket505while output511equal in size to D is being sent. Over the long term, the rate at which output511is sent by the regulator501is limited by the rate R at which tokens503are added to the bucket505. Thus, the leaky-bucket regulator501can be used to regulate a process107to an access rate for a file type by setting R to that access rate.

For example, suppose the system call wrapper111determines that the file access write for a process107is 1,000 bytes per second. The system call wrapper passes the rate to the leaky-bucket regulator501, which proceeds to set R to the rate. Thus, the regulator501adds 1,000 byte tokens503to a bucket505at a rate of once per second. The system call wrapper111then routes the communication between the process107and the file through the regulator501, which regulates the access rate to 1,000 bytes per second.

Note that if the process107is writing data to a file403, the input to the file405becomes the input507to the leaky bucket regulator501, and the output511from the leaky bucket regulator501is sent to the file403. On the other hand, if the process107is reading data from a file403, the output from the file407becomes the input507to the leaky bucket regulator501, and the output511from the leaky bucket regulator501is sent to the process107.

In other embodiments, other access rate techniques are employed by the file access rate regulation module401, for example moving average, jumping average, or peak rate.

As will be understood by those familiar with the art, the invention may be embodied in other specific forms without departing from the spirit or essential characteristics thereof. Likewise, the particular capitalization or naming of the modules, protocols, features, attributes or any other aspect is not mandatory or significant, and the mechanisms that implement the invention or its features may have different names or formats. Accordingly, the disclosure of the present invention is intended to be illustrative, but not limiting, of the scope of the invention, which is set forth in the following claims.