A system, method and medium for reducing the number of system calls from an application program to an operating system kernel. In an embodiment, a method includes the steps of creating a list of requests issued by an application program, associating an indicia with the list indicating whether the list contains a request, querying the indicia to determine if the list contains a request, and adding a new application program request to the list when the indicia indicates that the list includes a request.

Patent
   8141077
Priority
Feb 17 2005
Filed
Mar 12 2010
Issued
Mar 20 2012
Expiry
Aug 26 2025
Extension
190 days
Assg.orig
Entity
Large
1
24
EXPIRED<2yrs
1. A method for reducing the number of calls from an operating system to an application program, comprising the steps of:
associating in the operating system at least one indicia with a first request to access hardware, the indicia indicating a type of notification to be provided by the operating system to the application program upon completion of the first request;
receiving from the application program a second request; and
based on the second request, de-associating one or more of the at least one indicia from the first request so that notification no longer needs to be provided by the operating system to the application program upon completion of the first request,
wherein the indicia comprises a flag, the notification comprises an operating system call, and the first request and the second request comprise input-output requests received from the application program.
13. A method for reducing the number of calls from an operating system to an application program, comprising the steps of:
associating in the operating system at least one indicia with a first request to access hardware, the indicia indicating a type of notification to be provided by the operating system to the application program upon completion of the first request;
receiving from the application program a second request, the first request and the second request comprising a table; and
based on the second request, de-associating one or more of the at least one indicia from the first request so that notification no longer needs to be provided by the operating system to the application program upon completion of the first request,
wherein the notification comprises an operating system call, and the first request and the second request includes input-output requests received from the application program.
12. A method for reducing the number of calls from an operating system to an application program, comprising the steps of:
associating in the operating system at least one indicia with a first request to access hardware, the indicia indicating a type of notification to be provided by the operating system to the application program upon completion of the first request;
receiving from the application program a second request, the first request and the second request comprising a linked list; and
based on the second request, de-associating one or more of the at least one indicia from the first request so that notification no longer needs to be provided by the operating system to the application program upon completion of the first request,
wherein the notification comprises an operating system call, and the first request and the second request includes input-output requests received from the application program.
7. A method for reducing the number of calls from an operating system to an application program, comprising the steps of:
associating in the operating system at least one indicia with a first request to access hardware, the indicia indicating a type of notification to be provided by the operating system to the application program upon completion of the first request;
receiving from the application program a second request;
based on the second request, de-associating one or more of the at least one indicia from the first request so that notification no longer needs to be provided by the operating system to the application program upon completion of the first request; and
associating at least a portion of the indicia de-associated from the first request with the second request so that notification is provided by the operating system to the application program upon completion of the second request,
wherein the indicia comprises a flag.
5. A computer program product stored on a non-transitory computer readable medium, for use in reducing the number of calls from an operating system to an application program, the computer program product comprising instructions when executed by a processor for causing a computer to:
associate in the operating system at least one indicia with the first request, the indicia indicating a type of notification to be provided by the operating system to the application program upon completion of the first request;
receive from the application program a second request; and
based on the second request, de-associate one or more of the at least one indicia from the first request so that notification no longer needs to be provided by the operating system to the application program upon completion of the first request,
wherein the indicia comprises a flag, the notification comprises an operating system call, and the first request and the second request comprise input-output requests received from the application program.
6. A computing device using at least one software module for use in reducing the number of calls from an operating system to an application program, said computing device comprising:
at least one memory area; and
at least one processor that uses the at least one software module to (i) associate in the operating system at least one indicia with the first request, the indicia indicating a type of notification to be provided by the operating system to the application program upon completion of the first request; (ii) receive from the application program a second request; and (iii) based on the second request, de-associate one or more of the at least one indicia from the first request so that notification no longer needs to be provided by the operating system to the application program upon completion of the first request,
wherein the indicia comprises a flag, the notification comprises an operating system call, and the first request and the second request comprise input-output requests received from the application program.
2. The method according to claim 1, wherein the first request and the second request comprise a linked list.
3. The method according to claim 1, wherein the first request and the second request comprise a table.
4. The method according to claim 1, further comprising the step of associating at least a portion of the indicia de-associated from the first request with the second request so that notification is provided by the operating system to the application program upon completion of the second request.
8. The method according to claim 7, wherein the notification comprises an operating system call.
9. The method according to claim 7, wherein the first request and the second request comprise input-output requests received from the application program.
10. The method according to claim 7, wherein the first request and the second request comprise a linked list.
11. The method according to claim 7, wherein the first request and the second request comprise a table.

This application is a divisional of and claims priority to U.S. application Ser. No. 11/059,565, filed Feb. 17, 2005, now issued U.S. Pat. No. 7,779,411, the entire contents of which are incorporated herein by reference.

1. Field of the Invention

The present invention generally relates to improving operating system efficiency and, more particularly, to systems and methods for reducing the frequency of operating system calls made from and/or to a user process.

2. Background Description

FIG. 1, generally at 100, is a conventional computer system that shows the relationship between application programs 101a-n, kernel 105, and hardware 107. Application programs 101a-n can include, for example, conventional word processing, graphic and/or web browser programs, that directly interact with an end user. Application programs 101a-n are executed in user-space 103, and can be referred to as “processes,” or “tasks” when program instructions are executed by the central processing unit (CPU) (not shown).

Kernel 105 includes system call interface 109, kernel subsystems 111, and device drivers 113. Application programs 101a-n communicate with kernel 105 by making a conventional system call. System call interface 109 can receive requests from processes to access hardware 107 such as printers, monitors, storage devices and/or network devices. Kernel 105 can execute these requests via kernel subsystems 111 and device derivers 113 in a conventional manner. Kernel subsystems 111 can include interrupt handlers to service interrupt requests, a memory management system to manage address spaces, and system services such as networking and interprocess communication (IPC).

As noted above, when performing conventional asynchronous input-output (AIO) between application programs 101a-n and kernel 105, application programs 101a-n invoke a system call to kernel 105 to initiate each input-output (I/O). For example, an application program 101a-n typically calls a function in a library, such as a C library, that in turn relies on system call interface 109 to instruct kernel 105 to conduct one or more tasks on its behalf. When a system call takes place, an application program 101a-n that makes the call is suspended, and the kernel 105 takes over. The context switch from the application program 101a-n to kernel 105 is costly in terms of performance, as system calls can take, for example, 10 to 1000 times more processing time than a normal processing operation, such as a CPU adding two numbers together.

Conventional techniques attempt to reduce the number of signals by ensuring that I/O requests are as large as possible, such as by allowing submission of batches of requests at a time, and/or using larger buffers (or user cache) to capture many I/O requests in the user process space before the I/O library transfers the data out. These techniques can be effective when the needed I/O is known in advance. However, these techniques are not generally effective in a streaming request environment (such as a web server).

One or more embodiments of the present invention are directed to reducing the number of operating system calls that are made from and/or to a user process.

Embodiments of the present invention are directed to enabling less system calls to be made to an operating system when the operating system is performing asynchronous input/output with, for example, an end-user application program. It is generally desirable to minimize system calls, which can take orders of magnitude more central processing unit (CPU) time than standard CPU processing operations (e.g., adding two numbers).

In one embodiment of the present invention, a task can be added to the kernel input/output (I/O) queue while that queue of asynchronous I/O is being processed. The kernel can provide or set indicia, such as a flag, that is readable, for the example, by the application program. The flag can indicate whether or not the kernel is processing any I/O for a particular process (task). For example, while the I/O queue is being processed, the operating system kernel can receive, from an application program can, pertinent data (such as, for example, the file being written to, the data that is to be written to a file, and whether the application is to be notified upon completion of the write operation). The request is written atomically to the kernel I/O queue. When the process has a next kernel I/O request, the process examines the flag to determine if the kernel has completed I/O for the process. If the flag indicates that the I/O queue is completed for the process, the kernel receives a system call. If the flag indicates that the I/O queue is not completed, then the application program need not make a system call. When the I/O is completed, the kernel can check for race conditions. If another request is present in the I/O queue due to a race condition, the kernel can dispatch the request by using a kernel interrupt handler, rather than waiting for the application program to issue a system call to the kernel.

In other embodiments of the present invention, the kernel reduces the calls that are made to wake and notify an application program process. Each application program I/O request can contain one or more flags indicating what kind(s) of notification it requires from the kernel. The flags are read, for example, by the kernel completion handler, and can thus be dynamically modified by an application program process when a request is being added to the kernel I/O queue.

For example, if the kernel I/O queue queues a file write request, and then receives additional data to write, the kernel I/O queue may receive from the application program process a new request. Prior to or during processing of the first request, the kernel can also read the flag that has been set for the application program process, and advantageously utilize the flag to eliminate making a system call to the application program upon completion of the first request. Instead, the kernel can make a call to the application program process upon completion of processing all requests associated with a particular process within the kernel I/O queue.

There has thus been outlined, rather broadly, the features of the invention in order that the detailed description thereof that follows may be better understood, and in order that the present contribution to the art may be better appreciated. There are, of course, additional features of the invention that will be described hereinafter and which will form the subject matter of the claims appended hereto.

In this respect, before explaining at least one embodiment of the invention in detail, it is to be understood that the invention is not limited in its application to the details of construction and to the arrangements of the components set forth in the following description or illustrated in the drawings. The invention is capable of other embodiments and of being practiced and carried out in various ways. Also, it is to be understood that the phraseology and terminology employed herein are for the purpose of description and should not be regarded as limiting.

As such, those skilled in the art will appreciate that the conception, upon which this disclosure is based, may readily be utilized as a basis for the designing of other structures, methods and systems for carrying out the several purposes of the present invention. It is important, therefore, that the claims be regarded as including such equivalent constructions insofar as they do not depart from the spirit and scope of the present invention.

These together with other objects of the invention, along with the various features of novelty which characterize the invention, are pointed out with particularity in the claims annexed to and forming a part of this disclosure. For a better understanding of the invention, its operating advantages and the specific objects attained by its uses, reference should be had to the accompanying drawings and descriptive matter in which there is illustrated preferred embodiments of the invention.

Other features of the present invention will be evident to those of ordinary skill, particularly upon consideration of the following detailed description of the embodiments.

The detailed description of the present application showing various distinctive features may be best understood when the detailed description is read in reference to the appended drawing in which:

FIG. 1 is a diagram of an exemplary conventional operating system user space and kernel space;

FIG. 2 is a diagram of an exemplary architecture in accordance with an embodiment of the present invention;

FIG. 3 is flow diagram illustrating an exemplary method of reducing system calls in accordance with an embodiment of the present invention.

FIG. 4 is a second flow diagram illustrating an exemplary method of reducing system calls in accordance with an embodiment of the present invention.

FIG. 2, generally at 200, is a diagram of an exemplary architecture in accordance with an embodiment of the present invention. Processes 224a-n represent various end-user application processes associated with various end-user application programs. For example, processes 224a can represent various processes of a standard word processing program such as Microsoft Word. As used herein, a process is an active program and related resources that may include open files and associated signals, an address space, and/or one or more threads of execution.

Kernel 202 is a module of the operating system that loads and remains in main memory. Kernel 202 is responsible for handling system calls, scheduling and handling completion of tasks, inter-process communication, memory management, managing input and output from hardware (such as printers, keyboards, and a mouse).

When a process 224a-n needs the service of kernel 202, the respective process(es) makes a system call to kernel 202 using system call interface/handler 204. A system call to kernel 202 switches the CPU to kernel mode, running kernel code. Kernel 202 can inspect CPU registers and/or memory to find out what service is needed.

Scheduler 206 is responsible for controlling process access to the central processing unit(s) (CPU(s) of a computer (not shown)). Scheduler 206 can enforce a policy that ensures that processes 224a-n will have access to the CPU, while ensuring that other kernel subsystems (e.g., interprocess communication 214, memory management 216, device drivers 220) are afforded adequate CPU processing time. For example, scheduler 206 may be responsible for ensuring that necessary hardware actions are performed by hardware control/device drivers 220 module in a timely manner. In connection with I/O queue 208, scheduler 206 can utilize any known scheduling technique, such as round robin scheduling, scheduling by task priority, and/or scheduling by the shortest task first.

In an embodiment, scheduler 206 provides an interface for user processes 224a-n to register for timer notification. This leads to a flow of control from the scheduler to the user processes. Finally, the scheduler communicates with the CPU (not shown) to suspend and resume processes. The CPU is responsible for interrupting the currently executing process and allowing the kernel to schedule another process.

Memory management 216 permits multiple processes 224a-n to securely share the main memory system of a computer, and supports virtual memory operations that accommodates, for example, a process (e.g., process 224a) that utilizes more memory than is available in the computer.

Interprocess communication (IPC) 214 can utilize known IPC mechanisms (e.g., pipes, sockets, and/or streams) to enable one process to communicate with another process. There are at least two reasons why processes may need to communicate. One is data transfer, where one process needs to transfer data to one or more other processes. The second reason is synchronization. For example, IPC 214 can coordinate processing of Process 224a and Process 224d, where Process 224a may require that Process 224d prepares data for it before it can continue executing. Hardware control/device drivers 222 module can communicate with the hardware 220 through standard device registers (e.g., status, control, and data device registers) to transfer data between the hardware 220 and kernel 202.

In accordance with one or more embodiments of the invention, a user process 224a-n adds one or more requests 226a-n, 228a-n to I/O queue 208 while the queue of asynchronous I/O is active for the particular process. For example, the application program associated with the process can, for example, complete fields of a new request 226a-n, 228a-n, and add the request to I/O queue 208. Thus, in FIG. 2, request/process 242 may contain, for example, request 226a associated with process 224a, request 227c associated with process 224c, request 226b associated with process 224a, etc. Each request preferably is attached atomically to I/O queue 208.

A process then tests a respective indicia, such as flag 232, 234, maintained by kernel 202, which indicates if the kernel 202 considers I/O queue 208 completed with respect to a particular process 224a-n. For example, when kernel 202 is processing request 226a associated with process 224a, flag 232 is set to indicate that processing is occurring. If, upon completion of request 226a, no other requests are in I/O queue 208 for process 224a, I/O queue 208 is considered complete with respect to process 224a, and system call interface/handler 204 can make a call to process 224a. On the other hand, if I/O queue 208 is not marked complete, then the application program associated with a process 224a does not need to make a system call using system call interface/handler 204 to add another request to I/O queue 208. Instead, process 224a, having read flag 232 to indicate that kernel 202 is processing a request (e.g., request 226a) associated with process 224a, can add another request to I/O queue 208 without making a system call using system call interface/handler 204.

Consider the following example. Process 224a submits request 226a, which is a request to print pages 1-5 of a word processing file, to I/O queue 208. At this point, flag 232 will be set to indicate that one or more requests for process 224a reside in I/O queue 208. Now suppose that the end-user of process 224a submits request 226b, which is a request to print pages 6-10, and that the request is submitted before kernel 202 completes processing of request 226a. Because flag 232 remains set to indicate that one or more requests for process 224a reside in I/O queue 208, process 224a will not have to make a call to kernel 202 using system call interface/handler 204. Instead, process 224a can submit the request to I/O queue 208 without making a system call to call interface/handler 204.

Now suppose that the end-user of process 224a submits request 226b, which is a request to print pages 6-10, after kernel 202 completes processing of request 226a. Because flag 232 will now indicate that no requests for process 224a reside in I/O queue 208, process 224a will make a call to kernel 202 using system call interface/handler 204.

When the asynchronous input/output is completed for a particular process (e.g., process 224a) in kernel 202, kernel 202 fills in the completion data for the existing I/O and checks for another entry in I/O queue 208. If there are no more entries, I/O queue 208 is marked as being completed. To avoid race conditions, I/O queue 208 can, in one or more embodiments of the present invention, be checked again (there are several standard ways to check for race conditions, this being one example). If kernel 202 finds another request for process 224a in I/O queue 208, then kernel 202 can dispatch the request by using, for example, an interrupt handler, rather than waiting for process 224a to utilize system call interface/handler 204 to request kernel 202 to process the request that has been entered into I/O queue under the race condition scenario.

In another embodiment of the invention, kernel 202 does not wake and notify processes 224a-n when a request associated with a particular process is in I/O queue 208. Each request 226, 228 contains one or more flags 232, 234 indicating what kinds of notifications that respective process 224a, 224n requires from kernel 202 upon completion of the request. The flags 232, 234 are read by the completion handler 248, and can thus be set and/or dynamically modified by processes 224a-n.

For example, suppose process 224a has an initial write-to-file request 226a, flag 232 is set, and the request is entered into I/O queue 208. Now, suppose that for process 224a, a second request 226b is generated, requesting that additional data be written to the file. Upon reading flag 232 and detecting that the write-to-file request 226a is still active, process 224a would add request 226b to I/O queue 208 without making a call to the kernel 202 using system call interface/handler 204. Because the completion flags are exposed to (readable by) processes 224a-n, kernel 202 does not need to utilize system call interface/handler 204 to make a call to process 226a after the initial write-to-file request 226a. Instead, kernel 202 can utilize system call interface/handler 204 to make a single call to process 224a at the end of the write-to-file sequence (e.g., after request 226b has been processed).

Therefore, each time a process (e.g., process 224a) adds a request to I/O queue 208, I/O queue 208 can, for example, add an entry which points to the counter of waiting I/O for the file being written to. Kernel 202 can set a flag (e.g., flag 232) associated with the process (e.g., process 224a), atomically increment a counter of I/O queue 208, and add the I/O request to I/O queue 208, thereby advantageously avoiding system calls to a process while the process has a request pending in I/O queue 208.

FIG. 3 is flow diagram illustrating an exemplary method of reducing system calls in accordance with an embodiment of the present invention. At decision step 302, a process 224a-n can determine if the I/O queue 208 is live (with respect to the process) by examining respective flag 232, 234. If, at decision step 302, it is determined that I/O queue 208 is not live, the method ends. If, at decision step 302, it is determined that I/O queue is live, then, at step 304, a process 224a-n can add one or more requests to I/O queue 208. For example, if process 224a reads flag 232, and flag 232 indicates that I/O queue 208 is processing one or more requests 226a-n associated with process 224a, process 224a can add another request to I/O queue 208 without making a call to system call interface/handler 204. At step 306, requests are processed by the CPU.

At decision step 308, a determination is made whether I/O queue 208 is completed for a particular process. For example, if I/O queue 208 does not have any requests associated with a particular process, then I/O queue 208 is complete for that particular process. If I/O queue 208 is not complete for a particular process, the requests for a particular process continue to be processed at step 306. Again with regard to process 224a, as long as there are one or more requests 226a-n associated with process 224a in I/O queue 208, the requests will continue to be processed at step 306. When, at decision step 308, it is determined that that there are no additional requests to be processed, completion handler 248 can fill in completion data for the request(s) at step 310.

At decision step 312, a determination is made whether there is another entry in I/O queue 208. If kernel 202 determines that there is another request for a process (e.g., process 224a) in I/O queue 208, then the method returns to step 306. If it is determined that there are no more entries at decision step 312, a signal call is made at step 314, and the method ends.

FIG. 4 is a second flow diagram illustrating an exemplary method of reducing system calls in accordance with an embodiment of the present invention. At step 402, process 224a-n issues a respective request 226a-n, 228a-n. Requests 226a-n, 228a-n can be, for example, input-output (I/O) requests. Each request 226a-n, 228a-n will have a respective flag 232, 234 associated therewith indicating the notification(s) that respective process 224a, 224n requires from kernel 202 upon completion of request.

At step 404, completion handler 248 reads the status of the flag (e.g., 232) to determine whether a process (e.g., 224a) has one or more requests (e.g., 226a) being processed by kernel 202. At step 406, kernel 202 begins processing I/O queue 208, which contains one or more requests (e.g., 226a-d) that are associated with a particular process (e.g., 224a).

If, at decision step 408, kernel 202 determines that no new requests associated with a particular process have been added to I/O queue 208, kernel 202 continues processing the requests at step 414. If, at decision step 408, kernel 202 determines that a particular process wishes to add an I/O request to I/O queue 208 then, at step 410, kernel 202 increments a counter of I/O queue 208. At step 412, a request (e.g., 226e) is added to I/O queue 208, without making a call to the kernel 202 using system call interface/handler 204. No call is made to kernel 202 because a flag (e.g., flag 232) has been set indicating that kernel 202 is already processing one or more requests (e.g., 226a-d) associated with a process (e.g., 224a).

At step 414 kernel 202 continues to process the requests in I/O queue 208 associated with a particular process. If, at decision step 416, kernel 202 determines that there are additional requests in I/O queue 208 associated with a particular process, the method returns to decision step 408. At decision step 416, when kernel 202 determines that all requests (e.g., 226a-e) associated with a particular process (e.g., 224a) have been processed, at step 418 kernel 202 can invoke interface/handler 204 to signal process 224a after all requests associated with a particular task have been processed. The method then ends.

The many features and advantages of embodiments of the present invention are apparent from the detailed specification, and thus, it is intended by the appended claims to cover all such features and advantages of the invention which fall within the true spirit and scope of the invention. Further, since numerous modifications and variations will readily occur to those skilled in the art, it is not desired to limit the invention to the exact construction and operation illustrated and described, and accordingly, all suitable modifications and equivalents may be resorted to, falling within the scope of the invention.

Cox, Alan

Patent Priority Assignee Title
8417862, Oct 13 2010 AVAGO TECHNOLOGIES INTERNATIONAL SALES PTE LIMITED Inter-virtual machine interrupt coalescing
Patent Priority Assignee Title
5418956, Feb 26 1992 Microsoft Technology Licensing, LLC Method and system for avoiding selector loads
5421014, Jul 13 1990 Finisar Corporation Method for controlling multi-thread operations issued by an initiator-type device to one or more target-type peripheral devices
5553239, Nov 10 1994 AT&T Corporation Management facility for server entry and application utilization in a multi-node server configuration
5745903, Oct 06 1995 TAIWAN SEMICONDUCTOR MANUFACTURING CO , LTD Method and apparatus for file change notification
5828876, Jul 31 1996 STEELEYE TECHNOLOGY, INC File system for a clustered processing system
5845280, Sep 25 1995 Microsoft Technology Licensing, LLC Method and apparatus for transmitting a file in a network using a single transmit request from a user-mode process to a kernel-mode process
6047338, Jul 30 1997 TERADATA US, INC System for transferring a data directly from/to an address space of a calling program upon the calling program invoking a high performance interface for computer networks
6260057, Mar 01 1995 Sun Microsystems, Inc. Apparatus and method for high performance implementation of system calls
6298437, May 25 1999 Oracle America, Inc Method for vectoring pread/pwrite system calls
6529985, Feb 04 2000 CUFER ASSET LTD L L C Selective interception of system calls
6711644, Jul 27 2000 International Business Machines Corporation Apparatus and method for communicating the completion of asynchronous input/output
7058786, Jan 17 2002 VALTRUS INNOVATIONS LIMITED Operating system data communication method and system
7096316, Jun 30 2003 Veritas Technologies LLC Multi-host environment with coordinated distributed logging for writes to a raid storage volume
7219157, Mar 23 2001 Lucent Technologies Inc Application programming interface for network applications
7296274, Nov 15 1999 National Technology & Engineering Solutions of Sandia, LLC Method and apparatus providing deception and/or altered execution of logic in an information system
7499966, Aug 23 2001 International Business Machines Corporation Web server architecture for improved performance
7539780, Dec 01 2003 International Business Machines Corporation Asynchronous completion notification for an RDMA system
20020138664,
20040054858,
20040093604,
20040098731,
20050055399,
20050060710,
20060098662,
//
Executed onAssignorAssigneeConveyanceFrameReelDoc
Apr 18 2005COX, ALANRed Hat, IncASSIGNMENT OF ASSIGNORS INTEREST SEE DOCUMENT FOR DETAILS 0276270683 pdf
Mar 12 2010Red Hat, Inc.(assignment on the face of the patent)
Date Maintenance Fee Events
Sep 02 2015M1551: Payment of Maintenance Fee, 4th Year, Large Entity.
Sep 16 2019M1552: Payment of Maintenance Fee, 8th Year, Large Entity.
Nov 06 2023REM: Maintenance Fee Reminder Mailed.
Apr 22 2024EXP: Patent Expired for Failure to Pay Maintenance Fees.


Date Maintenance Schedule
Mar 20 20154 years fee payment window open
Sep 20 20156 months grace period start (w surcharge)
Mar 20 2016patent expiry (for year 4)
Mar 20 20182 years to revive unintentionally abandoned end. (for year 4)
Mar 20 20198 years fee payment window open
Sep 20 20196 months grace period start (w surcharge)
Mar 20 2020patent expiry (for year 8)
Mar 20 20222 years to revive unintentionally abandoned end. (for year 8)
Mar 20 202312 years fee payment window open
Sep 20 20236 months grace period start (w surcharge)
Mar 20 2024patent expiry (for year 12)
Mar 20 20262 years to revive unintentionally abandoned end. (for year 12)