LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices

Reply
 
Search this Thread
Old 01-09-2010, 01:23 AM   #1
manavendra
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 ?

Code:
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)
                    continue;
               }
               mark buffer busy;
               remove buffer from free list;
               return buffer;
          }
          else
          {
                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, 06:21 PM   #2
neonsignal
Senior Member
 
Registered: Jan 2005
Location: Melbourne, Australia
Distribution: Debian Wheezy (Fluxbox WM)
Posts: 1,363
Blog Entries: 52

Rep: Reputation: 353Reputation: 353Reputation: 353Reputation: 353
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.
 
  


Reply

Tags
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 09:36 PM
Increase process priority in Round Robin Algorithm Wantu Linux - Newbie 1 05-10-2009 06:13 PM
processor priority? fr0zen Linux - General 8 12-19-2003 12:21 PM
window Nt assigns priority internally or by user?Which type of scheduling algorithm u seema General 0 09-26-2003 01:10 AM
how do i set processor priority? Chooco Linux - General 2 06-11-2002 10:46 PM


All times are GMT -5. The time now is 12:08 AM.

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