[LINUX] Read all the contents of proc / [pid] ~ From oom_adj to sessionid ~


I would appreciate it if you could take a look at the details here.

Read all the contents of proc / [pid] Read all the contents of proc / [pid] ~ from attr to cpuset ~ Read all the contents of proc / [pid] ~ from cwd to loginuid ~ Read all the contents of proc / [pid] ~ from map_files to numa_maps ~ Wrong, you can find more information here, that directory is no longer in use, I would appreciate it if you could comment if you have any information.

# sleep 365d > /dev/null &
[1] 3792

# ls /proc/3792
attr             cwd       map_files   oom_adj        schedstat  task
autogroup        environ   maps        oom_score      sessionid  timers
auxv             exe       mem         oom_score_adj  setgroups  uid_map
cgroup           fd        mountinfo   pagemap        smaps      wchan
clear_refs       fdinfo    mounts      patch_state    stack
cmdline          gid_map   mountstats  personality    stat
comm             io        net         projid_map     statm
coredump_filter  limits    ns          root           status
cpuset           loginuid  numa_maps   sched          syscall

# cd /proc/3792


# cat oom_adj
[root@test-sv 3792]# cat oom_score
[root@test-sv 3792]# cat oom_score_adj

The Linux kernel has a mechanism called OOM (Out Of Memory) Killer, which forcibly stops processes that are using a lot of memory resources when memory (RAM) is exhausted and the system may become inoperable. , Allocate memory. If there is a process that is important for operation or that you do not want to be the target of OOM Killer, such as during load testing, you can exclude it from the target of OOM Killer by setting it. https://users.atmark-techno.com/blog/1913/2767

You can also adjust the oom_killer score to prioritize the killing process. There are two tools in / proc / PID / named oom_adj and oom_score. Valid scores for oom_adj range from -16 to +15. Check the current oom_killer score in the process's oom_score. oom_killer kills the process with the highest score first. The following example adjusts the oom_score of a process for a process with a PID of 12465 to lower the priority of being killed by oom_killer. https://access.redhat.com/documentation/ja-jp/red_hat_enterprise_linux/6/html/deployment_guide/s2-proc-pid

It seems. It was helpful. pagemap

# cat pagemap
釞 ・

The pagemap file is a special file that holds which physical page each virtual page corresponds to. http://mmi.hatenablog.com/entry/2017/05/01/215921

That's right. As soon as cat was done easily,began to blink. I was scared

# ll | grep pagemap
-r--r--r--. 1 root root 0 Jan 12 05:09 pagemap

This was also a read-only file.


# cat patch_state

It seems to indicate the status of the patch currently applied. -1 seems to indicate that it is not assigned. ... what are you talking about from when to when? I'm not sure.


# cat personality

This read-only file exposes the process's execution domain, as set by personality(2). The value is displayed in hexadecimal notation.

There is an execution domain, and it is described in octal. It seems that it is not used because it is all 0.


# cat projid_map
         0          0 4294967295

The /etc/projid file provides a mapping between numeric project identifiers and a simple human readable name (similar relationship to the one that exists between usernames and uids). http://man7.org/linux/man-pages/man5/projid.5.html

It looks like a map between project --id. It seems that the mapping is similar to connecting userid and username. Really?


# ll
lrwxrwxrwx. 1 root root 0 Jan 12 05:09 root -> /

Needless to say, this is the root path. It seems to change if it is chroot.


 cat sched
sleep (3792, #threads: 1)
se.exec_start                                :     318459004.030016
se.vruntime                                  :      15734302.289257
se.sum_exec_runtime                          :             1.437900
se.nr_migrations                             :                    0
nr_switches                                  :                    1
nr_voluntary_switches                        :                    1
nr_involuntary_switches                      :                    0
se.load.weight                               :                 1024
policy                                       :                    0
prio                                         :                  120
clock-delta                                  :                   51
mm->numa_scan_seq                            :                    0
numa_migrations, 0
numa_faults_memory, 0, 0, 1, 0, -1
numa_faults_memory, 1, 0, 0, 0, -1

It seems that schedule information is listed. There was a very nice article on qiita with details of / proc / \ <pid > / sched, so I will read it and study. I don't know if I can put the link, so I won't put it.


# cat schedstat
1437900 472415 1

The far left is like sched's se.sum_exec_runtime: 1.437900, but I don't know anything else.


# cat sessionid

It seems that the process has a process ID (PID) and a session ID (SID), which is written.


It's hard to read English and not to read the source code.


http://www.usupi.org/sysad/238.html https://linuxjm.osdn.jp/html/LDP_man-pages/man5/proc.5.html http://man7.org/linux/man-pages/man5/proc.5.html https://access.redhat.com/documentation/ja-jp/red_hat_enterprise_linux/6/html/deployment_guide/s2-proc-pid https://github.com/torvalds/linux/blob/master/Documentation/filesystems/proc.txt

Recommended Posts

Read all the contents of proc / [pid] ~ From oom_adj to sessionid ~
Read all the contents of proc / [pid] ~ From setgroups to wchan ~
Read all the contents of proc / [pid] ~ From cwd to loginuid ~
Read all the contents of proc / [pid] ~ From map_files to numa_maps ~
Read all the contents of proc / [pid] ~ from attr to cpuset ~
Read all the contents of proc / [pid]
After all, the story of returning from Linux to Windows
Get the contents of git diff from python
Change the decimal point of logging from, to.
From the introduction of pyethapp to the execution of contract
The story of moving from Pipenv to Poetry
[Bash] While read, pass the contents of the file to variables for each column
The wall of changing the Django service from Python 2.7 to Python 3
Try to get the contents of Word with Golang
DataNitro, implementation of function to read data from sheet
Also read the contents of arch / arm / kernel / swp_emulate.c
I read the Chainer reference (updated from time to time)
[Ubuntu] How to delete the entire contents of a directory
Analyzing user dissatisfaction very easily from the contents of inquiries
How to calculate the amount of calculation learned from ABC134-D
[Introduction to matplotlib] Read the end time from COVID-19 data ♬
Deploy Django + React from scratch to GKE: Table of Contents
How to see the contents of the Jupyter notebook ipynb file
The story of copying data from S3 to Google's TeamDrive
How to connect the contents of a list into a string
Simulation of the contents of the wallet
[Python] Try to graph from the image of Ring Fit [OCR]
I want to read the html version of "OpenCV-Python Tutorials" OpenCV 3.1 version
[EC2] How to install chrome and the contents of each command
[TensorFlow 2] How to check the contents of Tensor in graph mode
From the introduction of JUMAN ++ to morphological analysis of Japanese with Python
Create a function to get the contents of the database in Go
Find all patterns to extract a specific number from the set
[Python] A program that rotates the contents of the list to the left
Understand the contents of sklearn's pipeline
Existence from the viewpoint of Python
How to read the SNLI dataset
See the contents of Kumantic Segumantion
Supplement to the explanation of vscode
From the introduction of GoogleCloudPlatform Natural Language API to how to use it
About the order of learning programming languages (from beginner to intermediate) Part 2
Wikipedia goes from the era of writing to the era of creation ~ Automatic generation from Twitter
[Introduction to Python] How to sort the contents of a list efficiently with list sort
How to compare if the contents of the objects in scipy.sparse.csr_matrix are the same
Setting to debug test by entering the contents of the library with pytest
Download all the images attached to the body of the pull request on Github
Get the song name from the title of the video you tried to sing
Use python's pixivpy to download all the works of a specific user from pixiv at once (including moving)