PREFETCH QUEUE

8/2/2003

The Prefetch queue is a technique to speed up CPU operations. It is a mainframe technology that was introduced to the microcomputer world in the early Intel 8086 architecture. Prefetch queueing accesses memory in parallel with CPU operations trying to maintain a queue of four (8088) to six (8086) bytes beyond the current instruction being executed. If there is valid data in the prefetch queue, the next instruction is loaded quickly from the prefetched queue rather than more slowly from memory. The prefetch queue is cleared when the execution location is changed by a jump or interrupt. In the x86 architecture, it can usally be depleted to zero length by a string of short fast instructions.

The standard method of testing for presence and size of a prefetch queue on older CPUs seems to be to try to execute code that will hopefully allow the queue to fill, then modifying the address of a jump instruction that is thought to be in the queue and seeing where it jumps.

The prefetch queue remains in use by Intel although it is not much discussed. The Intel 80386 early versions had a 16 byte queue that was reduced to 12 bytes in later steppings. Pentiums seem to have prefetch queues -- sometimes one for each pipeline. Where documented, they seem to be 32 bytes. It is claimed that Pentiums and clones thereof will detect self modifying code and void the prefetch queue to prevent using an old value. That precludes software detection of the prefetch queue by traditional methods.

Return To Index Copyright 1994-2002 by Donald Kenney.