Check out the new USENIX Web site. next up previous
Next: Kernel Support Up: Run-Time System Previous: Run-Time System

Prefetch Library

The disk I/O calls that the prefetch thread makes are serviced by the prefetch library, which maintains a prefetch queue that stores the addresses of the file blocks to be prefetched. Each prefetch queue entry is a tuple of the form { file ID, block number, prefetch call ID }. The file ID and the block number together uniquely identify the logical disk block to be prefetched, and the prefetch call ID identifies the prefetch call that initiated the corresponding disk access. The initial value of the prefetch call ID is 0. It is incremented every time a prefetch call is made. The library also maintains a file table to keep track of the current offset corresponding to every prefetchable file descriptor so that it can calculate the logical block number for prefetch_read and prefetch_lseek calls.

Given a prefetch call, the library first assigns the current prefetch call ID to this call. Second, it increments the current prefetch call ID. Third, it inserts an entry into the prefetch queue after calculating its target logical block ID. Finally, it updates the current offset of the accessed file in the file table. When the prefetch queue becomes full, the library makes a system call that we added to copy the prefetch queue entries into the kernel.

When an application makes a create_prefetch_thread() call, the library forks off a new thread as the prefetch thread, and informs the kernel about the process ID of both the computation and the prefetch thread using an added system call. This helps the kernel to identify the process ID of the prefetch thread given a computation thread, and vice versa. In addition, the prefetch library registers the file pointers of all prefetchable files with the kernel through another added system call, so that the kernel can take appropriate action regarding prefetching for those file pointers.


next up previous
Next: Kernel Support Up: Run-Time System Previous: Run-Time System
chuan-kai yang 2002-04-15