Uniprocessor operating system design facilitating fast context swtiching
First Claim
1. A method, comprising:
- receiving an event leading to a context switch;
determining whether a task uses first task context information by examining a first task context information indicator in a task data structure associated with the task; and
storing the first task context information in a temporary memory when the task uses the first task context information.
3 Assignments
0 Petitions
Accused Products
Abstract
A task stack and a context pointer in a task control block (TCB) are implemented to provide more efficient context switching. Additionally, multiple routines each of which saves or restores a certain combination of volatile registers is implemented. A task can store in its task control block a routine identifier to select from the multiple routines a set of routines for saving and restoring volatile registers during context switching. On the occurrence of an event that may lead to a context switch a scheduler selects based on the routine identifier a routine that only saves registers used by the task, thereby, reducing execution overhead. The registers are saved on the task stack and a context pointer to the registers is saved in the TCB. In the event a context switch is necessary, it is not necessary to copy the registers to the TCB because the context pointer is in the TCB. A non-volatile register indicator that indicates whether non-volatile registers are used is stored in the task control block. The non-volatile registers are only saved if used, also reducing execution overhead. Furthermore, a storage area is implemented for saving task context for the task when it is interrupted during context switch in. Upon the occurrence of an interrupt the task context is saved in the storage area. If the interrupt leads to a second task which has a higher priority being made ready, the second task is switched in without first returning to switch-in the task.
65 Citations
48 Claims
-
1. A method, comprising:
-
receiving an event leading to a context switch;
determining whether a task uses first task context information by examining a first task context information indicator in a task data structure associated with the task; and
storing the first task context information in a temporary memory when the task uses the first task context information. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20)
-
-
21. A method, comprising:
-
receiving an interrupt while executing context switch-in code to context switch-in a first task;
saving task context information related to the first task in a temporary storage area; and
switching in a second task without first returning to execute the context switch-in code to context switch-in the first task when the second task is ready. - View Dependent Claims (22, 23)
-
-
24. A method, comprising:
-
saving task context information related to the first task in a storage area due to an event that caused premature ending of the execution of context switch-in code to context switch-in the first task;
determining whether a second task is ready;
switching in the second task without first returning to execute the context switchin code to context switch-in the first task when the second task is ready. - View Dependent Claims (25, 26)
-
-
27. A method, comprising:
-
executing first code for a first task which requires first task context information to be saved in the event of a context switch;
receiving an indication to make a transition to execute second code which requires second context information to be saved in the event of context switching, such second context information being at least partially different than first task context information;
saving in a temporary memory an identifier for a first routine that saves the first task context information for the first executing code;
storing in a task data structure associated with the first task a default identifier for a second routine that saves the second context information; and
saving the first task context information in the temporary memory. - View Dependent Claims (28, 29, 30)
-
-
31. A method comprising:
-
determining nature of event which led to a context switch; and
based on the determination, restoring previously stored context. - View Dependent Claims (32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43)
-
-
44. A method comprising:
-
determining organization of task context information stored in a memory; and
based on the determination, choosing one of at least two different sequences of operations for restoring the task context information. - View Dependent Claims (45, 46, 47, 48)
-
Specification