Chapter28.Structuring Operating System Aspects


Chapter 28. Structuring Operating System Aspects

YVONNE COADY, GREGOR KICZALES, MIKE FEELEY, NORM HUTCHINSON, AND JOON SUAN ONG

Key elements of operating systems crosscuttheir implementation is inherently coupled with several layers of the system. Prefetching, for example, is a critical architectural performance optimization that amortizes the cost of going to disk by predicting and retrieving additional data with each explicit disk request. The implementation of prefetching, however, is tightly coupled with both high-level context of the request source and low-level costs of additional retrieval. In a traditional OS implementation, small clusters of customized prefetching code appear at both high and low levels along most execution paths that involve going to disk. This makes prefetching difficult to reason about and change, and interferes with the clarity of the primary functionality within which prefetching is embedded. Here, we explore the use of AOP [4] to improve OS structure [5] by highlighting an AOP-based implementation of a subset of prefetching in the FreeBSD v3.3 operating system. Specifically, we examine an example involving page fault handling and prefetching.

A process generates a page fault by accessing an address in virtual memory (VM) that is not resident in physical memory. Page fault handling begins in the VM layer as a request for a page associated with a VM object. This request is then translated into a different representationa block associated with a fileand processed by the file system (FFS). Finally, the request is passed to the disk system, where it is specified in terms of cylinders, heads and sectors associated with the physical disk. The division of responsibilities among these layers is centered around the management of their respective representations of data.

Applications associate an access behavior, typically normal or sequential, with each VM object. Prefetching uses this declared behavior to plan which pages to prefetch, and allocates physical memory pages according to this plan. Allocating pages involves VM-based synchronization, since the VM object's page map must be locked during this operation.

The execution path taken subsequent to the VM layer depends upon the declared behavior of the VM object and requires the file system pay attention to the previously allocated pages. Normal behavior involves checking the plan and de-allocating pages if it is no longer cost-effective to prefetch. Sequential behavior involves requesting a larger amount of data through the regular file system read path, while still ensuring the allocated physical pages are filled.

In the original FreeBSD v3.3 code, the implementation of prefetching is both scattered and tangled. The code is spread out over approximately 260 lines in 10 clusters in 5 core functions from two subsystems. There are clusters of code operating on VM abstractions sitting in FFS functions. This implementation makes it very difficult to see the coordination of prefetching activity, and obfuscates the primary functionality of the page fault handling and file system read paths.



Aspect-Oriented Software Development
Aspect-Oriented Software Development with Use Cases
ISBN: 0321268881
EAN: 2147483647
Year: 2003
Pages: 307

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net