If a miss occurs and the reference does not match the front entry in the stream buffer, the stream buffer is simply flushed. The performance of a stream buffer obviously depends heavily on the pattern of memory references. For programs with a large number of sequential memory references, performance gains from stream buffers can be quite large. Of course, most programs do not achieve nearly this level of performance because any perturbation in the sequential pattern of memory accesses causes the entire stream buffer to be flushed. A simple example of a program that would gain little from a stream buffer is a program that is simply adding the values of two vectors together and placing the result in a third vector.
Many programs generate several intertwined sequential reference patterns.
A multi-way stream buffer is a way of dealing with these multiple sequential patterns. A multi-way stream buffer consists of multiple stream buffers. Each stream buffer can handle one pattern of sequential references. Whenever there is a main cache miss, the front of each stream buffer is checked for a hit. If there is a hit, that element is loaded into the cache and the elements in that stream buffer are shifted forward.