Information Technology Reference
In-Depth Information
ASPECT close_aspect(void){
...
}
ASPECT some_aspect(void){
...
PROCEED();
...
}
The code is then compiled as a standard NetBSD kernel module. At runtime,
theusermodedynamiccodeweaver weave is used to load the requested kernel
module and execute its corresponding initialisation function ( aspect_init() ), which
calls a support library to do the actual weaving using the code splicing technique.
Subsequent functions calls are then routed through the user-provided aspects.
Engel and Freisleben [33] provide a number of use cases of adding adaption
to NetBSD using this approach:
Self-Configuration. In common with most operating systems, new devices may be
added or removed from the NetBSD operating system dynamically. While
adding a new device does not affect running processes, removing one may.
For example removing a USB memory key that contains a file system that
is currently being accessed by a process. The cross-cutting functionality
affected here is the call to the VOP_OPEN function, located in 43 areas in
the architecture-specific, base kernel, file system and device driver code in
the operating system. In this scenario an aspect may intercept the device
removal and signal the different parts of the operating system affected that
a device is no longer available if the operating system tries to open a file on
the now non-existent device.
Self-Healing. The NetBSD system, in common with all operating systems, may
run out of memory if a process requests more memory than that which is
available in the virtual memory system. Using an aspect, the out-of-memory
error condition can be intercepted and the aspect can add additional virtual
memory dynamically by adding additional swap files to the system.
Self-Optimization. To calculate the number of free blocks in a file system, the op-
erating system skims through the free block list and counts the number of
bits that indicate a free block. However, if the operating system could detect
that reading the free block count occurs more frequently than updating the
free block bitmap, an optimisation could be achieved by dynamically switch-
ing the free block calculation so that the number of free blocks is calculated
prior to every bitmap update instead of every call to a readout. This pro-
vides self optimisation because the system can dynamically shift the count
of free blocks depending on changing conditions and this functionality can
be provided in an aspect.
Search WWH ::




Custom Search