One: top command to view CPU status and memory usage status:
1. Check the CPU occupancy rate; %
CPU time occupancy percentage from the last update to the present
2. View the memory usage; the
percentage of physical memory used by the %MEM process
3. RES: The
size of the physical memory used by the process and not swapped out, in kb.
RES=CODE+DATA (code + memory occupied by data used by the program);
Two: View the physical memory occupancy status of a certain process:
1. Use top -p 13856
2. View the status file of the process:
aston@ubuntu:~$ cat /proc/13856/status
3. VmRSS is the physical memory. It can be seen that the app.out process occupies 540KB.
Three: View the default stack size when the thread is created:
pthread_create();
aston@ubuntu:/mnt/hgfs/share/insight/main_gcc/sample/app$ ulimit -s
8192
aston@ubuntu:/mnt/hgfs/share/insight/main_gcc/sample/app$ ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 7862
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 2048
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 7862
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited