[CMPT 454] Week 1_2

June·2021년 1월 15일
0

CMPT 454

목록 보기
2/33

Arranging Pages of a File on Disk

  • 'Next' page concept:
    Pages on same track, followed by pages on same cylinder, followed by pages on adjacent cylinder.
  • Pages in a file should be arranged sequentailly by 'next',to minimize seek and rotational delay.
  • For sequential scan, pre-fetching several pages at a time is a big win!
  • In practice, data pages not always sequentially stored on disk, why?
    -> Database grows and shrinks

한 디스크의 트랙을 다 쓰고나면, 플래터의 반대면 같은 트랙을 쓰고, 그리고 다쓰면 다른 플래터의 윗면..(최대한 같은 실린더를 쓴다) 그러고도 다쓰면 맨처음 다쓴 디스크의 바로 안쪽 트랙을 사용한다. 이렇게 함으로써 seek time을 줄일 수 있다.

Different Layers

Files

  • For user, a file is searched or updated as a collection of logical records.
    • Example: find student records in CS major
  • For DBMS, a file is stored, read and written as a collection of disk pages.
    • Example: read data identified byt page ids 1, 4, 10 (where student records in CS major are stored)
  • Memory/disk managers must translate user's search or update into disk page access, done by indexing.

Disk Management

  • Mange the space on disk
    • Disk pages are uniquely identified by page id(b,t,c,d), "block of track t of cylinder c of disk d"\
  • Higher level(i.e., memory manger) calls upon this layer to
    • Allocate / de-allocate a page for a file
    • Read/write a page
    • Keep track of data pages and free pages
  • Higher levels don't need to know how this is done.

Memory (RAM) Management

When a page is requested ...

  • If requested page is not in buffer pool(memory - by Table lookup), i.e.,page fault:
    • Choose a frame for replacement
    • If frame is dirty(i.e., modified but not written to disk), write it to disk
    • Read requested page into chosed frame and update Table
    • Pin the page and return its address

More on Buffer Management

  • Requestor of page must unpin it and indicate whether page has been modified:
    • dirty bit is used for this
  • Page in pool may be requested many times (by many requestors)
    - a pin count is used. A page is a candidate for replacement iff pin count = 0
    (pin은 사용자가 사용중에 있다는 것을 의미한다)
    (dirty는 modified 됐다는 것을 의미한다)

0개의 댓글