views:

285

answers:

1

FreeBSD implements page coloring with paging queues. The queues are arranged according to the size of the processor’s L1 and L2 caches; and when a new page needs to be allocated, FreeBSD tries to get one that is optimally aligned for the cache.

Can somebody please explain the above lines, what is the concept of paging queues?

Thanks!

+1  A: 

Operating systems have to manage the sizes of CPU caches in order to reduce cache misses (also explains page colouring). More simply, the data stored in the caches (in units called pages) must be carefully selected based on how often it is used, whether it is likely to be used again soon, and how 'expensive' it would be to re-retrieve the data from main memory/HD/SomeOtherDevice. These choices are important in applications where memory bandwidth is a bottleneck.

This type of thing is often done with a priority queue that implements the paging replacement strategy chosen by the OS developers. These queues determine which pages are replaced when new data is moved to the cache, and where the data will be located in the cache. You should consult FreeBSD's documentation if you want to find out what strategy is being used.

For alignment, the data in the cache (or in main memory) needs to be placed started at specific boundaries in order to be accessed efficiently (i.e. to be moved into a CPU register). If data isn't aligned, extra computation is needed to align it.

Dana the Sane