The InnovationQ application will be updated on Sunday, May 31st from 10am-noon ET. You may experience brief service interruptions during that time.
Browse Prior Art Database

Reduction and Shaping of Context Data for Cooperative Multitasking

IP.com Disclosure Number: IPCOM000016216D
Original Publication Date: 2002-Aug-03
Included in the Prior Art Database: 2003-Jun-21

Publishing Venue



Cooperative Multitasking requires saving and restoring of the process context when switching between tasks. This context information consists of those CPU registers that are accessed by the program afterwards. In a first proposal, the compiler can figure out which registers these are and generate code that only saves and restores the affected registers. Some processors have special instructions that save multiple registers at a time. Frequently there are restrictions on the sets allowed for this instruction. In a second proposal, the code can be transformed in a way to allow the use of such an instruction. In particular, the register numbers in the code surrounding the context save/restore can be permuted such that a register set for save/restore results which complies to such a special instruction. Cooperative multitasking means that the processor switches the context from one task to the next at locations indicated by the program. The cooperative context change includes saving the processor registers to memory and loading the appropriate values for the next process. To reduce the overhead of this operation, it is desirable to avoid handling registers that are not used by the program. Furthermore, it is desirable to modify the register set which has to be saved in a way to support specific processor features. In particular, some microprocessors provide instructions for storing and loading multiple words which store the registers consecutively to memory. Hence, a program transformation which systematically renames the registers such that a context switch can use these instructions allows a performance improvement and program size reduction. Furthermore, some registers are used to hold expressions that have been already evaluated and are used again at a later point in the program. With the addition of a context change it can be considered to discard these values and reevaluate the registers if necessary. Transformation of register names to generate a continuous sequence of registers to be saved and restored. The Transformation can be implemented as a Object Code Transformation". This is a separate program which loads the object code generated by any compiler, analyzes the code, modifies it and creates a new object code. The points in the object code where the context is saved and restored can be easily figured out, since this is usually achieved in a special subroutine. Hence, the proposed optimization program only has scan the object code for the call of this specific subroutine.