From ff4ff884c7708c52ea535a5d0118760a25b91c6b Mon Sep 17 00:00:00 2001 From: Yaswanth ps Date: Sun, 14 Oct 2018 14:06:55 +0530 Subject: [PATCH 1/2] update process.c --- process.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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"); } From 0aa7f76343a734e5fe116b9e0c1ae2d5833102e5 Mon Sep 17 00:00:00 2001 From: Yaswanth ps Date: Sun, 14 Oct 2018 14:09:29 +0530 Subject: [PATCH 2/2] update semaphore.c --- semaphore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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"); }