diff --git a/process.c b/process.c index 995ba01..97d6d60 100644 --- a/process.c +++ b/process.c @@ -3,29 +3,29 @@ #include main() { - int i,p; + int i,n; printf("\n pid=%d, ppid=%d",getpid(),getppid()); p=fork(); - if(p == 0) + if(n == 0) { for(i=0;i<3;i++) { - printf("\n Child process running,pid=%d,ppid=%d",getpid(),getppid()); + printf("\n Child process is running,pid=%d,ppid=%d",getpid(),getppid()); sleep(2); } printf("\n Child Exited\n"); sleep(2); } - else if(p>0) + else if(n>0) { for(i=0;i<6;i++) { - printf("\n Parent process running pid=%d,ppid=%d",getpid(),getppid()); + printf("\n Parent process is running pid=%d,ppid=%d",getpid(),getppid()); sleep(2); } } else - printf("\n Error in creating chid process"); + printf("\n Error in creating child process"); } diff --git a/semaphore.c b/semaphore.c index 07d3fe0..dd6c655 100644 --- a/semaphore.c +++ b/semaphore.c @@ -34,6 +34,6 @@ main() printf("Value after unlocking is %d\n",val1); if((semctl(sid,0,IPC_RMID) == 0)) - printf("Closed the semaphore\n"); + printf("Close the semaphore\n"); }