80 likes | 225 Views
CS 2606 Project 2 Clarifications. Clarifications. Output specs Write-through versus write-back buffers The remove operation and the buffer pool Note: all of these clarifications are consistent with the project specs and the sample files posted. Output specs. insert command
E N D
Clarifications • Output specs • Write-through versus write-back buffers • The remove operation and the buffer pool Note: all of these clarifications are consistent with the project specs and the sample files posted
Output specs • insert command insert #: record length = # + # = #, stored at position # • print command print # <record contents> • remove command remove #: at position #, record length = # Note: if the insert command involves a remove, only the insert operation produces output
Output specs • buffers command buffers: b1 b2 b3 … • freelist command freelist: p1 s1, p2 s2, p3 s3, … Notes: • buffer indices and free list positions begin at 0 • buffer list starts with LRU block, ends with MRU block • free list is sorted by position
Write-through vs Write-back buffers • Write-through buffers: • insert command always results in a physical disk write • Write-back buffers: • physical disk write occurs only when necessary during a page fault (disk writes are minimized) • Write-through buffers are easier to implement, you get extra-credit (5%) if you implement a write-back buffer • In both cases, the insert command affects the buffer pool (blocks involved in the operation become the most recently used blocks)
Example • Suppose size of buffer pool = 2, and all records are 200 bytes each • Consider the sequence: command write-through write-back insert 1 write fblock 1 insert 2 write fblock 1 insert 3 write fblocks 1,2 print 1 print 2 print 3 insert 4 write fblock 2 insert 5 write fblock 2 insert 6 write fblocks 2,3 write fblock 1 no diskoperations
Example, continued • After the last command, buffer pool contains fblocks 2, 3 • If we continue with the following operations: command write-through write-back … insert 6 write fblocks 2,3 write fblock 1 print 1 fblk 1 in, fblk 2 out fblk 1 in, write fblk 2 print 2 print 3 fblk 2 in, fblk 3 out fblk 2 in, write fblk 3 print 4 print 5 print 6 fblk 3 in, fblk 1 out fblk 3 in, no write * * write not necessary because block 1 not dirty
The remove operation • Question: does the remove operation require a buffer pool update or a disk operation? • Maybe, depending on how complex we want this project to be • For simplicity, you may assume that remove is strictly a memory manager operation (refer to the previous slide set about this project); no buffer pool update will result from a remove • Important: you need to deal with obtaining the size of the removed record (keep a table, or retrieve the 4 bytes from the file, without using the buffer pool)