Browse Prior Art Database

Deterministic Context Switching of Registers

IP.com Disclosure Number: IPCOM000037054D
Original Publication Date: 1989-Nov-01
Included in the Prior Art Database: 2005-Jan-29
Document File: 3 page(s) / 16K

Publishing Venue

IBM

Related People

Beetcher, RC: AUTHOR [+5]

Abstract

Described are mechanisms which determine whether floating-point registers need to be saved/restored on each context switch. A significant portion of a processing unit's cycles are used during context switching, and a significant portion of this time is spent in the process of saving and restoring processor registers into and out of main storage. On many processors, a portion of this register space is used to contain floating-point data. If these floating-point registers are not loaded or modified from one context switch to the next, it is not necessary to save the floating-point registers. If the task or procedure which is being switched into the processor had not previously required the use of floating-point registers, the floating-point registers do not need to be restored.

This text was extracted from a PDF file.
This is the abbreviated version, containing approximately 33% of the total text.

Page 1 of 3

Deterministic Context Switching of Registers

Described are mechanisms which determine whether floating-point registers need to be saved/restored on each context switch. A significant portion of a processing unit's cycles are used during context switching, and a significant portion of this time is spent in the process of saving and restoring processor registers into and out of main storage. On many processors, a portion of this register space is used to contain floating-point data. If these floating-point registers are not loaded or modified from one context switch to the next, it is not necessary to save the floating-point registers. If the task or procedure which is being switched into the processor had not previously required the use of floating- point registers, the floating-point registers do not need to be restored. By determining these conditions, overhead of saving and restoring floating-point registers with each context switch is saved.

This article refers to two types of context switch. One type of context switch is that which occurs in a multi-tasking system where the state of a processor is saved when switching out one task and loaded when switching in the next. This type of context switch is a "Task Switch". A second type of context switch is that which occurs within a task when one routine or procedure calls another or when the called routine or procedure returns to the caller and the state of a processor requires saving or restoring. This type of context switch is called a "Call/Return".

Some processors contain a set of registers used for floating-point data, which are independent of the set of registers used for addressing and binary data. There is a performance advantage to not saving or restoring floating-point registers on a context switch. If it is known on a task switch that the floating-point registers do not contain data required by the task being switched out, then the data in the floating- point registers need not be saved. If it is known on a task switch that the floating-point save area for the task being switched in does not contain data required by that task, then that data need not be loaded into the floating-point registers.

In a similar manner, as part of Call/Return, if the calling routine does not have data in the floating-point registers, then the floating-point registers do not need to be saved. Further, the floating-point registers do not need to be restored when returning to the caller.

The mechanism used to determine whether floating-point registers require a save/restore on a context switch comprises the following:

A processor bit called the "In-Use" bit which is set on by the processor for any instruction which loads a floating-point register from main store. This indicates that at least one floating-point register contains an operand required by a task. If on at the time of a task switch out, the floating-point registers are saved in the task save area. The "In-Use" bit is reset with the co...