Inter Process Communications – Pipes Explained With Simple Example

Pipes are one of the oldest and simplest form of Inter-Process communications. Typically, a pipe is half-duplex way of transmitting data between two processes which means data can be passed in one direction only. It can be used only between processes having common parent.
Normally pipes are used between parent and child processes.

(more…)
Inter Process Communications – Pipes Explained With Simple Example Read More

Difference Between Process and Threads

A program in execution is called a process. There can be multiple instances of a program running in the system which are identified by a unique id called process id. Operating System ensures that each process has a unique id which is always a non-negative integer number.

A thread is a lightweight process which can only be used inside a process. Like process, thread also has a unique identifier to identify threads which are called thread ids. Unlike process ids, thread ids are only unique to a process and one process threads are unknown to other process.

(more…)
Difference Between Process and Threads Read More

fork () Function Explained With Simple Example

Fork () is a system call in unix which can be used by a process to create a new process. This is a special function which is called once but it returns twice, one for parent process who called the fork () and second for the child process which is created by fork (). Fork () returns process id of the new process in parent process whereas it returns 0 for child process.

Syntax of fork () function call is as follows:

#include <unistd.h>
pid_t fork(void);   /* Returns: 0 in child, process ID of child in parent, −1 on error */
(more…)
fork () Function Explained With Simple Example Read More