Process Management part 2
30 October 2013 By Bhavyanshu Parasher
If you have read the part 1, then you must know that each process in Linux system is identified by its unique process ID known as pid. These are 16 bit numbers that are assigned sequentially. When referrin to the process in GNU C, we always use
pid_t typedef which is in
sys/types.h. To get the process ID, we can use
getppid() system call. It will return the process ID.
Now coming back to where we left in the first part of this. We were studying how to create a process. Let me exlpain you with a code snippet.
Linux promises that no process will be completely starved of execution resources. There is a niceness value (zero by default) which means that if it is higher then the process is given a lesser execution priority.
Killing a process
We have often used kill command in linux system to kill a process but did you ever think how it works internally? Well, the kill command works by sending the process a SIGTERM, or termination, signal. This causes the process to terminate, unless the executing program explicitly handles or masks the SIGTERM signal.
In the next part we will read about threads. You can subscribe via email for latest posts.
blog comments powered by Disqus