简体   繁体   中英

Is it possible to monitor the memory without using any system call in Linux , C language?

Is it possible to monitor the memory (memory watcher) without using any system call in Linux , C language? Am beginner in C and i have searched a lot about it but i couldn't find any solution except using system calls like:

meminfo , Top system calls.

So the question is, can i access the memory and get information about the process and the usage of memory for each without any system call? please help.

On Linux, you can get that information from reading files in /proc . Reading files does require making system calls, but you don't have to worry about that since C library functions like open() and read() will make those system calls for you.

Read up on the /proc filesystem, experiment with it by cat ting files from your shell, then when you are ready to use it in C, Google for a tutorial on how to read files in C using the standard library.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM