Resumption of preempted non-privileged threads with no kernel intervention
First Claim
1. In a computer system having a processor and a memory, wherein the processor operates within both a user mode and a protected kernel mode and includes a program counter and a plurality N of registers, wherein the N registers include a first register, a method of remaining in user mode while switching between a first execution entity and a second execution entity, wherein the second execution entity has a user state defined by a program counter value, a context identifier value and N register values, the method comprising the steps of:
- providing an instruction set capable of executing a register load instruction during execution of a jump instruction;
while remaining in user mode, writing the user state of the first execution entity to memory; and
while remaining in user mode, restoring the user state of the second execution entity, wherein the step of restoring the user state of the second execution entity includes the steps of;
writing register values associated with the second execution entity to all but the first register;
writing the context identifier value to a context identifier location;
writing the program counter value to the first register; and
jumping to the program counter value stored in the first register, wherein the step of jumping includes loading a last remaining register value associated with the second execution entity to the first register while jumping to said program counter value.
7 Assignments
0 Petitions
Accused Products
Abstract
A system and method for context switching between a first and a second execution entity (such as a thread) without having to enter into protected kernel mode. The system includes a memory and a plurality of processors, wherein each of the plurality of processors operates within both a user mode and a protected kernel mode and includes a program counter and a plurality N of registers. The first and second execution entities have user states defined by a program counter value, a context identifier value and N register values. To switch context, an execution entity such as a thread, while in user mode, writes the user state of the first execution entity to memory. It then restores the user state of the second execution entity by writing register values associated with the second execution entity to all but a first register and writing the context identifier value to a context identifier location. The program counter value is then written to the first register and a jump performed to the program counter value stored in the first register while the last remaining register value is loaded to the first register. Each of these steps is performed in user mode; the result is an efficient way of switching from one user thread to the next user thread without entry into kernel space.
-
Citations
22 Claims
-
1. In a computer system having a processor and a memory, wherein the processor operates within both a user mode and a protected kernel mode and includes a program counter and a plurality N of registers, wherein the N registers include a first register, a method of remaining in user mode while switching between a first execution entity and a second execution entity, wherein the second execution entity has a user state defined by a program counter value, a context identifier value and N register values, the method comprising the steps of:
-
providing an instruction set capable of executing a register load instruction during execution of a jump instruction; while remaining in user mode, writing the user state of the first execution entity to memory; and while remaining in user mode, restoring the user state of the second execution entity, wherein the step of restoring the user state of the second execution entity includes the steps of; writing register values associated with the second execution entity to all but the first register; writing the context identifier value to a context identifier location; writing the program counter value to the first register; and jumping to the program counter value stored in the first register, wherein the step of jumping includes loading a last remaining register value associated with the second execution entity to the first register while jumping to said program counter value. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8)
-
-
9. In a computer system having a processor and a memory, wherein the processor operates within both a user mode and a protected kernel mode and includes a program counter and a plurality N of registers, wherein the N registers include a first register a method of remaining in user mode while switching between a first execution entity and a second execution entity, wherein the second execution entity has a user state defined by a program counter value, a context identifier value and N register values, the method comprising the steps of:
-
providing an instruction set capable of executing a register load instruction during execution of a jump instruction, wherein the instruction set includes a jump instruction having a delay slot; writing the user state of the first execution entity to memory; and restoring the user state of the second execution entity, wherein the step of restoring the user state of the second execution entity includes the steps of; writing register values associated with the second execution entity to all but the first register; writing the context identifier value to a context identifier location; writing the program counter value to the first register; and jumping to the program counter value stored in the first register, wherein the step of jumping includes loading a last remaining register value to the first register while jumping to said program counter value. - View Dependent Claims (10, 11, 12, 22)
-
-
13. In a computer system having a processor and a memory, wherein the processor operates within both a user mode and a protected kernel mode and includes a program counter and a plurality N of registers, wherein the N registers include a first register, a method of remaining in user mode while switching between a first execution entity and a second execution entity, wherein the second execution entity has a user state defined by a program counter value, a context identifier value and N register values, the method comprising the steps of:
-
providing an instruction set capable of executing a register load instruction during execution of a jump instruction, wherein the instruction set includes a very long instruction word (VLIW) architecture capable of placing a load register instruction within the same VLIW instruction as the jump instruction; writing the user state of the first execution entity to memory; and restoring the user state of the second execution entity, wherein the step of restoring the user state of the second execution entity includes the steps of; writing register values associated with the second execution entity to all but the first register; writing the context identifier value to a context identifier location; writing the program counter value to the first register; and jumping to the program counter value stored in the first register, wherein the step of jumping includes loading a last remaining register value to the first register while jumping to said program counter value. - View Dependent Claims (14, 15, 16)
-
-
17. A computer system, comprising:
-
memory; a processor connected to the memory, wherein the processor operates within both a user mode and a protected kernel mode and includes an instruction set capable of executing a register load instruction during execution of a jump instruction and a memory structure having a program counter and a plurality N of registers, wherein the N registers include a first register; and program code for switching between a first execution entity and a second execution entity while remaining in user mode, wherein the second execution entity has a user state defined by a program counter value, a context identifier value and N register values, wherein the program code includes; program code for writing the user state of the first execution entity to memory; program code for restoring the user state of the second execution entity, including program code for writing register values associated with the second execution entity to all but the first register, for writing the context identifier value to a context identifier location and for writing the program counter value to the first register, and program code for jumping to the program counter value stored in the first register, including program code for loading the last remaining register value to the first register while jumping to said program counter value. - View Dependent Claims (18, 19, 20, 21)
-
Specification