8

Not sure this is the right place for this question, but here goes:

I'm trying to make some sense of the /proc/pid/sched and /proc/pid/task/tid/sched files for a highly threaded server process, however I was not able to find a good explanation of how to interpret this file ( just a few bits here: http://knol.google.com/k/linux-performance-tuning-and-measurement# ) . I assume this entry in procfs is related to newer versions of the kernel that run with the CFS scheduler?

CentOS distro running on a 2.6.24.7-149.el5rt kernel version with preempt rt patch.

Any thoughts?

redeye
  • 81
  • 1
  • 2

2 Answers2

3

You can find more documentation about the /proc/[pid]/sched file in this article:

http://lwn.net/Articles/242900/

Look at the comments. Most of the fields are explained.

Addendum: the file is writeable to reset the statistics.

Massimo
  • 260
  • 3
  • 13
  • 7
    It's considered good practice to include all the relevant information from that website. The reason for that is that one day that page may become unavailable and then your answer will be useless. – Lucas Kauffman Apr 11 '12 at 07:29
-3

Probably "man proc" is the place to read! From the manual:

/proc/[pid]/task
(since Linux 2.6.0-test6) This is a directory that contains one subdirectory for each thread in the process. The name of each subdirectory is the numerical thread ID ([tid]) of the thread (see gettid(2)). Within each of these subdirectories, there is a set of files with the same names and contents as under the /proc/[pid] directories. For attributes that are shared by all threads, the contents for each of the files under the task/[tid] subdirectories will be the same as in the corresponding file in the parent /proc/[pid] directory (e.g., in a multithreaded process, all of the task/[tid]/cwd files will have the same value as the /proc/[pid]/cwd file in the parent directory, since all of the threads in a process share a working directory). For attributes that are distinct for each thread, the corresponding files under task/[tid] may have different values (e.g., various fields in each of the task/[tid]/status files may be different for each thread).

In a multithreaded process, the contents of the /proc/[pid]/task directory are not available if the main thread has already terminated (typically by calling pthread_exit(3)).

So, basically understanding /proc/pid/task/ means understanding proc itself.

Hans
  • 160
  • 3