Find the answer to your Linux question:
Results 1 to 5 of 5
I am trying for a optimization in my project.For that i want to check heap memory(using malloc) access is faster than shared memory(using shmget) i.e access time of heap memory ...
  1. #1
    Just Joined!
    Join Date
    Jun 2010
    Posts
    9

    Heap V/s Shared memory

    I am trying for a optimization in my project.For that i want to check heap memory(using malloc) access is faster than shared memory(using shmget) i.e access time of heap memory < access time of shared memory.
    But i found the result opposite. access time of heap (0.00750 ms)>access time of shared memory(0.00450ms)
    Can any body give an explanation for that or share some documents stuff for same.
    Thnx

  2. #2
    Linux Newbie
    Join Date
    Mar 2010
    Posts
    121
    Code:
    access time of heap (0.00750 ms)>access time of shared memory(0.00450ms)
    First off, what's this based on? 0.00750 ms isn't a lot of time. It sounds like you just tested a few accesses - you need to do far, far more than that if you want an accurate result.

    I'd be surprised if there's any difference between access to shared memory and access to your heap. You may find that one gets paged out to disk more, and so access is slower, but that will only affect you if you're only accessing it rarely, in which case speed is probably not a factor at all.

    Also, are you sure memory access times are really your bottle-neck? Sounds unlikely, but not impossible.

  3. #3
    Just Joined!
    Join Date
    Jun 2010
    Posts
    9
    Thnx John..
    It is required in my project..i need to find why the access time of heap memory is slower than shared memory.I have to use this result in my project.
    I had coded sample program to check their access times and then give the result on this forum.
    I am also shocked when i saw the time.

  4. #4
    Linux Newbie
    Join Date
    Mar 2010
    Posts
    121
    Quote Originally Posted by ashishmann View Post
    I had coded sample program to check their access times and then give the result on this forum.
    Would you mind sharing this code with us?

  5. #5
    Trusted Penguin Cabhan's Avatar
    Join Date
    Jan 2005
    Location
    Seattle, WA, USA
    Posts
    3,230
    I'm sorry, but homework questions are not allowed on this forum, as per the forum rules:
    http://www.linuxforums.org/forum/lin...ums-rules.html
    DISTRO=Arch
    Registered Linux User #388732

Posting Permissions

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