IP Library Granted Patent US 8,205,067
Granted Patent B2
US 8,205,067 · App. 12/685,443 · Granted Jun 19, 2012

Context switching and synchronization

Assignee: International Business Machines Corporation
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 8,205,067
App. No.
12/685,443
Granted
Jun 19, 2012
Kind
B2
Abstract

A method, computer-readable medium, and apparatus for context switching between a first thread and a second thread. The method includes detecting an exception, wherein the exception is generated in response to receiving a packet of information directed to one of the first thread and the second thread, and in response to detecting the exception, invoking an exception handler. The exception handler is configured to execute one or more instructions removing access to at least a portion of a processor cache. The portion of the processor cache contains cached information for the first thread using a first address translation. Removing access to the portion of the processor cache prevents the second thread using a second address translation from accessing the cached information in the processor cache. The exception handler is also configured to branch to at least one of the first thread and the second thread.

Claims (50)

1. A method for context switching between a first thread and a second thread, comprising:

invoking an exception handler in response to an exception, wherein the exception is generated in response to receiving a packet of information directed to one of the first thread and the second thread, wherein the exception handler is configured to:

execute one or more instructions removing access to at least a portion of a processor cache of a processor, wherein the portion of the processor cache contains cached information for the first thread using a first address translation, thereby preventing the second thread using a second address translation from accessing the cached information in the processor cache; and

branch to at least one of the first thread and the second thread;

wherein the processor is configured to, only in response to the instructions executed by the exception handler, remove access to the processor cache by the first thread and second thread to maintain coherency between the first thread and the second thread, wherein the processor is further configured to store an indication that the cached information for the first thread uses instruction-maintained coherency and not processor-maintained coherency.

2. The method of claim 1 , wherein the exception handler is configured to:

branch to the first thread; and

after branching to the first thread, execute the one or more instructions removing access to the portion of the processor cache containing information for the first thread.

3. The method of claim 1 , wherein the exception handler is configured to:

before branching to the second thread, execute the one or more instructions removing access to the portion of the processor cache containing information for the first thread; and

branch to the second thread.

4. The method of claim 1 , wherein both the first thread and the second thread access the processor cache with software maintained coherency such that the processor is not configured to automatically removing access to the portion of the processor cache without executing the one or more instructions.

5. The method of claim 1 , wherein the cached information for the first thread includes one or more instructions prefetched by the processor.

6. The method of claim 1 , wherein the exception is generated by circuitry configured to automatically receive the packet of information and place the received packet of information in a protected area of memory in the processor without executing any instructions.

7. The method of claim 1 , further comprising detecting the exception, wherein the indication comprises a memory coherency bit, wherein the processor does not, for the first thread, automatically remove access to the portion of the processor cache without executing the one or more instructions, wherein removing access to the portion of the processor cache of the processor comprises at least one of invalidating the portion of the processor cache and flushing the portion of the processor cache.

8. A computer program product for context switching between a first thread and a second thread, comprising:

a non-transitory computer-readable storage medium having computer-readable program code embodied therewith, the computer-readable program code comprising:

computer-readable program code configured to invoke an exception handler in response to an exception, wherein the exception is generated in response to receiving a packet of information directed to one of the first thread and the second thread, wherein the exception handler is configured to:

execute one or more instructions removing access to at least a portion of a processor cache of a processor, wherein the portion of the processor cache contains cached information for the first thread using a first address translation, thereby preventing the second thread using a second address translation from accessing the cached information in the processor cache; and

branch to at least one of the first thread and the second thread;

wherein the processor is configured to, only in response to the instructions executed by the exception handler, remove access to the processor cache by the first thread and second thread to maintain coherency between the first thread and the second thread, wherein the processor is further configured to store an indication that the cached information for the first thread uses instruction-maintained coherency and not processor-maintained coherency.

9. The computer program product of claim 8 , wherein the exception handler is configured to:

branch to the first thread; and

after branching to the first thread, execute the one or more instructions removing access to the portion of the processor cache containing information for the first thread.

10. The computer program product of claim 8 , wherein the exception handler is configured to:

before branching to the second thread, execute the one or more instructions removing access to the portion of the processor cache containing information for the first thread; and

branch to the second thread.

11. The computer program product of claim 8 , wherein the cached information for the first thread includes one or more instructions prefetched by the processor.

12. The computer program product of claim 8 , wherein the exception is generated by circuitry configured to automatically receive the packet of information and place the received packet of information in a protected area of memory in the processor without executing any instructions.

13. The computer program product of claim 8 , further comprising detecting the exception, wherein the indication comprises a memory coherency bit, wherein the processor does not, for the first thread, automatically remove access to the portion of the processor cache without executing the one or more instructions, wherein removing access to the portion of the processor cache comprises at least one of invalidating the portion of the processor cache and flushing the portion of the processor cache.

14. A system comprising:

one or more computer processors comprising:

a processor cache; and

circuitry, which, when executing the one or more instructions, is configured to:

invoke an exception handler in response to an exception, wherein the exception is generated in response to receiving a packet of information directed to one of the first thread and the second thread, wherein the exception handler is configured to:

execute one or more instructions removing access to at least a portion of the processor cache, wherein the portion of the processor cache contains cached information for a first thread using a first address translation, thereby preventing a second thread using a second address translation from accessing the cached information in the processor cache; and

branch to at least one of the first thread and the second thread;

wherein the processor is configured to, only in response to the instructions executed by the exception handler, remove access to the processor cache by the first thread and second thread to maintain coherency between the first thread and the second thread, wherein the processor is further configured to store an indication that the cached information for the first thread uses instruction-maintained coherency and not processor-maintained coherency.

15. The system of claim 14 , wherein the exception handler is configured to:

branch to the first thread; and

after branching to the first thread, execute the one or more instructions removing access to the portion of the processor cache containing information for the first thread.

16. The system of claim 14 , wherein the exception handler is configured to:

before branching to the second thread, execute the one or more instructions removing access to the portion of the processor cache containing information for the first thread; and

branch to the second thread.

17. The system of claim 14 , wherein both the first thread and the second thread access the processor cache with software maintained coherency such that the processor is not configured to automatically removing access to the portion of the processor cache without executing the one or more instructions.

18. The system of claim 14 , wherein the cached information for the first thread includes one or more instructions prefetched by the processor.

19. The system of claim 14 , wherein the processor further comprises inbox circuitry configured to:

generate the exception automatically in response to receiving the packet of information; and

place the received packet of information in a protected area of memory in the processor without executing any instructions.

20. The system of claim 14 , further comprising detecting the exception, wherein the indication comprises a memory coherency bit, wherein the processor does not, for the first thread, automatically remove access to the portion of the processor cache without executing the one or more instructions, wherein removing access to the portion of the processor cache comprises at least one of invalidating the portion of the processor cache and flushing the portion of the processor cache.

Continuity (2)
Continuation 11736936 · Apr 18, 2007
Related Publication 20100115250A1 · May 6, 2010