Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I was reading the design of unix OS by Maurice J bach and had a confusion.

Suppose a process requests for a buffer for disk block number 18. The kernel searches for a free buffer from the free list. Let the first buffer (say buffer for block number 5) in the free list be marked as delayed write. (hash function for hash queue=disk-block-number % 4)

What will the kernel do from here onwards?

From my understanding, the kernel will start writing the buffer with block number 5 to the disk, allocate the next buffer in the free list to the current process and reassign it to the correct hash queue. The free list header will be adjusted to point to the next buffer in the free list after the one which is recently allocated. (assuming the free list follows the least recently used algorithm)

Is this correct?

share|improve this question
    
Why would a dirty block be on a freelist? If it needs to be written out, it's not free. –  Mat Aug 30 '12 at 9:58
    
@Mat The delayed write block will be removed from free list and will be marked as "writing". Inconsequential of the delayed write block, will the new block that is assigned by the kernel be moved to a different hash queue when it's block number changes? – –  Karan Aug 30 '12 at 14:11

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.