A method for preventing priority inversion in a processor system having an operating system operable in a plurality of contexts is provided. The method comprises: providing a plurality of context control registers with each context control register being associated with a corresponding one context for controlling execution of the context; providing a plurality of sets of hardware registers, each set corresponding to one context of the plurality of contexts; and utilizing the plurality of context control registers and said plurality of sets of hardware registers to prevent priority inversion.
|
12. A processor system having an operating system operable in a plurality of contexts, said system comprising:
a hardware processor kernel comprising a plurality of context control registers, each of said context control registers being associated with a corresponding one context of said plurality of contexts for controlling execution of a context;
a plurality of sets of hardware registers, each set of said plurality of sets of hardware registers corresponding to one context of said plurality of contexts and being automatically operable with said plurality of context control registers to prevent priority inversion, each set of said plurality of sets of hardware registers not being writeable by software.
1. A method for preventing priority inversion in a processor system having an operating system operable in a master context and a plurality of non-master contexts, said method comprising:
providing a plurality of context control registers, each of said context control registers being associated with a corresponding one context of said plurality of non-master contexts for controlling execution of said corresponding non-master context;
providing a plurality of sets of hardware registers, each set of said plurality of sets of hardware registers corresponding to one context of said plurality of non-master contexts, and each set of said plurality of sets of hardware registers not being writeable by software; and
utilizing said plurality of context control registers and said plurality of sets of hardware registers to prevent priority inversion.
4. A method for preventing priority inversion in a processor system having an operating system operable in a master context and a plurality of non-master contexts, said method comprising:
providing a plurality of context control registers, each of said context control registers being associated with a corresponding one context of said plurality of non-master contexts for controlling execution of said corresponding context;
providing a plurality of sets of hardware registers, each set of said plurality of sets of hardware registers corresponding to one context of said plurality of non-master contexts, each set of said plurality of sets of hardware registers not being writeable by software; and
selectively operating said plurality of sets of hardware registers in conjunction with said plurality of context control registers to provide priority inheritance or priority ceiling to prevent priority inversion.
13. A processor system having an operating system operable in a plurality of contexts, said system comprising:
a hardware processor kernel comprising a plurality of context control registers, each of said context control registers being associated with a corresponding one context of said plurality of contexts for controlling execution of said corresponding context;
a plurality of sets of hardware registers, each set of said plurality of sets of hardware registers corresponding to one context of said plurality of contexts, and each of said set of hardware registers not being writeable by software;
utilizing said plurality of context control registers and said plurality of sets of hardware registers to prevent priority inversion;
each of said sets of hardware registers comprising a claim register having a field that is conditionally writeable;
each said claim register being operable such that a second context of said plurality of contexts will attempt to write a value to said field to seize control from a first context;
each said claim register being further operable such that if a write of a predetermined value to said field is successful said second context takes a claim and may proceed to execute;
each said claim register further operable such that if said write of said predetermined value to said field is not successful said second context will pend until said first context completes execution.
7. A method for preventing priority inversion in a processor system having an operating system operable in a plurality of contexts, said method comprising:
providing a plurality of context control registers, each of said context control registers being associated with a corresponding one context of said plurality of contexts for controlling execution of said corresponding context;
providing a plurality of sets of hardware registers, each set of said plurality of sets of hardware registers corresponding to one context of said plurality of contexts, each set of said plurality of sets of hardware registers not being writeable by software;
utilizing said plurality of context control registers and said plurality of sets of hardware registers to prevent priority inversion;
providing in each of said sets of hardware registers one register having a field that is conditionally writeable;
operating each said one register such that a second context of said plurality of contexts will attempt to write a value to said conditionally writeable field to claim a value;
operating said one register such that if a write of a predetermined value to said field is successful said second context takes a claim and may proceed to execute;
operating said one register such that if said write of said predetermined value to said field is not successful said second context will pend until said first context completes execution; and
loaning the priority of said second context to said first context while said first context is executing.
2. A method in accordance with
operating said plurality of sets of hardware registers in conjunction with said plurality of context control registers to provide priority inheritance.
3. A method in accordance with
operating said plurality of sets of hardware registers in conjunction with said plurality of context control registers to provide priority ceiling.
5. A method in accordance with
selecting all registers in each set of said plurality of sets of hardware registers to provide priority inheritance.
6. A method in accordance with
selecting a subset of registers in each set of said plurality of sets of hardware registers to provide priority ceiling.
8. A method in accordance with
providing in each said set of said plurality of sets of hardware registers a claim priority register;
operating each said claim priority register such that it has a priority field that is initially in a first state representative of a first priority;
operating each said claim priority register such that if its said corresponding context successfully writes said value to said one register of the same said set and a higher priority third context then tries to take the same claim by writing the same said value to said one register, then writing the priority of said third priority context in said priority field of said claim priority register; and
operating each said claim priority register such that when said second context relinquishes said claim, said claim priority register is either returned to said first state or is ignored.
9. A method in accordance with
determining priority for a context to be executed from the higher of a priority assigned to said context in a priority field of a corresponding one context control register and the value of said priority field of the corresponding said claim priority register.
10. A method in accordance with
providing in each said set of registers one register comprising a plurality of flag fields, each of said flag fields being assigned to a different corresponding to one context of said plurality of contexts;
controlling the execution of each other context of said plurality of contexts by controlling the state of each said flag field of said one register being used to control the execution of its corresponding one context.
11. A method in accordance with
providing in each said set of registers one register comprising a plurality of flag fields, each of said flag fields corresponding to one context of said plurality of contexts;
controlling the execution of each other context of said plurality of contexts by controlling the state of each said flag field of said one register being used to control the execution of its corresponding one context.
|
The present invention pertains to a processor systems, in general, and to methods and apparatus eliminating a priority inversion problem in a multi-thread processor system, in particular.
One problem encountered in multi-thread processor systems is that of how to manage limited shared resources among numerous threads of execution. This is no less true with a microprocessor hardware kernel. Management of resources may be accomplished entirely in software by a master thread or context. However, the resulting overhead is not desirable. In addition, managing the resources in software via a master context also effectively locks out any intermediate priority contexts, i.e., intermediate between the master thread and the thread(s) whose priority is being manipulated, while the manipulations are taking place.
Adding to the complexity of handling such shared resources is what is generally referred to as “priority inversion”. Priority inversion occurs when a standard semaphore is used to control some element of the system and the following sequence occurs:
At the point that the medium priority thread pre-empts the low priority thread, the high priority thread ends up waiting on the execution of the medium priority thread, even though they are not trying to access the same device. This is referred to as priority inversion.
Research on priority inversion has yielded two solutions. The first is called priority inheritance. This technique mandates that a lower-priority thread inherit the priority of any higher-priority thread pending on a resource they share. This priority change should take place as soon as the high-priority thread begins to pend; it should end when the resource is released. This requires help from the operating system.
If priority inheritance were used in the scenario above, then at point ‘b)’, when the high priority thread goes pending on the low priority context, the low priority thread would ‘inherit’ the priority of the other thread until it released the semaphore and the medium priority thread would never come into play.
Another solution is what is called a priority ceiling. In this case, the resource that is being managed is assigned a priority, typically as high as or higher than the priority of any thread/context that may access it. When a thread takes control of the resource (takes the semaphore), it assumes the priority of the resource. In this fashion the inversion described above can not take place because the low priority context will have the high priority of the resource while it is using it.
The underlying problem is a software problem and in the past, the priority ceiling and priority inheritance solutions have been software solutions to the software problems.
In accordance with the principles of the invention a processor hardware kernel includes a hardware priority inheritance or a hardware priority ceiling solution to prevent priority inversion from occurring during software operation.
In accordance with the principles of the invention, a method for preventing priority inversion in a processor system having an operating system operable in a plurality of contexts is provided. The method comprises: providing a plurality of context control registers with each context control register being associated with a corresponding one context for controlling execution of the context; providing a plurality of sets of hardware registers, each set corresponding to one context of the plurality of contexts; and utilizing the plurality of context control registers and said plurality of sets of hardware registers to prevent priority inversion.
Still further in accordance with the principles of the invention the method comprises operating the plurality of sets of hardware registers in conjunction with the plurality of context control registers to provide priority inheritance or to provide priority ceiling.
Yet further in accordance with the principles of the invention, the method includes selectively operating the plurality of sets of hardware registers in conjunction with the plurality of context control registers to provide priority inheritance or priority ceiling to prevent priority inversion.
In the illustrative embodiment of the invention the method comprises: providing a plurality of context control registers, each context control registers being associated with a corresponding one context of the plurality of contexts for controlling execution of the corresponding context; providing a plurality of sets of hardware registers, each set corresponding to one context of the plurality of contexts; providing in each set one register having a field that is conditionally writeable; operating each one register such that a second context will attempt to write a value to the field to seize control from a first context; operating the one register such that if a write of a predetermined value to the field is successful, the second context takes a claim and may proceed to execute; further operating the one register such that if the write is not successful the second context will pend until the first context completes execution; and loaning the priority of the second context to the first context while the first context is executing.
Still further in the illustrative embodiment, the method includes providing in each set of hardware registers a claim priority register; operating each claim priority register such that it has a priority field that is initially in a first state representative of a first priority; operating each claim priority register such that if its corresponding context successfully writes said value to the one register of the same set and a higher priority third context then tries to take the same claim by writing the same value to the one register, then the priority of the third priority context is written in the priority field; and operating each claim priority register such that when the second context relinquishes the claim, the claim priority register is either returned to the first state or is ignored.
Still further in accordance with an aspect of the invention, priority for a context to be executed is determined from the higher of a priority assigned to the context in a priority field of a corresponding one context control register and the value of the priority field of the corresponding said claim priority register.
Further in accordance with an aspect of the invention, the method comprises: providing in said set of registers one register comprising a plurality of flag fields, each of the flag fields corresponding to one context of the plurality of contexts; and controlling the execution of each other context of the contexts by controlling the state of each flag field of the one register being used to control the execution of its corresponding one context.
In accordance with the principles of the invention, a processor system having an operating system operable in a plurality of contexts, comprises: a hardware processor kernel comprising a plurality of context control registers, each of the context control registers being associated with a corresponding one context of the plurality of contexts for controlling execution of a context; and a plurality of sets of hardware registers, each set of corresponding to one context of the plurality of contexts and being automatically operable with said plurality of context control registers to prevent priority inversion.
Still further in accordance with the principles of the invention, each set of hardware registers comprises one register having a field that is conditionally writeable. In addition, each one register is operable such that a second context will attempt to write a value to the field to lay claim to a value. If a first context has already laid claim to the same value, then the first context will inherit the priority of the second context and continue to execute. The second context will pend until the first context relinquishes its claim. If a write of a predetermined value to said field is successful the second context takes a claim and may proceed to execute. If the write of the predetermined value to the field is not successful the second context will pend until the first context completes execution.
The invention will be better understood from a reading of the following detailed description of an illustrative embodiment taken in conjunction with the drawing figures in which like reference designators are used to identify like elements, and in which:
In accordance with the principles of the invention, priority inheritance and priority ceiling solutions to priority inversion problems are solved by providing a set of hardware registers in a processor hardware kernel. The registers are defined for each context except the master context of a processor.
The Object ID field 303 can be written to a non-zero value by the context associated with Claim Register 301 if another Claim Register 301 associated with another context has the same value already in its Object ID field. In that case, no write takes place to the Claim Register 301. For the context that has already “claimed” the value, the flag corresponding to the current context is set in the Pending Contexts Register 201. If the priority of the current context is higher than that in the Priority Inheritance Register 101 of the context that holds the claim then the current priority overwrites it thereby raising the priority of the context that holds the claim.
The Object ID field 303 can be written to all zeros by the context associated with Claim Register 301. The operational method utilized is shown in
The Object ID field 303 can be written to all ones by the context associated with Claim Register 301. The operational method utilized is shown in
A write by a context not associated with a Claim Register 301 will have no effect.
Each Context Control Register 403 has two fields of interest: a priority field and a state field.
The claim register 301 is where significant activity occurs from a context perspective. The operating system will attempt to write a value to the claim register 301 to take a claim. If the write is successful the context takes the claim and may proceed. If the write is not successful the context will pend until the context that has taken the claim is done. The priority of the executing context is loaned to the pending context. The claim register 301 is read, it is recognized that the claim attempt was unsuccessful, and the attempt to write a value to the claim register is repeated.
The operation of system 400 with respect to how effective priority and active state are calculated is now described.
A given context gets the processor if:
Priority is calculated by taking the highest of:
The value in the Claim Priority Register 101 works as follows:
To provide for a priority ceiling solution to the priority inversion problem requires slight changes in the implementation described above. Operation of the circuit is modified by not utilizing the Claim Priority Register 101 and using the lower 5-bits of the Object ID field 303 in the Claim Register 301 as the priority associated with a particular object. Now when an operating system writes its Claim Register, if the write is successful (i.e. if no other Claim Register contains the same value), the current context takes on a priority equal to the value in the 5 least significant bits of the Claim Register if it is higher than the context's current priority. The selection of a priority inheritance or priority ceiling solution is user selectable.
Although the invention has been described in terms of an embodiment utilizing a multi-context micro-processor, it should be understood by those skilled in the art that the present invention is directly applicable to processors in which any multi-thread programming is utilized. It will also be appreciated by those skilled in the art that where the term “context” is utilized, the term “thread” is included. It will also be appreciated by those skilled in the art that the use of the structure provided in the illustrative embodiment provides a hardware “semaphore” to replace the software semaphore utilized in the past.
The invention has been described in terms of embodiments of the invention. It will be apparent to those skilled in the art that various changes and modifications may be made to the illustrative embodiments without departing from the spirit or scope of the invention. It is intended that the invention not be limited to the specific embodiments shown and described. It is intended that the invention be limited in scope only by the scope of the claims appended hereto.
Alsup, Andrew David, Goller, Volker Ewald
Patent | Priority | Assignee | Title |
Patent | Priority | Assignee | Title |
5758188, | Nov 21 1995 | Maxtor Corporation | Synchronous DMA burst transfer protocol having the peripheral device toggle the strobe signal such that data is latched using both edges of the strobe signal |
6212544, | Oct 23 1997 | GOOGLE LLC | Altering thread priorities in a multithreaded processor |
6401154, | May 05 2000 | AMD TECHNOLOGIES HOLDINGS, INC ; GLOBALFOUNDRIES Inc | Flexible architecture for an embedded interrupt controller |
6499048, | Jun 30 1998 | Oracle America, Inc | Control of multiple computer processes using a mutual exclusion primitive ordering mechanism |
6625719, | Sep 28 1990 | Texas Instruments Incorporated | Processing devices with improved addressing capabilities systems and methods |
20020038416, | |||
20030070021, | |||
20030189940, | |||
20040123295, | |||
20040154018, | |||
20040215932, | |||
20050149936, | |||
20050149937, | |||
20060117316, | |||
20060282836, |
Executed on | Assignor | Assignee | Conveyance | Frame | Reel | Doc |
Sep 17 2006 | GOLLER, VOLKER EWALD | Innovasic, Inc | ASSIGNMENT OF ASSIGNORS INTEREST SEE DOCUMENT FOR DETAILS | 018312 | /0158 | |
Sep 17 2006 | ALSUP, ANDREW DAVID | Innovasic, Inc | ASSIGNMENT OF ASSIGNORS INTEREST SEE DOCUMENT FOR DETAILS | 018312 | /0158 | |
Sep 18 2006 | Innovasic, Inc. | (assignment on the face of the patent) | / | |||
Feb 19 2008 | Innovasic, Inc | Silicon Valley Bank | SECURITY AGREEMENT | 020528 | /0939 | |
Feb 22 2008 | INNOVASIC INC | Silicon Valley Bank | SECURITY INTEREST SEE DOCUMENT FOR DETAILS | 023132 | /0383 |
Date | Maintenance Fee Events |
Feb 10 2017 | REM: Maintenance Fee Reminder Mailed. |
Jun 05 2017 | STOL: Pat Hldr no Longer Claims Small Ent Stat |
Jun 06 2017 | M1551: Payment of Maintenance Fee, 4th Year, Large Entity. |
Jun 06 2017 | M1554: Surcharge for Late Payment, Large Entity. |
Dec 18 2020 | M1552: Payment of Maintenance Fee, 8th Year, Large Entity. |
Date | Maintenance Schedule |
Jul 02 2016 | 4 years fee payment window open |
Jan 02 2017 | 6 months grace period start (w surcharge) |
Jul 02 2017 | patent expiry (for year 4) |
Jul 02 2019 | 2 years to revive unintentionally abandoned end. (for year 4) |
Jul 02 2020 | 8 years fee payment window open |
Jan 02 2021 | 6 months grace period start (w surcharge) |
Jul 02 2021 | patent expiry (for year 8) |
Jul 02 2023 | 2 years to revive unintentionally abandoned end. (for year 8) |
Jul 02 2024 | 12 years fee payment window open |
Jan 02 2025 | 6 months grace period start (w surcharge) |
Jul 02 2025 | patent expiry (for year 12) |
Jul 02 2027 | 2 years to revive unintentionally abandoned end. (for year 12) |