shingaridavesh
shingaridavesh

Reputation: 991

Memory request in Linux

When a process or program tries to access something rather anything, there will be a memory access for that. How and where does this happen. I need the C files. I need to write my implementation there to know whenever there is a memory access request made by any program.

Program --- request memory ---> LINUX MM FILE??? ---> Physical Address.

I am not looking for virtual to physical translation but to know who pings, when does that ping for memory access.

Upvotes: 0

Views: 889

Answers (1)

Zan Lynx
Zan Lynx

Reputation: 54325

User-space programs use mmap and sbrk system calls. You can trace these for one program with the strace command. I think that you could trace all of them by using one of the Linux tracing frameworks, like ftrace. I think perf can do it as well. Some useful perf examples I found here.

Inside the kernel things are different. The kernel allocates most things in "slabs" using SLOB, SLAB or SLUB slab managers. I believe kmalloc does slabs. There's also valloc I think, for allocating virtual memory to use in the kernel.

Upvotes: 2

Related Questions