



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
implementation of pipe processing for the operating system lab
Typology: Exercises
1 / 5
This page cannot be seen from the preview
Don't miss anything!




To write a program for create a pope processing ALGORITHM:
Start the program.
Declare the variables.
Read the choice.
Create a piping processing using IPC.
Assign the variable lengths
“ strcpy” the message lengths.
To join the operation using IPC.
Stop the program .
#include <unistd.h> #include <stdlib.h> #include <stdio.h> #include <string.h> #define MSG_LEN 64 int main(){ int result; int fd[2]; char message[MSG_LEN]; char recvd_msg[MSG_LEN]; result = pipe (fd); //Creating a pipe//fd[0] is for reading and fd[1] is for writing if (result < 0) { perror("pipe "); exit(1); } strncpy(message,"Linux World!! ",MSG_LEN); result=write(fd[1],message,strlen(message)); if (result < 0) { perror("write"); exit(2);
if (result < 0) { perror("read"); exit(3); } printf("%s\n",recvd_msg); return 0;}
OUTPUT: