fbpx

Linux kernel Unix kernel PID and file descriptor fully explained during network administration

(Last Updated On: May 14, 2010)

Linux kernel Unix kernel PID and file descriptor fully explained during network administration
One of the more tricky things in Linux within the kernel are the process Ids and file descriptors that go with each binary executable file you run or have access to. All sorts of things can happen within each process a bin executable file, a process could: open the following kind of files:
=> Actual log file
=> /dev files
=> UNIX Sockets
=> Network sockets
=> Library files /lib /lib64
=> Executables and other programs etc
Some handy ways to find out about processes is to use the lsof command. There are number of steps we must accomplish:
1. Get the PID we need by running ‘ps aux|grep prog’ or ‘pidof myprog’. This will then out put the process id. A PID could be 2892
2. We need to list the files open by the PID by using ‘lsof –p 2892’. You could also ‘cd /proc/2892’/fd’. Then ‘ls –l|wc –‘ for the file count used.
Do understand that /proc is file system generated for each process created when the system boots. There is a variety stories from this /proc directory. We get”
? /proc/PID/cmdline : process arguments
? /proc/PID/cwd : process current working directory (symlink)
? /proc/PID/exe : path to actual process executable file (symlink)
? /proc/PID/environ : environment used by process
? /proc/PID/root : the root path as seen by the process. For most processes this will be a link to / unless the process is running in a chroot jail.
? /proc/PID/status : basic information about a process including its run state and memory usage.
? /proc/PID/task : hard links to any tasks that have been started by this (the parent) process.

Hopefully this will give you a better of how processes are managed by the Linux kernel as it executes.

NOTE I now post my TRADING ALERTS into my personal FACEBOOK ACCOUNT and TWITTER. Don't worry as I don't post stupid cat videos or what I eat!

Subscribe For Latest Updates

Sign up to best of business news, informed analysis and opinions on what matters to you.
Invalid email address
We promise not to spam you. You can unsubscribe at any time.

NOTE!

Check NEW site on stock forex and ETF analysis and automation

Scroll to Top