Uniprocessor operating system design facilitating fast context switching
First Claim
1. A method being stored as a set of instructions on a computer-readable medium, the set of instructions being executable by a processor to perform the method, the method comprising:
- receiving an event leading to a context switch;
determining whether a user task uses first task context information by examining a first task context information indicator in a task data structure associated with the user task;
storing the first task context information in a temporary memory for use following the context switch only if the user task uses the first tank context information;
setting a context pointer so that the first task context information can be retrieved from the temporary memory; and
storing, in the task data structure, a context storage indicator indicative of the organization of information including the first task context information on the temporary memory.
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.
40 Citations
23 Claims
-
1. A method being stored as a set of instructions on a computer-readable medium, the set of instructions being executable by a processor to perform the method, the method comprising:
-
receiving an event leading to a context switch; determining whether a user task uses first task context information by examining a first task context information indicator in a task data structure associated with the user task; storing the first task context information in a temporary memory for use following the context switch only if the user task uses the first tank context information; setting a context pointer so that the first task context information can be retrieved from the temporary memory; and storing, in the task data structure, a context storage indicator indicative of the organization of information including the first task context information on the temporary memory. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15)
-
-
16. A method being stored as a set of instructions on a computer-readable medium, the set instructions being executable by a processor to perform the method, the method comprising:
-
receiving an event leading to a context switch; determining whether a user task uses first task context information by examining a first task context information indicator in a task data structure associated with the user task; storing the first task context information in a temporary memory for use following the context switch only if the user task uses the first task context information; setting a context pointer so that the first task context information can be retrieved from the temporary memory; and storing in the task data structure a context storage indicator indicative of the event leading to the context switch. - View Dependent Claims (17, 18)
-
-
19. The method being stored as a set of instructions on a computer-readable medium, the set of instructions being executable by a processor to perform the method, the method comprising:
-
executing first code for a first user task, the first code requiring 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 for a second task, the second code requiring second context information to be saved in the event of the context switch the second context information being at least partially different than the first task context information; saving in a temporary memory an identifier for a first routine that saves the first task context information, storing in a task data structure associated with the first user 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 (20, 21, 22)
-
-
23. A method being stored as a set of instructions on a computer-readable medium, the set of instructions being executable by a processor to perform the method, the method comprising:
-
receiving an event; determining whether the event leads to a context switch; wherein if the event leads to the context switch, determining, by examining a first task context information indicator in a task data structure associated with a user task, whether the user task uses first task context information; and initiating an execution of function comprising a second set of instructions storing the first tank context information in a temporary memory for use following the context switch, setting a context pointer so that the first task context information can be retrieved from the temporary memory and storing, in the task data structure, a context storage indicator indicative of the organization of information including the first task context information on the temporary memory, only if the user task uses the first task context information.
-
Specification