The other way is to implement what you said manually. That is, to check the state of a process you need to execute a short kernel code to search through kernel process table and extract the process you are looking for. For the other purpose, that is to get the pid, read about fork() wait_pid().
Bookmarks