09 April

Program for IPC using pipe() function

The second method for IPC is using the pipe() function. Before writing a program for IPC using pipe() function let us first understand its working. Syntax: #include<unistd.h>int pipe(int pipefd[2]); pipe() function creates a unidirectional pipe for IPC. On success it return two file descriptors pipefd[0] and pipefd[1]. pipefd[0] is the reading end of the pipe. […]

28 March

Program to replace process image using execl( )

There is a family of function which can be used for replacing the current process with a new process. They differ in the number of arguments and the way they start a new process. The various functions are execl, execlp, execle, execv and execvp. In this post we will write a Program to replace process image using execl( […]

26 March

Program for Process Synchronization using mutex locks

/* Program for process synchronization using locks Program create two threads: one to increment the value of a shared variable and second to decrement the value of shared variable. Both the threads make use of locks so that only one of the threads is executing in its critical section */ #include<pthread.h>#include<stdio.h>#include<unistd.h>void *fun1();void *fun2(); int shared=1; […]