A FIFO is similar to a pipe. FIFO (First In First Out) is a one-way flow of data. FIFO’s have a name i.e. FIFO is a named pipe. This is the main difference between pipes and FIFOs.
To create FIFO,we need two header files:
#include <sys/types.h>
#include <sys/stat.h>
and there are two ways to create FIFO:
int mkfifo(const char *pathname, mode_t mode);
and other way is to use mknod(const char *filename,mode_t mode|S_IFIFO,(dev_t)0);
There is no need to pass the file descriptor is FIFO which is the limitation of pipes. To read and write the data we have to open the FIFO using O_RDONLY to read the data and O_WRONLY to write the data through FIFO. To avoid block on read or block on write,we can use O_NONBLOCK.