How do I create a process in C and play with it’s state?
- I would like to know how to create a process.
- I would like to know how to put this process in Blocked state.
- I would like to know how to put this process in a Zombie state.
A guide on how to work with processes on C would be helpfull I just can’t find it around. This way I could answer those questions myself.
I’ve been playing around with ps to see the state of a process but dont really know how to start.
Am working on Linux, sorry for my English.
Create a child process using fork() – your program itself runs in a process anyway
Put process in “blocked” state:- use sleep() or issue a blocking write() – read manpages for more info – dunno what exactly you mean by ‘blocked’ here
Creating a zombie – fork() and then exit the program. You can “see” the zombie from ps