Find the answer to your Linux question:
Results 1 to 3 of 3
Hi, I am not able to find the answers to the following questions, please help: 1. Can a program ask for contiguous physical memory, say 8KB of memory from the ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    wei
    wei is offline
    Just Joined!
    Join Date
    Jun 2010
    Posts
    6

    physical memory allocation


    Hi,

    I am not able to find the answers to the following questions, please help:

    1. Can a program ask for contiguous physical memory, say 8KB of memory from the kernel?
    2. If yes, what does kernel do when a program ask for a 8KB chunk? Can the kernel break the 8KB into two 4KB pages? Does these 2 pages allocated have to be contiguous?

    Thanks!

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,539
    Quote Originally Posted by wei View Post
    Hi,

    I am not able to find the answers to the following questions, please help:

    1. Can a program ask for contiguous physical memory, say 8KB of memory from the kernel?
    2. If yes, what does kernel do when a program ask for a 8KB chunk? Can the kernel break the 8KB into two 4KB pages? Does these 2 pages allocated have to be contiguous?

    Thanks!
    I'm not positive about the contiguous part. If you ask for a multiple of pages, the kernel doesn't have to make sure that they are contiguous, but my guess is that if there are two pages contiguous, it will provide them. Since the general page size is, as you noted, 4K, then an 8K request can be any two physical chunks of RAM, but would be contiguous in VM. So, is there a reason for this question, other than the (admirable) desire to increase your knowledge?
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    wei
    wei is offline
    Just Joined!
    Join Date
    Jun 2010
    Posts
    6
    Quote Originally Posted by Rubberman View Post
    I'm not positive about the contiguous part. If you ask for a multiple of pages, the kernel doesn't have to make sure that they are contiguous, but my guess is that if there are two pages contiguous, it will provide them. Since the general page size is, as you noted, 4K, then an 8K request can be any two physical chunks of RAM, but would be contiguous in VM. So, is there a reason for this question, other than the (admirable) desire to increase your knowledge?
    I am wondering if the physical memory is so fragmented, does the OS have to "de-fragment" the physical memory for the purpose of correct operation? or does the physical memory de-fragmentation (if such thing exist) is only for performance purpose?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •