Operating system level programming has a different taste than any other
programming. It is very simple to understand the operating systems layers if
you do os programming in linux. You can start that with system calls such as
fork, pipe, memget, kill etc .

For example, you know pipe. In linux command prompt ‘|’
is using for pipe. For example ls is the command for list the directory …
ls | more means ?? It means give the output of ls command to more command. “more”
command’s input will be the output of “ls” command. Here the
output and input are piped. Standard input and output are changed.
(“more” command is using for showing page by page data)

Example Code:

Click read more for sample code

include #include #include #include int main(){ pidt pid; int rv; int commpipe[2]; /* This holds the fd for the input & output of the pipe */ /* Setup communication pipeline first */ if(pipe(commpipe)){ fprintf(stderr,"Pipe error!n"); exit(1); } /* Attempt to fork and check for errors */ if( (pid=fork()) -1){ fprintf(stderr,"Fork error. Exiting.n"); /* something went wrong */ exit(1); } if(pid){ /* A positive (non-negative) PID indicates the parent process */ dup2(commpipe[1],1); /* Replace stdout with out side of the pipe */ close(commpipe[0]); /* Close unused side of pipe (in side) */ setvbuf(stdout,(char*)NULL,IONBF,0); /* Set non-buffered output on stdout / sleep(2); printf("Hellon"); sleep(2); printf("Goodbyen"); sleep(2); printf("exitn"); wait(&rv); / Wait for child process to end / fprintf(stderr,"Child exited with a %d valuen",rv); } else{ / A zero PID indicates that this is the child process / //dup2(commpipe[0],0); / Replace stdin with the in side of the pipe / close(commpipe[1]); / Close unused side of pipe (out side) / / Replace the child fork with a new process */ if(execl("child","child",NULL) -1){ fprintf(stderr,"execl Error!"); exit(1); } } return 0; }