Reputation: 8687
I was trying to practice some kernel process management APIs as in http://reiber.org/nxt/pub/Linux/LinuxKernelDevelopment/Linux.Kernel.Development.3rd.Edition.pdf (Linux Kernel Development by Robert Love, 3rd edition).
I am not sure how to practice the code snippet given in the text book. I can understand the theory but do not find a way to practice. For example: I want to read a process struct task_struct
to find it parent's process identifier or how many tasks are in which state or creating kernel threads etc? If I am not able to practice these then it would be hard remembering them. Such that these concepts remains embedded into my memory out of practice.
Upvotes: 1
Views: 1690
Reputation:
And, to inform you, You can get to know the PIDs and States of the processes by using bash command ps -ef
or ps ux
.
ps
stands for Process Status. The command should be used to display the currently running processes on Unix/Linux systems.
Upvotes: 0
Reputation: 1267
You can write a char driver and within its open/read/write methods, access the task_struct which will be the current user-space process that is doing the operation. You can know the processes PID, PPID and other info.
Upvotes: 1