Track dirty pages through buffer replacement

A database has a buffer pool with space for exactly two pages. It starts empty. When a requested page is absent, the database reads that page from disk, including when the request is an update. There is no prefetching or other cache.


If both spaces are occupied, evict the least recently used page before loading the requested page. Both reading and updating a page make it the most recently used page.


A dirty page is a cached page modified since its last disk write. An update changes only the cached copy and marks it dirty. Evicting a dirty page causes one full-page disk write; evicting a clean page causes none. No other writes occur during the requests. After all requests, write each remaining dirty page to disk once.


Process these requests in order:


Request

Operation

Page

1

Read

4

2

Update

7

3

Update

4

4

Read

9

5

Read

7

6

Update

9

7

Read

12

8

Read

4

9

Update

12


Find the number of page reads from disk, page writes caused by evictions, and page writes during the final flush. Give each as an exact integer count.

Your answers

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Storage & Retrieval of Data Questions: