EmbLogic's Blog

IPC USING FIFOS AND SEMAPHORES.

HEADER FILE ***************************************************************

RCS file: ./header.h,v
Working file: ./header.h
head: 1.1
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 1;    selected revisions: 1
description:
Included “stdio.h” , “stdlib.h”, “unistd.h”, “linux/sem.h”, “fcntl.h”, and “signal.h”.
Declaration of the structure “package”, with members – op1(int), op2(int), arth(char), pid(pid_t), result(int).
—————————-
revision 1.1
date: 2014/08/12 10:59:58;  author: root;  state: Exp;
Initial revision
=============================================================================

SERVER PROGRAM **************************************************************

RCS file: ./server.c,v
Working file: ./server.c
head: 1.1
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 1;    selected revisions: 1
description:
This is the server program .
Declared 3 fifos , 1 for client routines and 2 for processing routines.
fork children of the server. number of children is equal to number of clients.
Each child links with respective clients and reads the data to be processed.
then the forked child send the data to the processing client .
gets the result back, and sends it to the client.
semaphores are used wherever fifos are shared.
—————————-
revision 1.1
date: 2014/08/12 11:18:11;  author: root;  state: Exp;
Initial revision
=============================================================================

CLIENT PROGRAM **************************************************************

RCS file: ./client.c,v
Working file: ./client.c
head: 1.1
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 1;    selected revisions: 1
description:
This is the client program.
It writes the values to b written into the fifo for server to read it.
this it pauses using pause() system call.
when the server has the answer it prompts the client by sending it a signal using kill system call.
the respective client whose pid is present in the kill() is resumed , reads the result and displays it.
—————————-
revision 1.1
date: 2014/08/12 11:21:10;  author: root;  state: Exp;
Initial revision
=============================================================================

ADD PROCESSING CLIENT *******************************************************

RCS file: ./add.c,v
Working file: ./add.c
head: 1.1
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 1;    selected revisions: 1
description:
This is the addition processing client.
it reads the values from server using one fifo.
each processing client is using a common fifo to write back the result to server.
—————————-
revision 1.1
date: 2014/08/12 11:23:54;  author: root;  state: Exp;
Initial revision
=============================================================================

SUBTRACT PROCESSING CLIENT **************************************************

RCS file: ./subtract.c,v
Working file: ./subtract.c
head: 1.1
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 1;    selected revisions: 1
description:
This is the subtracting client.
it reads the values from server using one fifo.
each processing client is using a common fifo to write back the result to server.
—————————-

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>