1

Linux has a file system cache where it keeps as many data as possible in RAM as a buffer.

A thread tries to read a page block in file system. If the page is in cache, it fetches the data from the cache (cache hit). otherwise, it issues disk i/o request for the page and waits (cache miss).

But when multiple threads (or processors) read the same page block, I think there can be one more case; the page is not in cache, but the i/o request for the page is already issued. In this case, no disk i/o is issued again, but the threads should wait for the page to be read from disk anyway.

Does Linux's file cache have this property? What do you call this?

1 Answer 1

0

The way it's done in Linux, and I would think in any operating system where loading from cache is asynchronous, is: when a page is requested but not yet loaded, there is a cache entry that is flagged as not-yet-loaded. When the second request comes in, it piggybacks onto the existing cache entry and waits for the load to complete. In the Linux kernel, the mechanism to wait is called a wait queue. There's a lot of documentation out there about wait queues: Linux Device Drivers, Completions (a slightly higher-level data structure on top of wait queues), kernel API documentation, …

I don't know if this mechanism has a formal name.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .