Buffer Pools Lecture # 05 Database Systems Andy Pavlo AP AP - - PowerPoint PPT Presentation

buffer pools
SMART_READER_LITE
LIVE PREVIEW

Buffer Pools Lecture # 05 Database Systems Andy Pavlo AP AP - - PowerPoint PPT Presentation

Buffer Pools Lecture # 05 Database Systems Andy Pavlo AP AP Computer Science 15-445/15-645 Carnegie Mellon Univ. Fall 2018 2 UPCO M IN G DATABASE EVEN TS Relational AI Talk Wednesday Sep 12 th @ 4:00pm GHC 8102 MapD Talk


slide-1
SLIDE 1

Database Systems 15-445/15-645 Fall 2018 Andy Pavlo Computer Science Carnegie Mellon Univ.

AP AP

Lecture # 05

Buffer Pools

slide-2
SLIDE 2

CMU 15-445/645 (Fall 2018)

UPCO M IN G DATABASE EVEN TS

Relational AI Talk

→ Wednesday Sep 12th @ 4:00pm → GHC 8102

MapD Talk

→ Thursday Sept 20th @ 12pm → CIC 4th Floor

2

slide-3
SLIDE 3

CMU 15-445/645 (Fall 2018)

DATABASE STO RAGE

Problem #1: How the DBMS represents the database in files on disk. Problem #2: How the DBMS manages its memory and move data back-and-forth from disk.

3

slide-4
SLIDE 4

CMU 15-445/645 (Fall 2018)

DATABASE STO RAGE

Spatial Control:

→ Where to write pages on disk. → The goal is to keep pages that are used together often as physically close together as possible on disk.

Temporal Control:

→ When to read pages into memory, and when to write them to disk. → The goal is minimize the number of stalls from having to read data from disk.

4

slide-5
SLIDE 5

CMU 15-445/645 (Fall 2018)

DISK- O RIEN TED DBM S

5

Disk Memory

Database File

1

Header

Directory

2

Header

3

Header

Pages Buffer Pool

2

Header

4

Header

5

Header

Execution Engine

Get page #2

Directory

Pointer to page #2

slide-6
SLIDE 6

CMU 15-445/645 (Fall 2018)

TO DAY'S AGEN DA

Buffer Pool Manager Replacement Policies Allocation Policies Other Memory Pools

6

slide-7
SLIDE 7

CMU 15-445/645 (Fall 2018)

BUFFER PO O L O RGAN IZATIO N

Memory region organized as an array

  • f fixed-size pages.

An array entry is called a frame. When the DBMS requests a page, an exact copy is placed into one of these frames.

7

Buffer Pool

frame1 frame2 frame3 frame4 page1 page3

On-Disk File

page1 page2 page3 page4

slide-8
SLIDE 8

CMU 15-445/645 (Fall 2018)

BUFFER PO O L M ETA- DATA

The page table keeps track of pages that are currently in memory. Also maintains additional meta-data per page:

→ Dirty Flag → Pin/Reference Counter

8

page1 page2 page3 page4

On-Disk File Buffer Pool

frame1 frame2 frame3 frame4 page1 page3

Page Table

page1 page3

slide-9
SLIDE 9

CMU 15-445/645 (Fall 2018)

BUFFER PO O L M ETA- DATA

The page table keeps track of pages that are currently in memory. Also maintains additional meta-data per page:

→ Dirty Flag → Pin/Reference Counter

8

page1 page2 page3 page4

On-Disk File Buffer Pool

frame1 frame2 frame3 frame4 page1 page3

Page Table

page1 page3

slide-10
SLIDE 10

CMU 15-445/645 (Fall 2018)

BUFFER PO O L M ETA- DATA

The page table keeps track of pages that are currently in memory. Also maintains additional meta-data per page:

→ Dirty Flag → Pin/Reference Counter

8

page1 page2 page3 page4

On-Disk File Buffer Pool

frame1 frame2 frame3 frame4 page1 page3

Page Table

page1 page3

slide-11
SLIDE 11

CMU 15-445/645 (Fall 2018)

BUFFER PO O L M ETA- DATA

The page table keeps track of pages that are currently in memory. Also maintains additional meta-data per page:

→ Dirty Flag → Pin/Reference Counter

8

page1 page2 page3 page4

On-Disk File Buffer Pool

frame1 frame2 frame3 frame4 page1 page3

Page Table

page1 page3 page2

slide-12
SLIDE 12

CMU 15-445/645 (Fall 2018)

BUFFER PO O L M ETA- DATA

The page table keeps track of pages that are currently in memory. Also maintains additional meta-data per page:

→ Dirty Flag → Pin/Reference Counter

8

page1 page2 page3 page4

On-Disk File Buffer Pool

frame1 frame2 frame3 frame4 page1 page3

Page Table

page1 page3 page2 page2

slide-13
SLIDE 13

CMU 15-445/645 (Fall 2018)

LO CKS VS. LATCH ES

Locks:

→ Protects the database's logical contents from other transactions. → Held for transaction duration. → Need to be able to rollback changes.

Latches:

→ Protects the critical sections of the DBMS's internal data structure from other threads. → Held for operation duration. → Do not need to be able to rollback changes.

9

slide-14
SLIDE 14

CMU 15-445/645 (Fall 2018)

PAGE TABLE VS. PAGE DIRECTO RY

The page directory is the mapping from page ids to page locations in the database files.

→ All changes must be recorded on disk to allow the DBMS to find on restart.

The page table is the mapping from page ids to a copy of the page in buffer pool frames.

→ This is an in-memory data structure that does not need to be stored on disk.

10

slide-15
SLIDE 15

CMU 15-445/645 (Fall 2018)

M ULTIPLE BUFFER PO O LS

The DBMS does not always have a single buffer pool for the entire system.

→ Multiple buffer pool instances → Per-database buffer pool → Per-page type buffer pool

Helps reduce latch contention and improve locality.

11

slide-16
SLIDE 16

CMU 15-445/645 (Fall 2018)

PRE- FETCH IN G

The DBMS can also prefetch pages based on a query plan.

→ Sequential Scans → Index Scans

12

Buffer Pool Disk Pages

page0 page1 page2 page3 page4 page5

Q1

slide-17
SLIDE 17

CMU 15-445/645 (Fall 2018)

PRE- FETCH IN G

The DBMS can also prefetch pages based on a query plan.

→ Sequential Scans → Index Scans

12

Buffer Pool

page0

Disk Pages

page0 page1 page2 page3 page4 page5

Q1

slide-18
SLIDE 18

CMU 15-445/645 (Fall 2018)

PRE- FETCH IN G

The DBMS can also prefetch pages based on a query plan.

→ Sequential Scans → Index Scans

12

Buffer Pool

page0 page1

Disk Pages

page0 page1 page2 page3 page4 page5

Q1

slide-19
SLIDE 19

CMU 15-445/645 (Fall 2018)

PRE- FETCH IN G

The DBMS can also prefetch pages based on a query plan.

→ Sequential Scans → Index Scans

12

Buffer Pool

page0 page1

Disk Pages

page0 page1 page2 page3 page4 page5

Q1

slide-20
SLIDE 20

CMU 15-445/645 (Fall 2018)

PRE- FETCH IN G

The DBMS can also prefetch pages based on a query plan.

→ Sequential Scans → Index Scans

12

Buffer Pool

page1 page2

Disk Pages

page0 page1 page2 page3 page4 page5

Q1

page3

slide-21
SLIDE 21

CMU 15-445/645 (Fall 2018)

PRE- FETCH IN G

The DBMS can also prefetch pages based on a query plan.

→ Sequential Scans → Index Scans

12

Buffer Pool

page1 page2

Disk Pages

page0 page1 page2 page3 page4 page5

Q1

page3

slide-22
SLIDE 22

CMU 15-445/645 (Fall 2018)

PRE- FETCH IN G

The DBMS can also prefetch pages based on a query plan.

→ Sequential Scans → Index Scans

12

Buffer Pool Disk Pages

page0 page1 page2 page3 page4 page5

Q1

page3 page4 page5

slide-23
SLIDE 23

CMU 15-445/645 (Fall 2018)

PRE- FETCH IN G

13

Buffer Pool Disk Pages

index-page0 index-page1 index-page2 index-page3 index-page4 index-page5

index-page0 index-page4 index-page1 index-page2 index-page5 index-page3 index-page6

slide-24
SLIDE 24

CMU 15-445/645 (Fall 2018)

PRE- FETCH IN G

13

Buffer Pool

index-page0

Disk Pages

index-page0 index-page1 index-page2 index-page3 index-page4 index-page5

Q1

index-page0 index-page4 index-page1 index-page2 index-page5 index-page3 index-page6

slide-25
SLIDE 25

CMU 15-445/645 (Fall 2018)

PRE- FETCH IN G

13

Buffer Pool

index-page0 index-page1

Disk Pages

index-page0 index-page1 index-page2 index-page3 index-page4 index-page5

Q1

index-page0 index-page4 index-page1 index-page2 index-page5 index-page3 index-page6

slide-26
SLIDE 26

CMU 15-445/645 (Fall 2018)

PRE- FETCH IN G

13

Buffer Pool

index-page0 index-page1

Disk Pages

index-page0 index-page1 index-page2 index-page3 index-page4 index-page5

Q1

index-page0 index-page4 index-page1 index-page2 index-page5 index-page3 index-page6

slide-27
SLIDE 27

CMU 15-445/645 (Fall 2018)

SCAN SH ARIN G

Queries are able to reuse data retrieved from storage or operator computations.

→ This is different from result caching.

Allow multiple queries to attach to a single cursor that scans a table.

→ Queries do not have to be exactly the same. → Can also share intermediate results.

14

slide-28
SLIDE 28

CMU 15-445/645 (Fall 2018)

SCAN SH ARIN G

If a query starts a scan and if there one already doing this, then the DBMS will attach to the second query's cursor.

→ The DBMS keeps track of where the second query joined with the first so that it can finish the scan when it reaches the end of the data structure.

Fully supported in IBM DB2 and MSSQL. Oracle only supports cursor sharing for identical queries.

15

slide-29
SLIDE 29

CMU 15-445/645 (Fall 2018)

Buffer Pool

SCAN SH ARIN G

16

Disk Pages

page0 page1 page2 page3 page4 page5 SELECT SUM(val) FROM A

Q1 Q1

slide-30
SLIDE 30

CMU 15-445/645 (Fall 2018)

Buffer Pool

page0

SCAN SH ARIN G

16

Disk Pages

page0 page1 page2 page3 page4 page5 SELECT SUM(val) FROM A

Q1 Q1

slide-31
SLIDE 31

CMU 15-445/645 (Fall 2018)

Buffer Pool

page0 page1 page2

SCAN SH ARIN G

16

Disk Pages

page0 page1 page2 page3 page4 page5 SELECT SUM(val) FROM A

Q1 Q1

slide-32
SLIDE 32

CMU 15-445/645 (Fall 2018)

Buffer Pool

page0 page1 page2

SCAN SH ARIN G

16

Disk Pages

page0 page1 page2 page3 page4 page5 SELECT SUM(val) FROM A

Q1 Q1

slide-33
SLIDE 33

CMU 15-445/645 (Fall 2018)

Buffer Pool

page1 page2

SCAN SH ARIN G

16

Disk Pages

page0 page1 page2 page3 page4 page5 SELECT SUM(val) FROM A

Q1 Q1

page3

slide-34
SLIDE 34

CMU 15-445/645 (Fall 2018)

Buffer Pool

page1 page2

SCAN SH ARIN G

16

Disk Pages

page0 page1 page2 page3 page4 page5 SELECT SUM(val) FROM A

Q1

SELECT AVG(val) FROM A

Q2 Q1

page3

Q2

slide-35
SLIDE 35

CMU 15-445/645 (Fall 2018)

Buffer Pool

page1 page2

SCAN SH ARIN G

16

Disk Pages

page0 page1 page2 page3 page4 page5 SELECT SUM(val) FROM A

Q1

SELECT AVG(val) FROM A

Q2 Q1

page3

Q2

slide-36
SLIDE 36

CMU 15-445/645 (Fall 2018)

Buffer Pool

SCAN SH ARIN G

16

Disk Pages

page0 page1 page2 page3 page4 page5 SELECT SUM(val) FROM A

Q1

SELECT AVG(val) FROM A

Q2 Q1

page3

Q2

page4 page5

slide-37
SLIDE 37

CMU 15-445/645 (Fall 2018)

Buffer Pool

SCAN SH ARIN G

16

Disk Pages

page0 page1 page2 page3 page4 page5 SELECT SUM(val) FROM A

Q1

SELECT AVG(val) FROM A

Q2

page3

Q2

page4 page5

slide-38
SLIDE 38

CMU 15-445/645 (Fall 2018)

Buffer Pool

page0 page1 page2

SCAN SH ARIN G

16

Disk Pages

page0 page1 page2 page3 page4 page5 SELECT SUM(val) FROM A

Q1

SELECT AVG(val) FROM A

Q2 Q2

slide-39
SLIDE 39

CMU 15-445/645 (Fall 2018)

BUFFER PO O L BYPASS

The sequential scan operator will not store fetched pages in the buffer pool to avoid overhead.

→ Memory is local to running query. → Works well if operator needs to read a large sequence of pages that are contiguous on disk.

Called "Light Scans" in Informix.

17

slide-40
SLIDE 40

CMU 15-445/645 (Fall 2018)

O S PAGE CACH E

Most disk operations go through the OS API. Unless you tell it not to, the OS maintains its own filesystem cache. Most DBMSs use direct I/O (O_DIRECT)to bypass the OS's cache.

→ Redundant copies of pages. → Different eviction policies.

18

slide-41
SLIDE 41

CMU 15-445/645 (Fall 2018)

BUFFER REPLACEM EN T PO LICIES

When the DBMS needs to free up a frame to make room for a new page, it must decide which page to evict from the buffer pool. Goals:

→ Correctness → Accuracy → Speed → Meta-data overhead

19

slide-42
SLIDE 42

CMU 15-445/645 (Fall 2018)

LEAST- RECEN TLY USED

Maintain a timestamp of when each page was last accessed. When the DBMS needs to evict a page, select the

  • ne with the oldest timestamp.

→ Keep the pages in sorted order to reduce the search time

  • n eviction.

20

slide-43
SLIDE 43

CMU 15-445/645 (Fall 2018)

CLO CK

Approximation of LRU without needing a separate timestamp per page.

→ Each page has a reference bit. → When a page is accessed, set to 1.

Organize the pages in a circular buffer with a "clock hand":

→ Upon sweeping, check if a page's bit is set to 1. → If yes, set to zero. If no, then evict.

21

page1 page3 page4 page2

ref=0 ref=0 ref=0 ref=0

slide-44
SLIDE 44

CMU 15-445/645 (Fall 2018)

CLO CK

Approximation of LRU without needing a separate timestamp per page.

→ Each page has a reference bit. → When a page is accessed, set to 1.

Organize the pages in a circular buffer with a "clock hand":

→ Upon sweeping, check if a page's bit is set to 1. → If yes, set to zero. If no, then evict.

21

page1 page3 page4 page2

ref=1 ref=0 ref=0 ref=0

slide-45
SLIDE 45

CMU 15-445/645 (Fall 2018)

CLO CK

Approximation of LRU without needing a separate timestamp per page.

→ Each page has a reference bit. → When a page is accessed, set to 1.

Organize the pages in a circular buffer with a "clock hand":

→ Upon sweeping, check if a page's bit is set to 1. → If yes, set to zero. If no, then evict.

21

page1 page3 page4 page2

ref=1 ref=0 ref=0 ref=0

slide-46
SLIDE 46

CMU 15-445/645 (Fall 2018)

CLO CK

Approximation of LRU without needing a separate timestamp per page.

→ Each page has a reference bit. → When a page is accessed, set to 1.

Organize the pages in a circular buffer with a "clock hand":

→ Upon sweeping, check if a page's bit is set to 1. → If yes, set to zero. If no, then evict.

21

page1 page3 page4 page2

ref=0 ref=0 ref=0 ref=0

slide-47
SLIDE 47

CMU 15-445/645 (Fall 2018)

CLO CK

Approximation of LRU without needing a separate timestamp per page.

→ Each page has a reference bit. → When a page is accessed, set to 1.

Organize the pages in a circular buffer with a "clock hand":

→ Upon sweeping, check if a page's bit is set to 1. → If yes, set to zero. If no, then evict.

21

page1 page3 page4 page2

ref=0 ref=0 ref=0 ref=0

X

slide-48
SLIDE 48

CMU 15-445/645 (Fall 2018)

CLO CK

Approximation of LRU without needing a separate timestamp per page.

→ Each page has a reference bit. → When a page is accessed, set to 1.

Organize the pages in a circular buffer with a "clock hand":

→ Upon sweeping, check if a page's bit is set to 1. → If yes, set to zero. If no, then evict.

21

page1 page3 page4 page2

ref=0 ref=0 ref=0 ref=0

page5

slide-49
SLIDE 49

CMU 15-445/645 (Fall 2018)

CLO CK

Approximation of LRU without needing a separate timestamp per page.

→ Each page has a reference bit. → When a page is accessed, set to 1.

Organize the pages in a circular buffer with a "clock hand":

→ Upon sweeping, check if a page's bit is set to 1. → If yes, set to zero. If no, then evict.

21

page1 page3 page4 page2

ref=0 ref=0 ref=1 ref=1

page5

slide-50
SLIDE 50

CMU 15-445/645 (Fall 2018)

CLO CK

Approximation of LRU without needing a separate timestamp per page.

→ Each page has a reference bit. → When a page is accessed, set to 1.

Organize the pages in a circular buffer with a "clock hand":

→ Upon sweeping, check if a page's bit is set to 1. → If yes, set to zero. If no, then evict.

21

page1 page3 page4 page2

ref=0 ref=0 ref=0 ref=0

page5

X

slide-51
SLIDE 51

CMU 15-445/645 (Fall 2018)

PRO BLEM S

LRU and CLOCK replacement policies are susceptible to sequential flooding.

→ A query performs a sequential scan that reads every page. → This pollutes the buffer pool with pages that are read

  • nce and then never again.

The most recently used page is actually the most unneeded page.

22

slide-52
SLIDE 52

CMU 15-445/645 (Fall 2018)

Buffer Pool

page0

SEQ UEN TIAL FLO O DIN G

23

Disk Pages

page0 page1 page2 page3 page4 page5 SELECT * FROM A WHERE id = 1

Q1 Q1

slide-53
SLIDE 53

CMU 15-445/645 (Fall 2018)

Buffer Pool

page0

SEQ UEN TIAL FLO O DIN G

23

Disk Pages

page0 page1 page2 page3 page4 page5 SELECT * FROM A WHERE id = 1

Q1

SELECT AVG(val) FROM A

Q2 Q2

slide-54
SLIDE 54

CMU 15-445/645 (Fall 2018)

Buffer Pool

page0 page1 page2

SEQ UEN TIAL FLO O DIN G

23

Disk Pages

page0 page1 page2 page3 page4 page5 SELECT * FROM A WHERE id = 1

Q1

SELECT AVG(val) FROM A

Q2 Q2

slide-55
SLIDE 55

CMU 15-445/645 (Fall 2018)

Buffer Pool

page1 page2

SEQ UEN TIAL FLO O DIN G

23

Disk Pages

page0 page1 page2 page3 page4 page5 SELECT * FROM A WHERE id = 1

Q1

SELECT AVG(val) FROM A

Q2

page3

Q2

slide-56
SLIDE 56

CMU 15-445/645 (Fall 2018)

Buffer Pool

page1 page2

SEQ UEN TIAL FLO O DIN G

23

Disk Pages

page0 page1 page2 page3 page4 page5 SELECT * FROM A WHERE id = 1

Q1

SELECT AVG(val) FROM A

Q2

page3

Q2

SELECT * FROM A WHERE id = 1

Q3 Q2

slide-57
SLIDE 57

CMU 15-445/645 (Fall 2018)

Buffer Pool

page1 page2

SEQ UEN TIAL FLO O DIN G

23

Disk Pages

page0 page1 page2 page3 page4 page5 SELECT * FROM A WHERE id = 1

Q1

SELECT AVG(val) FROM A

Q2

page3

Q2

SELECT * FROM A WHERE id = 1

Q3 Q2

slide-58
SLIDE 58

CMU 15-445/645 (Fall 2018)

BETTER PO LICIES: LRU- K

Take into account history of the last K references as timestamps and compute the interval between subsequent accesses. The DBMS then uses this history to estimate the next time that page is going to be accessed.

24

slide-59
SLIDE 59

CMU 15-445/645 (Fall 2018)

BETTER PO LICIES: LO CALIZATIO N

The DBMS chooses which pages to evict on a per txn/query basis. This minimizes the pollution of the buffer pool from each query.

→ Keep track of the pages that a query has accessed.

Example: Postgres maintains a small ring buffer that is private to the query.

25

slide-60
SLIDE 60

CMU 15-445/645 (Fall 2018)

BETTER PO LICIES: PRIO RITY H IN TS

The DBMS knows what the context of each page during query execution. It can provide hints to the buffer pool on whether a page is important or not.

26

slide-61
SLIDE 61

CMU 15-445/645 (Fall 2018)

BETTER PO LICIES: PRIO RITY H IN TS

The DBMS knows what the context of each page during query execution. It can provide hints to the buffer pool on whether a page is important or not.

26 index-page0 index-page4 index-page1 index-page2 index-page5 index-page3 index-page6

INSERT INTO A VALUES (id++)

Q1

slide-62
SLIDE 62

CMU 15-445/645 (Fall 2018)

BETTER PO LICIES: PRIO RITY H IN TS

The DBMS knows what the context of each page during query execution. It can provide hints to the buffer pool on whether a page is important or not.

26 index-page0 index-page4 index-page1 index-page2 index-page5 index-page3 index-page6

INSERT INTO A VALUES (id++)

Q1

MIN MAX id

slide-63
SLIDE 63

CMU 15-445/645 (Fall 2018)

BETTER PO LICIES: PRIO RITY H IN TS

The DBMS knows what the context of each page during query execution. It can provide hints to the buffer pool on whether a page is important or not.

26 index-page0 index-page4 index-page1 index-page2 index-page5 index-page3 index-page6

SELECT * FROM A WHERE id = ?

Q2

INSERT INTO A VALUES (id++)

Q1

MIN MAX id

slide-64
SLIDE 64

CMU 15-445/645 (Fall 2018)

DIRTY PAGES

FAST: If a page in the buffer pool is not dirty, then the DBMS can simply "drop" it. SLOW: If a page is dirty, then the DBMS must write back to disk to ensure that its changes are persisted. Trade-off between fast evictions versus dirty writing pages that will not be read again in the future.

27

slide-65
SLIDE 65

CMU 15-445/645 (Fall 2018)

BACKGRO UN D WRITIN G

The DBMS can periodically walk through the page table and write dirty pages to disk. When a dirty page is safely written, the DBMS can either evict the page or just unset the dirty flag. Need to be careful that we don’t write dirty pages before their log records have been written…

28

slide-66
SLIDE 66

CMU 15-445/645 (Fall 2018)

ALLO CATIO N PO LICIES

Global Policies:

→ Make decisions for all active txns.

Local Policies:

→ Allocate frames to a specific txn without considering the behavior of concurrent txns. → Still need to support sharing pages.

29

slide-67
SLIDE 67

CMU 15-445/645 (Fall 2018)

OTH ER M EM O RY PO O LS

The DBMS needs memory for things other than just tuples and indexes. These other memory pools may not always backed by disk. Depends on implementation.

→ Sorting + Join Buffers → Query Caches → Maintenance Buffers → Log Buffers → Dictionary Caches

30

slide-68
SLIDE 68

CMU 15-445/645 (Fall 2018)

CO N CLUSIO N

The DBMS can manage that sweet, sweet memory better than the OS. Leverage the semantics about the query plan to make better decisions:

→ Evictions → Allocations → Pre-fetching

31

slide-69
SLIDE 69

CMU 15-445/645 (Fall 2018)

PRO J ECT # 1

You will build the first component of your storage manager.

→ Extendible Hash Table → LRU Replacement Policy → Buffer Pool Manager

All of the projects are based on SQLite, but you will not be able to use your storage manger just yet after this first project.

32

Due Date: Wed Sept 26th @ 11:59pm

slide-70
SLIDE 70

CMU 15-445/645 (Fall 2018)

TASK # 1 EXTEN DIBLE H ASH TABLE

Build a thread-safe extendible hash table.

→ Use unordered buckets to store key/value pairs. → You must support growing table size. → You do not need to support shrinking.

General Hints:

→ You can use std::hash and std::mutex.

33

00 01 10 11 2 2 1 2

slide-71
SLIDE 71

CMU 15-445/645 (Fall 2018)

TASK # 2 LRU REPLACEM EN T PO LICY

Build a data structure that tracks the usage of Page

  • bjects in the buffer pool using the least-recently

used policy. General Hints:

→ Your LRUReplacer does not need to worry about the "pinned" status of a Page.

34

slide-72
SLIDE 72

CMU 15-445/645 (Fall 2018)

TASK # 3 BUFFER PO O L M AN AGER

Combine your hash table and LRU replacer together to manage the allocation of pages.

→ Need to maintain an internal data structures of allocated + free pages. → We will provide you components to read/write data from disk.

General Hints:

→ Make sure you get the order of operations correct when pinning.

35

Buffer Pool

(In-Memory)

Page6 Page2 Page4

Database

(On-Disk)

Page0 Page1 Page2

slide-73
SLIDE 73

CMU 15-445/645 (Fall 2018)

GETTIN G STARTED

Download the source code from the project webpage. Make sure you can build it on your machine.

→ We've test it on Andrew machines, OSX, and Linux. → It should compile on Windows 10 w/ Ubuntu, but we haven't tried it.

36

slide-74
SLIDE 74

CMU 15-445/645 (Fall 2018)

TH IN GS TO N OTE

Do not change any file other than the six that you have to hand in. The projects are cumulative. We will not be providing solutions. Post your questions on Piazza or come to our

  • ffice hours. We will not help you debug.

37

slide-75
SLIDE 75

CMU 15-445/645 (Fall 2018)

PLAGIARISM WARN IN G

Your project implementation must be your own work.

→ You may not copy source code from other groups or the web. → Do not publish your implementation on Github.

Plagiarism will not be tolerated. See CMU's Policy on Academic Integrity for additional information.

38

slide-76
SLIDE 76

CMU 15-445/645 (Fall 2018)

N EXT CLASS

HASH TABLES!

39