Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 01-09-2010, 02:23 AM   #1
LQ Newbie
Registered: May 2009
Location: Bangalore, India
Distribution: Kubuntu 2.6.31-14
Posts: 19

Rep: Reputation: 2
Processor priority level for Algorithm for Buffer Allocation

The algorithm for reading and writing disk blocks use the algorithm getblk to allocate buffers from the pool.

In the algorithm getblk, if the kernel removes a buffer from the free list, it must raise the processor priority level to block out interrupts before checking the free list. Why ?

algorithm getblk
input: file system number
       block number
output: locker buffer that can now be used for block
    while (buffer not found)
         if (block in hash queue)    
               if (buffer busy)
                    sleep (event buffer becomes free)
               mark buffer busy;
               remove buffer from free list;
               return buffer;
                if (there are no buffers on free list)
Where can i find the C implementation of the above algorithm for buffer allocation in the linux source code ?
Old 01-09-2010, 07:21 PM   #2
Senior Member
Registered: Jan 2005
Location: Melbourne, Australia
Distribution: Debian Stretch (Fluxbox WM)
Posts: 1,389
Blog Entries: 52

Rep: Reputation: 355Reputation: 355Reputation: 355Reputation: 355
Are you referring to the code in fs/buffer.c?

I'm not familiar with this code, but the reason for blocking out interrupts before checking a list would be to prevent the list changing while it is being accessed.


allocation, block, buffer, cache, disk, level, priority, processor

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Fedora9 chkconfig priority level woes TheFueley Fedora 1 06-08-2009 10:36 PM
Increase process priority in Round Robin Algorithm Wantu Linux - Newbie 1 05-10-2009 07:13 PM
processor priority? fr0zen Linux - General 8 12-19-2003 01:21 PM
window Nt assigns priority internally or by user?Which type of scheduling algorithm u seema General 0 09-26-2003 02:10 AM
how do i set processor priority? Chooco Linux - General 2 06-11-2002 11:46 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:48 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration