jeudi 30 juin 2011

mkfifo or named pipe

mkfifo crée une file FIFO (un tube nommé) pour chacun des noms indiqués.

Une "FIFO" est un type de fichier spécial permettant la communication entre des processus indépendants. Un processus ouvre la FIFO en écriture, et un autre l'ouvre en lecture. Ensuite les données peuvent transiter entre les processus comme avec les tubes anonymes proposés par les shells.
ls | grep x 
The above, familiar to most Unix users, is an example of an “unnamed pipe”. The pipe exists only inside the kernel and cannot be accessed by processes that created it, in this case, the bash shell. For those who don't already know, a parent process is the first process started by a program that in turn creates separate child processes that execute the program.
The other sort of pipe is a “named” pipe, which is sometimes called a FIFO. FIFO stands for “First In, First Out” and refers to the property that the order of bytes going in is the same coming out. The “name” of a named pipe is actually a file name within the file system. Pipes are shown by ls as any other file with a couple of differences:
% ls -l fifo1
prw-r--r--   1 andy  users    0 Jan 22 23:11 fifo1|

Aucun commentaire:

Enregistrer un commentaire

Nombre total de pages vues