Computing programs are often organized into subroutines. A subroutine is a portion of computing code within a larger computing program that performs a task, usually to further completion or enable functionality of the computing program of which it is a part. Subroutines have many benefits, such as reducing duplication of code in a program, reusing code across numerous programs, and improving a program's readability. In many cases they are also relatively easy for computer programmers to write.
A computing program may call a subroutine, at which point a processor begins to execute the subroutine. The processor often continues to execute the subroutine until the subroutine returns a result. The processor may then move on to other subroutines.
This process of running subroutines can be organized into a call stack. A typical call stack stores information about active subroutines of a computing program so that the computer can know the point at which each active subroutine returns control of the processor when that subroutine finishes executing and returns a result.
Some of these subroutines, however, can be time consuming to complete. In such cases, a processor occupied with that subroutine is unable to work on other subroutines for a long period. This can be unacceptable if the processor is occupied for too long, such when that processor is needed to perform actions or subroutines for other programs that need attention.
Further, in some cases subroutines may prevent a processor from fully utilizing its processing power, such as when a processor is occupied with a subroutine but is partly idle. This can happen when a processor is occupied with a subroutine that cannot complete without help from some other computing entity, such as a hard disk drive providing information used by the subroutine.
This Summary is provided to introduce a selection of concepts in a simplified form that are further described below in the Detailed Description. This Summary is not intended to identify key or essential features of the claimed subject matter, nor is it intended to be used as an aid in determining the scope of the claimed subject matter.
In a first computer-readable media embodiment, media is described comprising instructions that are executable to provide a subroutine having a plurality of functions that are executable in a sequence, one after another. At least one function relies on successful completion of a previous function and the previous function is configured such that control of the subroutine is passable back to a call stack without execution of the one function.
In a second computer-readable media embodiment, media is described having computer-executable instructions therein that, when executed by one or more processors, perform acts comprising releasing control of a processing entity to code outside of a subroutine following execution a preliminary function of the subroutine. This subroutine has multiple constituent functions including the preliminary function and a final function. The media then produces a subresult on completion of the preliminary function, the subresult usable by the final function to provide a result that completes the subroutine. The media then releases control of the processing entity to code outside of the subroutine after execution of the final function that completes the subroutine.
In a third computer-readable media embodiment, media is described having computer-executable instructions therein that, when executed, executes a preliminary function of a subroutine having multiple constituent functions including the preliminary function and a final function and produces a subresult on completion of the preliminary function, the subresult usable by the final function to provide a result that completes the subroutine. The media may then release control to first code outside of the subroutine, after which the media executes the final function using the subresult and produces the result that completes the subroutine. The media then releases control to second code outside of the subroutine.
In a method embodiment, a method is described including executing a preliminary function of a subroutine having multiple constituent functions including the preliminary function and a final function and producing a subresult on completion of the preliminary function, the subresult usable by the final function to provide a result that completes the subroutine. After producing the result, the method executes first code outside of the subroutine and then the final function using the subresult. The method may then produce the result that completes the subroutine and execute second code outside of the subroutine.
The detailed description is described with reference to the accompanying figures. In the figures, the left-most digit(s) of a reference number identifies the figure in which the reference number first appears. The use of the same reference numbers in different instances in the description and the figures may indicate similar or identical items.
Overview
As noted generally in the Background above, computing programs can utilize subroutines, which in some cases occupy a processor for too long or permit the processor to be idle. This can be a problem in many computing contexts, including ones that have few processing threads or have limited processing resources.
This document describes tools that enable a subroutine to release control of a processing entity when the subroutine is incomplete. By so doing, the processing entity may be used by other subroutines, programs, and the like. In at least this way, the tools enable a processing entity to execute other subroutines that need attention and/or more-fully utilize its own processing power by being less idle.
In some embodiments the tools may permit a subroutine to release control when incomplete by using a structure for the subroutine that is relatively simple for a computing programmer to use. This may take advantage of some of the reasons for using subroutines, such as some of those described in the Background section above, without necessarily requiring the subroutines to be difficult to build or use.
As will be discussed in greater detail below, the tools may be conceptualized as a structural change to call stacks by which programs keep track of subroutines. While the tools are conceptualized in this way for part of the discussion below, such a conceptualization is not intended to limit the tools or their application. The tools may be used and conceptualized in many diverse ways.
In the discussion that follows, an example operating environment is described that may incorporate, represent, or be used by the tools. The tools may include a subroutine, a structure of a subroutine, and/or a processing entity, as well as other elements (e.g., those described in the environment of
In the discussion below, reference will be made to the environment by way of example only. Therefore, implementation of the tools is not limited to the example environment. The term “tools” as used herein may refer to system(s), method(s), integrated circuit(s), firmware, data structures, apparatus(es), physical layer(s), SoCs, various other hardware, computer-readable and/or executable instructions, and/or technique(s) as permitted by the context above and throughout the document.
Example Operating Environment
Before describing the tools in detail, the following discussion of an example operating environment is provided to assist the reader in understanding some ways in which various aspects of the tools may be, but are not required to be, employed. The environment described below constitutes one example; other environments may be used without departing from the spirit and scope of the claimed subject matter.
The computer-readable media includes computer-executable instructions, such as those of computing programs of various types and sizes. Here the computer-readable media is shown including a computing program 108 and other code 110. The other code includes code outside of the subroutine and may be part of the computing program or separate from the computing program. The computing program includes a subroutine 112. The subroutine includes one or more preliminary functions 114 and a final function 116. None, some, or all of the preliminary functions (other than the first preliminary function) may rely on a previous preliminary function and thus act in sequence. In any case, however, at least one of the preliminary functions is relied on by the final function to produce a result that completes the subroutine. For example, a subroutine may include two preliminary functions, a first primary function that produces a first subresult, the first subresult being used by the second preliminary function. The second preliminary function uses this first subresult and then produces a second subresult. The second subresult is then used by the final function to produce a result completing the subroutine. A detailed example of a subroutine having various constituent functions is provided in a section entitled Example Structure of a Subroutine below.
This example call stack shows that the processing entity does not start executing the first code at 124 until all of the subroutine is complete. The subroutine is complete when the execution of the final function returns a result, which here is based on all of the preliminary functions first being executed and returning subresults. The processing entity cannot move on to the other code at 124 until this result is provided. This is but one example illustrating a problem that sometimes exists with executing all of a subroutine before moving to complete some other code outside of the subroutine, such as when that other code is of higher priority or the delay in moving to complete other code can be disadvantageous.
Example Procedures
The following discussion describes techniques, which may be implemented utilizing the previously described environment. Aspects of the procedures may be implemented in hardware, firmware, software, or a combination thereof. The procedures are shown as a set of blocks that specify operations performed by one or more entities and are not necessarily limited to the orders shown for performing the operations by the respective blocks.
Block 202 executes a preliminary function of a subroutine. As noted above, the subroutine has multiple constituent functions including one or more preliminary functions and a final function. In this example the preliminary function produces a subresult that is used by another preliminary function or by the final function. If used by the final function the result completes the subroutine. There may be any number of preliminary functions acting as intermediaries between the primary function executed at block 202 and the final function.
Block 204 produces a subresult of the preliminary function when the preliminary function completes. By way of example, assume that the preliminary function is a request for an action to be completed by some other computing entity, such as a request of a hard drive to read information and provide that information to the processing entity. Assume also that the preliminary function produces a subresult based on the request, such as the hard drive indicating that it has received the request. In this example the second preliminary function may execute once it has the subresult and the information from the hard drive.
Consider
Block 206 executes code outside of the subroutine. Continuing the ongoing example, the other code is performed sooner that it would have been otherwise (this is shown in the call stack 300 at 124).
Following block 206, the tools proceed either to block 208 or 210. In either case the processing entity calls the subroutine and performs the next constituent function. Note that the tools enable the processing entity to do so without having to re-execute previously performed functions. If the next function is a preliminary function, the tools proceed to block 208. If the next function is a final function, the tools proceed to block 210.
Block 208 executes another preliminary function of the subroutine using the subresult produced at block 204. In this ongoing example, a second preliminary function uses a subresult produced at 204 as well as information from the hard drive. If the hard drive takes appreciable time to provide this information, the processing entity would have been idle while it waited for the information from the hard drive. The tools, however, have reduced this idle time of the processing entity by executing code outside of the subroutine at block 206.
If block 208 executes another preliminary function the tools produce another subresult at block 212 and then proceed to perform blocks 202, 204, and 206 again and then either block 208 or 210. The tools may perform these blocks for each additional preliminary function and other, non-subroutine code executed after each constituent function. Returning to
Block 210 executes the final function of the subroutine using the subresult, such as from the previous preliminary function. Returning to
The results of this process 200, which are visualized at call stack 300, can be the same results as those visualized at call stack 118 in that the subroutine, the first code, and the second code are all completed. One difference, however, is that the processing entity's resources may have been more-fully utilized. Another difference is that completion of other code that would otherwise have waited did not have to wait.
Block 212 produces a result of the final function. This result completes the subroutine. After completing the subroutine, the tools may proceed to execute second code outside of the subroutine at block 214.
As is noted elsewhere herein, the tools may enable the processing entity to perform in this manner using a structure of the subroutine. An example structure is shown after process 400, which is described immediately below.
Blocks 402 and 404 act similarly to blocks 202 and 204 of
At some future point, the processing entity returns to the subroutine to continue executing functions. If there are other preliminary functions the tools proceed to block 408. If there is only a final function, the tools proceed to perform block 410. Blocks 408, 410, and 412 perform similarly to blocks 208, 210, and 212 of process 200, respectively. Block 414 releases control the processing entity after the final function has been performed and the result of the subroutine is provided.
Process 200 and process 400 provide example actions from a perspective of a call stack and from a perspective of a subroutine, respectively. In the example below the tools use or comprise a structure of a subroutine. This structure may enable actions of process 200 and and/or process 400.
Example Structure of a Subroutine
Consider, by way of example, a subroutine written in the “C” programming language having three constituent functions, “syncdo_sth_1”, “sync_do_sth_2”, and “sync_do_sth_3”. These functions may be arbitrary. As you can see below, this subroutine performs in synchronized order the “sync_do_sth_1” function, then, once the “sync_do_sth_1” function has a result, the “sync_do_sth_2” function, and once that has a result, the “sync_do_sth_3” function. When the “sync_do_sth_3” function completes, the result of “e” is returned, whereby the subroutine releases control of the processing entity.
As noted above, a typical subroutine retains control of a processing entity until all of the subroutine is complete. The following subroutine, however, releases control of a processing entity when any one of the constituent functions of the subroutine has completed.
Thus, when the first SST_FUNC_CALL completes, the subroutine releases control of the processing entity. After this release, the processing entity may execute other functions or subroutines separate from this subroutine. If the processing entity would have been idle for part of this function, the processing entity may be more fully utilized by executing other functions or subroutines. Also, if other functions, subroutines, or programs are a priority over waiting for all of this subroutine to complete, then these higher-priority actions are completed rather than all of this subroutine. In either or both cases, using this example structure is often beneficial.
The subroutine may then be called again. In such a case the subroutine does not have to perform the first SST_FUNC_CALL again. Instead, the subroutine moves to the next function. After completing this function, the subroutine may release control again, and so forth. Once all the functions of the subroutine are complete, the SST_FUNC_RETURN returns a result and the subroutine is done. In the above example, ‘e’ is returned. In this example manner the tools permit other functions, subroutines, and programs to use the processing entity without having the processing entity continuously controlled by the subroutine.
As may be visually apparent, the original and typical subroutine example above looks similar as far as length and without extensive additional complexity to the second subroutine that permits release of a processing entity. As will be appreciated by one skilled in the art, the structural changes shown in the second subroutine would not be appreciably difficult for a computer programmer to implement. This dovetails well into some of the reasons for using subroutines, namely that they can be easy to program and use.
Consider, for example, an example way in which to convert (or use if starting from scratch) from the first subroutine to the second. For defining a subroutine, in the first subroutine it looks like this:
In the second subroutine it looks instead like this:
Continuing this example, consider declaring the first subroutine, which looks like this:
Compare this to declaring the second subroutine, which looks instead like this:
Declaring local variables in the first subroutine looks like this:
Compare this with the same for the second subroutine, which looks like this:
These differences are not difficult for one skilled in the art of writing subroutines to see, yet the effect of this different structure permit at least one of the advantages set forth herein. Consider below ways in which to use the second subroutine. To access local variables, use:
To access parameters, use:
Thus, by way of example consider:
To call another asynchronized function of a subroutine, the call can look like this:
Here the caller-name is the name of the subroutine function that made the call. The return-value is a variable to store a return value when the called subroutine is returned. The callee-name is the name of a subroutine that this subroutine calls. The parameter-init-list is a piece of code to initialize the parameter to the callee.
Using this example structure, a “C” program's “return” is not used, instead a “SST_RETURN” is used.
This structural and/or programming change to a subroutine can be conceptualized as a change to a call stack, such as the example shown in
This document describes tools that enable a subroutine to release control of a processing entity when the subroutine is incomplete. By so doing, the processing entity may be used by other subroutines, programs, and the like. In at least this way, the tools enable a processing entity to execute other subroutines that need attention and/or more-fully utilize its own processing power by being less idle.
Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are disclosed as example forms of implementing the claims.
This application claims priority to U.S. Provisional Patent Application Ser. No. 60/981,964 filed Oct. 23, 2007, to Xinhai Kang, the disclosure of which is incorporated by reference herein in its entirety.
Number | Name | Date | Kind |
---|---|---|---|
4754216 | Wong | Jun 1988 | A |
4810975 | Dias | Mar 1989 | A |
5450360 | Sato | Sep 1995 | A |
5535397 | Durante et al. | Jul 1996 | A |
5649135 | Pechanek et al. | Jul 1997 | A |
5724427 | Reeds, III | Mar 1998 | A |
5768500 | Agrawal et al. | Jun 1998 | A |
5778070 | Mattison | Jul 1998 | A |
5933627 | Parady | Aug 1999 | A |
5943493 | Teich et al. | Aug 1999 | A |
5961577 | Soenen et al. | Oct 1999 | A |
6018759 | Doing et al. | Jan 2000 | A |
6151668 | Pechanek et al. | Nov 2000 | A |
6154544 | Farris et al. | Nov 2000 | A |
6446191 | Pechanek et al. | Sep 2002 | B1 |
6480136 | Kranz et al. | Nov 2002 | B1 |
6536024 | Hathaway | Mar 2003 | B1 |
6615355 | Mattison | Sep 2003 | B2 |
7203821 | Thimmannagari | Apr 2007 | B2 |
7249246 | Banning et al. | Jul 2007 | B1 |
7315956 | Jensen et al. | Jan 2008 | B2 |
7334086 | Hass et al. | Feb 2008 | B2 |
7401223 | Walmsley | Jul 2008 | B2 |
7434053 | Parry et al. | Oct 2008 | B2 |
7439883 | Moni et al. | Oct 2008 | B1 |
7598752 | Li | Oct 2009 | B2 |
7647473 | Kamigaga et al. | Jan 2010 | B2 |
7765342 | Whalley et al. | Jul 2010 | B2 |
RE41703 | Pechanek et al. | Sep 2010 | E |
7818542 | Shen et al. | Oct 2010 | B2 |
8095775 | Khan | Jan 2012 | B1 |
8116457 | Langton | Feb 2012 | B2 |
8418006 | Trimberger | Apr 2013 | B1 |
8610454 | Plusquellic et al. | Dec 2013 | B2 |
8884920 | Switzer et al. | Nov 2014 | B1 |
9098694 | Moss | Aug 2015 | B1 |
20020038222 | Naka | Mar 2002 | A1 |
20020161986 | Kamigata et al. | Oct 2002 | A1 |
20030001650 | Cao et al. | Jan 2003 | A1 |
20030061519 | Shibata et al. | Mar 2003 | A1 |
20030065813 | Ruehle | Apr 2003 | A1 |
20040003246 | Hopkins et al. | Jan 2004 | A1 |
20040268075 | Qawami et al. | Dec 2004 | A1 |
20050050542 | Davis et al. | Mar 2005 | A1 |
20070046511 | Morzano et al. | Mar 2007 | A1 |
20070136561 | Whalley et al. | Jun 2007 | A1 |
20070262962 | XiaoPing et al. | Nov 2007 | A1 |
20080151670 | Kawakubo et al. | Jun 2008 | A1 |
20080229070 | Charra et al. | Sep 2008 | A1 |
20080232179 | Kwak | Sep 2008 | A1 |
20090019257 | Shen et al. | Jan 2009 | A1 |
20090055637 | Holm et al. | Feb 2009 | A1 |
20090315258 | Wallace et al. | Dec 2009 | A1 |
20090318229 | Zielinski et al. | Dec 2009 | A1 |
20100088484 | Roohparvar | Apr 2010 | A1 |
20100199288 | Kalman | Aug 2010 | A1 |
20100272162 | Simeon et al. | Oct 2010 | A1 |
20100282525 | Stewart | Nov 2010 | A1 |
20110249718 | Zerbe | Oct 2011 | A1 |
20120002803 | Adi et al. | Jan 2012 | A1 |
20120106733 | Falch et al. | May 2012 | A1 |
20130021482 | Silverbrook | Jan 2013 | A1 |
20130311792 | Ponnathota et al. | Nov 2013 | A1 |
Entry |
---|
Magnusson, “Understanding stacks and registers in the Sparc architecture(s)”, Oct. 20, 2007, 9 pages. |
Wikipedia, “Calling convention”, Oct. 4, 2007, 2 pages. |
Wikipedia, “X86 Disassembly/Functions and Stack Frames”, Apr. 23, 2007, 5 pages. |
“Final Office Action”, U.S. Appl. No. 12/356,761, (Jun. 3, 2011), 10 pages. |
“Non-Final Office Action”, U.S. Appl. No. 12/356,761, (Feb. 25, 2011), 8 pages. |
Balakrishnan, Saisanthosh et al., “The Impact of Performance Asymmetry in Emerging Multicore Architectures”, In Proceedings of ISCA 2005, (2005), 12 pages. |
Kumar, Rakesh et al., “A Multi-Core Approach to Addressing the Energy-Complexity Problem in Microprocessors”, In Proceedings of WCED 2003, (Jun. 2003), pp. 1-8. |
Kumar, Rakesh et al., “Single-ISA Heterogeneous Multi-Core Architectures: The Potential for Processor Power Reduction”, In Proceedings of MICRO-36 2003, (2003), 12 pages. |
“Non-Final Office Action”, U.S. Appl. No. 12/274,235, (Mar. 17, 2011), 11 pages. |
“Notice of Allowance”, U.S. Appl. No. 12/274,235, (Sep. 16, 2011), 6 pages. |
“Non-Final Office Action”, U.S. Appl. No. 13/477,664, Dec. 20, 2013, 9 pages. |
“Non-Final Office Action”, U.S. Appl. No. 12/356,761, Dec. 24, 2013, 11 pages. |
Constantinou, et al., “Performance Implications of Single Thread Migration on a Chip Multi-Core”, ACM SIGARCH Computer Architecture News, vol. 33 Issue 4, Nov. 2005, 12 pages. |
“Advisory Action”, U.S. Appl. No. 12/356,761, Aug. 8, 2014, 3 pages. |
“Final Office Action”, U.S. Appl. No. 12/356,761, May 1, 2014, 6 pages. |
“Notice of Allowance”, U.S. Appl. No. 13/477,664, Jun. 27, 2014, 6 pages. |
“Final Office Action”, U.S. Appl. No. 12/356,761, Mar. 4, 2015, 9 pages. |
“Final Office Action”, U.S. Appl. No. 13/013,274, Feb. 26, 2015, 20 pages. |
“Notice of Allowance”, U.S. Appl. No. 13/531,244, Mar. 30, 2015, 14 pages. |
Clements, “Principles of Computer Hardware”, School of Computing, University of Teesside, Fourth Edition, 2006, 38 Pages. |
Menezes, “Handbook of Applied Cryptography”, CRC Press, Chapters 7 and 10, Oct. 1996, 104 pages. |
“Non-Final Office Action”, U.S. Appl. No. 13/013,274, Sep. 19, 2014, 20 pages. |
“Non-Final Office Action”, U.S. Appl. No. 12/356,761, Nov. 18, 2014, 4 pages. |
“Restriction Requirement”, U.S. Appl. No. 12/356,761, Sep. 4, 2014, 5 pages. |
“Coding Laboratory—I2C on an AVR using bit banging”, Retrieved from <http://codinglab.blogspot.com/2008/10/i2c-on-avr-using-bit-banging.html> on Sep. 22, 2014, Oct. 14, 2008, 5 pages. |
Non-Final Office Action, U.S. Appl. No. 13/013,274, Dec. 24, 2015, 16 pages. |
Number | Date | Country | |
---|---|---|---|
60981964 | Oct 2007 | US |