To begin with let me explain my system and then I will come to the problem.


My program forks 2 child processes. These child processes further start 2 user level threads (pthreads) and 2 kernel level threads (kthread). All these threads issue various system calls. I am using Ubuntu with Linux kernel 2.6.39-rc7


I want the following informtion about my system:

1. Scheduling information of the process and/or threads. ie. when was a particular process and/or thread scheduled.

2. Thread state information. ie. when and which thread is waiting for an I/O to get over. And is there a way, I can measure how much time does I/O takes?

3. Context switch information. ie. which system call caused the context switch and from which thread does this system call was called from?

Further, in case if I want to make changes to the linux scheduler and the context switch functionalities, then which files should I aim for?

I would really appreciate if you can answer all or part of these problems.