RCS file: fork1.c,v Working file: fork1.c head: 1.1 branch: locks: strict root: 1.1 access list: symbolic names: keyword substitution: kv total revisions: 1; selected revisions: 1 description: fork1.c We saperate the child and parent using return value of fork system coll ---------------------------- revision 1.1 locked by: root; date: 2017/02/07 00:24:08; author: root; state: Exp; Initial revision =============================================================================
RCS file: header.h,v Working file: header.h head: 1.1 branch: locks: strict root: 1.1 access list: symbolic names: keyword substitution: kv total revisions: 1; selected revisions: 1 description: header.h All the header files inside this .h file these files are: stdio.h string.h fcntl.h unistd.h stdlib.h ---------------------------- revision 1.1 locked by: root; date: 2017/02/06 23:52:47; author: root; state: Exp; Initial revision =============================================================================
RCS file: pipe.c,v Working file: pipe.c head: 1.2 branch: locks: strict root: 1.2 access list: symbolic names: keyword substitution: kv total revisions: 2; selected revisions: 2 description: pipe.c We creat three pipe using "for" loop and print there file discripters ---------------------------- revision 1.2 locked by: root; date: 2017/02/07 00:26:15; author: root; state: Exp; lines: +4 -2 pipe.c remove printf statment ---------------------------- revision 1.1 date: 2017/02/06 23:55:49; author: root; state: Exp; Initial revision =============================================================================
RCS file: prototype.h,v Working file: prototype.h head: 1.1 branch: locks: strict root: 1.1 access list: symbolic names: keyword substitution: kv total revisions: 1; selected revisions: 1 description: prototype.h Every function diclaration is inside this .h file now we have 2 functions and which are pipe1() fork1() and their function pointer (*pipe1_ptr)() (*fork1_ptr)() ---------------------------- revision 1.1 locked by: root; date: 2017/02/07 00:21:06; author: root; state: Exp; Initial revision =============================================================================
RCS file: server.c,v Working file: server.c head: 1.2 branch: root: 1.2 access list: symbolic names: keyword substitution: kv total revisions: 2; selected revisions: 2 description: server.c Main function of this program is defined inside this file Inside the main we call pipe function and recive file dis. returned by pipe function ---------------------------- revision 1.2 locked by: root; date: 2017/02/07 00:26:41; author: root; state: Exp; lines: +9 -3 server.c Call a new function with using function pointer from this file ---------------------------- revision 1.1 date: 2017/02/06 23:57:20; author: root; state: Exp; Initial revision =============================================================================
RCS file: struct.h,v Working file: struct.h head: 1.1 branch: locks: strict root: 1.1 access list: symbolic names: keyword substitution: kv total revisions: 1; selected revisions: 1 description: struct.h A request structure defined here ---------------------------- revision 1.1 locked by: root; date: 2017/02/06 23:55:06; author: root; state: Exp; Initial revision =============================================================================
fork() :-> fork is a system call which is use to duplicate the process. and it create new process which is known the child process and over main process is known as parent process return of fork() :-> fork() return -1 for the error and fork() return zero when it is running for the child and it return "pid"(process ID) when it running for the parent
NOTE: ppid of child = pid(parent process ID) of parent
RCS file: child1.c,v Working file: child1.c head: 1.3 branch: locks: strict root: 1.3 access list: symbolic names: keyword substitution: kv total revisions: 3; selected revisions: 3 description: child1.c Inside child1.c file "child1()" function's defination is given And this function call from the "fork()" function and recive pipe_fd as a argument ---------------------------- revision 1.3 locked by: root; date: 2017/02/07 18:26:36; author: root; state: Exp; lines: +9 -4 add discription ---------------------------- revision 1.2 date: 2017/02/07 17:08:13; author: root; state: Exp; lines: +2 -2 child1.c With using execl we creat a new process which is "client" file and pass pipe-1 read fd and pipe-2 write-fd to the client.c file ---------------------------- revision 1.1 date: 2017/02/07 16:34:15; author: root; state: Exp; Initial revision =============================================================================
RCS file: child2.c,v Working file: child2.c head: 1.1 branch: locks: strict root: 1.1 access list: symbolic names: keyword substitution: kv total revisions: 1; selected revisions: 1 description: child2.c this .c file have the defination of child function this child2() function call from thefork2() function with pipe_fd And recive as the argument ---------------------------- revision 1.1 locked by: root; date: 2017/02/07 19:31:29; author: root; state: Exp; Initial revision =============================================================================
RCS file: client.c,v Working file: client.c head: 1.2 branch: locks: strict root: 1.2 access list: symbolic names: keyword substitution: kv total revisions: 2; selected revisions: 2 description: client.c client file is run by the eexecl system call from the server/fork1/child1() and recive file discripter as argument ---------------------------- revision 1.2 locked by: root; date: 2017/02/07 18:27:01; author: root; state: Exp; lines: +17 -7 add discription ---------------------------- revision 1.1 date: 2017/02/07 17:13:27; author: root; state: Exp; Initial revision =============================================================================
RCS file: fork1.c,v Working file: fork1.c head: 1.3 branch: locks: strict root: 1.3 access list: symbolic names: keyword substitution: kv total revisions: 3; selected revisions: 3 description: fork1.c We saperate the child and parent using return value of fork system coll ---------------------------- revision 1.3 locked by: root; date: 2017/02/07 18:27:19; author: root; state: Exp; lines: +11 -0 add discription. ---------------------------- revision 1.2 date: 2017/02/07 16:38:42; author: root; state: Exp; lines: +3 -3 fork1.c Call two new function from this funnction child1() parent1() ---------------------------- revision 1.1 date: 2017/02/07 00:24:08; author: root; state: Exp; Initial revision ============================================================================= RCS file: fork2.c,v Working file: fork2.c head: 1.1 branch: locks: strict root: 1.1 access list: symbolic names: keyword substitution: kv total revisions: 1; selected revisions: 1 description: fork2.c this .c file have the fork2() function defination fork2() function call from the main function and recive some argument like pipe_fd and fork_ret two new function is also call from this function and these are: child2() parent2() ---------------------------- revision 1.1 locked by: root; date: 2017/02/07 19:35:25; author: root; state: Exp; Initial revision =============================================================================
RCS file: header.h,v Working file: header.h head: 1.1 branch: locks: strict root: 1.1 access list: symbolic names: keyword substitution: kv total revisions: 1; selected revisions: 1 description: header.h All the header files inside this .h file these files are: stdio.h string.h fcntl.h unistd.h stdlib.h ---------------------------- revision 1.1 locked by: root; date: 2017/02/06 23:52:47; author: root; state: Exp; Initial revision =============================================================================
RCS file: parent1.c,v Working file: parent1.c head: 1.2 branch: locks: strict root: 1.2 access list: symbolic names: keyword substitution: kv total revisions: 2; selected revisions: 2 description: parent1.c Inside this .c file parent() function's defination is given which is called from the fork() function and it recive the pipe_fd as a argument ---------------------------- revision 1.2 locked by: root; date: 2017/02/07 18:27:23; author: root; state: Exp; lines: +13 -7 add discription ---------------------------- revision 1.1 date: 2017/02/07 16:42:24; author: root; state: Exp; =============================================================================
RCS file: parent2.c,v Working file: parent2.c head: 1.1 branch: locks: strict root: 1.1 access list: symbolic names: keyword substitution: kv total revisions: 1; selected revisions: 1 description: parent2.c have the defination of parent function ---------------------------- revision 1.1 locked by: root; date: 2017/02/07 19:39:52; author: root; state: Exp; Initial revision =============================================================================
RCS file: pipe.c,v Working file: pipe.c head: 1.2 branch: locks: strict root: 1.2 access list: symbolic names: keyword substitution: kv total revisions: 2; selected revisions: 2 description: pipe.c We creat three pipe using "for" loop and print there file discripters ---------------------------- revision 1.2 locked by: root; date: 2017/02/07 00:26:15; author: root; state: Exp; lines: +4 -2 pipe.c remove printf statment ---------------------------- revision 1.1 date: 2017/02/06 23:55:49; author: root; state: Exp; Initial revision =============================================================================
RCS file: prototype.h,v Working file: prototype.h head: 1.3 branch: locks: strict root: 1.3 access list: symbolic names: keyword substitution: kv total revisions: 3; selected revisions: 3 description: prototype.h Every function diclaration is inside this .h file now we have 2 functions and which are pipe1() fork1() and their function pointer (*pipe1_ptr)() (*fork1_ptr)() ----------------------------
---------------------------- revision 1.3 locked by: root; date: 2017/02/07 19:28:24; author: root; state: Exp; lines: +6 -0 prototype.h Add three new function dicleration here, and these are child2() parent2() fork2() Add function pointer also (*child2_ptr)() (*parent_ptr)() (fork2_ptr)() ---------------------------- revision 1.2 date: 2017/02/07 16:32:30; author: root; state: Exp; lines: +6 -2 prototype.h add two new function prototypes and these are child1() parent1() and their function pointer (*child1_ptr)() (*parent1_ptr)() ---------------------------- revision 1.1 date: 2017/02/07 00:21:06; author: root; state: Exp; Initial revision =============================================================================
RCS file: server.c,v Working file: server.c head: 1.5 branch: locks: strict root: 1.5 access list: keyword substitution: kv total revisions: 5; selected revisions: 5 description: server.c Main function of this program is defined inside this file Inside the main we call pipe function and recive file dis. returned by pipe function ---------------------------- revision 1.5 locked by: root; date: 2017/02/07 19:41:00; author: root; state: Exp; lines: +10 -1 *** empty log message *** ---------------------------- revision 1.4 date: 2017/02/07 18:27:27; author: root; state: Exp; lines: +2 -1 add discription ---------------------------- revision 1.3 date: 2017/02/07 16:45:26; author: root; state: Exp; lines: +7 -2 server.c
Assign address of function's to the function poipters as shown below child1_ptr=child parent1_ptr=parent1 ---------------------------- revision 1.2 date: 2017/02/07 00:26:41; author: root; state: Exp; lines: +9 -3 server.c Call a new function with using function pointer from this file ---------------------------- revision 1.1 date: 2017/02/06 23:57:20; author: root; state: Exp; Initial revision =============================================================================
RCS file: struct.h,v Working file: struct.h RCS file: struct.h,v Working file: struct.h head: 1.1 branch: locks: strict root: 1.1 access list: symbolic names: keyword substitution: kv total revisions: 1; selected revisions: 1 description: struct.h A request structure defined here ---------------------------- revision 1.1 locked by: root; date: 2017/02/06 23:55:06; author: root; state: Exp; Initial revision =============================================================================
Today i start implementation of Project:INTER PROCESS COMMUNICATION(IPC). Inter Process Communication using oneclientoneserver: In this first i create 4 pipes having 8 file descriptor and i give the system call fork() and by which a duplicate process is created called CHILD process,Now we have two process one is parent process and another one is child process. Child process have its own process id and parent process id (ppid) child is the process id of parents by which it is running. parent process also have its own process id and ppid of parent process is the pid of the process by which it is running. After fork i give the system call to child i.e execl. client have to request for some process to server.For this i passed pipe 1 file descriptor to client, client received those file descriptor and process the request. and write the request using write file descriptor then server receive the request using read file descriptor and further send the request to the process client. then process client receive the request and process the request and after processing it write result to the server using write file descriptor. Now result is received by the server using read file descriptor and server further send the result using write file descriptor of pipe 3. and at last client receive the result using result pipe.
When we try to establish communication between two or more processes then it is very difficult to establish communication just using library function, so that we use some system calls and many c library function.
IPC is not possible if two processes has no relation so that first of all we have to create some relation between two process. With using some system call it is very easy to create relation between two processes. Let first we discuss about,what is system call and what is c library function.
-> C libraries are defined in user space so that we can punch them in C program >And we can use all library function in over c program -> System calls are directly implemented in kernel space >and we no need to punch them in over c program
System calls which we used in over program are:
1. pipe() Pipe() system call is used to create pipe between two process 2. fork() Fork() system call is used to duplicate the process 3. execl() or execv() Execl() system call is used to create new process
For inter process communication we have to create a medium through which one process send the data to another process. Here we have pipes through which we send the data and receive the data.First we write a program server.c to create new processes called client1.c, client2.c, client3.c which send the request to server and server again send this request to the process client, we have three process client(processc1.c, processc2.c, processc3.c) and request is send to the process client according to the type of request.And process client again send back the result to the server process and server process send it to the client process.
Through server.c we create 4 pipe using pipe() system call and 4 pipe have 8 file descriptor(fd), every pipe have one read fd and one write fd
Then we duplicate the process using fork() system call,fork divide any process in two part which known as parent process and child process. And fork() return -1 for the failure, 0(zero) when it running for the child process and child pid(process ID) when it running for the parent.
With using switch() library function we separate the child and parent.
Through the child we create a new process using execl() system call, execl() create a new process by hijacking the child process. This new created process is known as client.
We can pass argument through the ececl() so we pass over pipes file descriptor(fd) but here we have a new problem that is we cant pass integer value as a argument through the execl() so first we change fd from integer to character using sprintf() library function and then we pass over string type fd as a argument.
In new created process or we can say in client we receive string type file descriptor and convert fd from character to integer using atoi() library function.
Now we have fd inside the client process so using this fd we write over request into pipe.
And we read the request from the pipe inside the server process now we want to send this process to the process client.
So that we again duplicate the process and from new created child we create a new process known as process client and pass it fd as argument. Then with using fd we can read the request which is send by the server process and process on the request and write the result into pipe. From pipe server can read the result and then send the result to the client. Finally our inter process communication is completed.
With using for() library function we run the complete process three times for the three clients and three process client.
IPC: 3-client 3-processClient using pipes(logfile):
RCS file: adder.c,v Working file: adder.c head: 1.1 branch: locks: strict rjangra: 1.1 access list: symbolic names: keyword substitution: kv total revisions: 1; selected revisions: 1 description: this is process client which process the request sent by client. it recieve the request,process it and send it to client through server. ---------------------------- revision 1.1 locked by: rjangra; date: 2017/02/16 16:16:46; author: rjangra; state: Exp; Initial revision =============================================================================
RCS file: client1.c,v Working file: client1.c head: 1.1 branch: locks: strict rjangra: 1.1 access list: symbolic names: keyword substitution: kv total revisions: 1; selected revisions: 1 description: client send the data on which operation is to be done to process client through server. client contains headers.h and declaration.h ---------------------------- revision 1.1 locked by: rjangra; date: 2017/02/16 16:18:54; author: rjangra; state: Exp; Initial revision =============================================================================
CS file: adder.c,v Working file: adder.c head: 1.2 branch: locks: strict root: 1.2 access list: symbolic names: keyword substitution: kv total revisions: 2; selected revisions: 2 description: We use adder file as a process client and now it is reciving the request comes from the server ---------------------------- revision 1.2 locked by: root; date: 2017/02/18 17:09:20; author: root; state: Exp; lines: +15 -2 After processing on the data we open a new fifo named as result_fifo2 And write result into the fifo ---------------------------- revision 1.1 date: 2017/02/18 16:16:32; author: root; state: Exp; Initial revision =============================================================================
RCS file: child.c,v Working file: child.c head: 1.3 branch: locks: strict root: 1.3 access list: symbolic names: keyword substitution: kv total revisions: 3; selected revisions: 3 description: This ".c" file have the child process created by the fork() system call With using execl() system call we create a new process called adder which is the process client to process on the request ---------------------------- revision 1.3 locked by: root; date: 2017/02/18 18:38:59; author: root; state: Exp; lines: +2 -2 change the condition to create of new process ---------------------------- revision 1.2 date: 2017/02/18 18:32:41; author: root; state: Exp; lines: +2 -2 add to new process client multiplier subtracter ---------------------------- revision 1.1 date: 2017/02/18 16:17:43; author: root; state: Exp; Initial revision =============================================================================
RCS file: client1.c,v Working file: client1.c head: 1.2 branch: locks: strict root: 1.2 access list: symbolic names: keyword substitution: kv total revisions: 2; selected revisions: 2 description: This ".c" file work as client which send request to the server and then server work on it ---------------------------- revision 1.2 locked by: root; date: 2017/02/18 17:52:16; author: root; state: Exp; lines: +15 -4 reading the result. from result_fifo1 send by server ---------------------------- revision 1.1 date: 2017/02/18 16:34:50; author: root; state: Exp; Initial revision =============================================================================
RCS file: creat_fifo.c,v Working file: creat_fifo.c head: 1.1 branch: locks: strict root: 1.1 access list: symbolic names: keyword substitution: kv total revisions: 1; selected revisions: 1 otal revisions: 1; selected revisions: 1 description: fifo: as we know that fifo is a named pipe so we have to creat it first this ".c" file is used to create the fifo using mkfifo() system call ---------------------------- revision 1.1 locked by: root; date: 2017/02/18 16:36:17; author: root; state: Exp; Initial revision =============================================================================
RCS file: fork1.c,v Working file: fork1.c head: 1.1 branch: locks: strict root: 1.1 access list: symbolic names: keyword substitution: kv total revisions: 1; selected revisions: 1 description: when we us fork() system call it duplicate the process and create a new process so new created process known as child process and old process is known as parent process to devide these processes we use switch statement with case 0 and defoult fork() teturn 0 when it is runing for the child and return child's pid(process ID) when it is runing for the parent ---------------------------- revision 1.1 locked by: root; date: 2017/02/18 16:37:56; author: root; state: Exp; Initial revision =============================================================================
RCS file: header.h,v Working file: header.h head: 1.1 branch: locks: strict root: 1.1 access list: symbolic names: keyword substitution: kv total revisions: 1; selected revisions: 1 description: All the header file are used in this program are given in this ".h" file these header files are #include<stdio.h> #include<string.h> #include<unistd.h> #include<stdlib.h> #include<fcntl.h> #include<signal.h> #include<sys/stat.h> ---------------------------- revision 1.1 locked by: root; date: 2017/02/18 16:05:56; author: root; state: Exp; Initial revision =============================================================================
RCS file: open_fifo.c,v Working file: open_fifo.c head: 1.1 branch: locks: strict root: 1.1 access list: symbolic names: keyword substitution: kv total revisions: 1; selected revisions: 1 description: To open any already created fifo we can call this function this function take fifo name and mode as a argument ---------------------------- revision 1.1 locked by: root; date: 2017/02/18 16:47:51; author: root; state: Exp; Initial revision =============================================================================
RCS file: open_fifo.c,v Working file: open_fifo.c head: 1.1 branch: locks: strict root: 1.1 access list: symbolic names: keyword substitution: kv total revisions: 1; selected revisions: 1 description: To open any already created fifo we can call this function this function take fifo name and mode as a argument ---------------------------- revision 1.1 locked by: root; date: 2017/02/18 16:47:51; author: root; state: Exp; Initial revision =============================================================================
RCS file: parent.c,v Working file: parent.c head: 1.3 branch: locks: strict root: 1.3 access list: symbolic names: keyword substitution: kv total revisions: 3; selected revisions: 3 description: This ".c" file is use to open a new fifo which send the data to the adder process client ---------------------------- revision 1.3 locked by: root; date: 2017/02/18 17:52:55; author: root; state: Exp; lines: +5 -3 open a new fifo called result_fifo1 and write the result which is send by adder ---------------------------- revision 1.2 date: 2017/02/18 17:10:48; author: root; state: Exp; lines: +7 -2 read the data from the result_fifo2 Send by the adder process ---------------------------- revision 1.1 date: 2017/02/18 16:49:34; author: root; state: Exp; Initial revision =============================================================================
RCS file: prototype.h,v Working file: prototype.h head: 1.1 branch: locks: strict root: 1.1 access list: symbolic names: keyword substitution: kv total revisions: 1; selected revisions: 1 description: All function diclaration is given in this ".h" file and these function are: creat_fifo() open_fifo() fork1() child() parent() This file also have function pointer for the same and these are: creat_fifo_ptr() open_fifo_ptr() fork1_ptr() child_ptr() parent_ptr() ---------------------------- revision 1.1 locked by: root; date: 2017/02/18 16:09:31; author: root; state: Exp; Initial revision =============================================================================
RCS file: server.c,v Working file: server.c head: 1.2 branch: locks: strict root: 1.2 access list: symbolic names: keyword substitution: kv total revisions: 2; selected revisions: 2 description: This ".c" file have the main function of the server process All function pointer assigning is here we call creat_fifo() and open_fifo from this function ---------------------------- revision 1.2 locked by: root; date: 2017/02/18 18:48:28; author: root; state: Exp; lines: +11 -7 run all program three time using for loop ---------------------------- revision 1.1 date: 2017/02/18 16:54:28; author: root; state: Exp; Initial revision =============================================================================
RCS file: struct.h,v Working file: struct.h head: 1.1 branch: locks: strict root: 1.1 access list: symbolic names: keyword substitution: kv total revisions: 1; selected revisions: 1 description: A structure is defined inside this file Which we use to send the request from client to server and then server to adder ---------------------------- revision 1.1 locked by: root; date: 2017/02/18 16:15:05; author: root; state: Exp; =============================================================================
logfile: IPC=>3 -client 3-process-client using pipes RCS file: adder.c,v Working file: adder.c head: 1.1 branch: locks: strict rjangra: 1.1 access list: symbolic names: keyword substitution: kv total revisions: 1; selected revisions: 1 description: this is process client which process the request sent by client. it recieve the request,process it and send it to client through server. ---------------------------- revision 1.1 locked by: rjangra; date: 2017/02/16 16:16:46; author: rjangra; state: Exp; Initial revision =============================================================================
RCS file: client1.c,v Working file: client1.c head: 1.1 branch: locks: strict rjangra: 1.1 access list: symbolic names: keyword substitution: kv total revisions: 1; selected revisions: 1 description: client send the data on which operation is to be done to process client through server. client contains headers.h and declaration.h ---------------------------- revision 1.1 locked by: rjangra; date: 2017/02/16 16:18:54; author: rjangra; state: Exp; Initial revision =============================================================================
RCS file: adder.c,v Working file: adder.c head: 1.1 branch: locks: strict rjangra: 1.1 access list: symbolic names: keyword substitution: kv total revisions: 1; selected revisions: 1 description: this is process client which process the request sent by client. it recieve the request,process it and send it to client through server. ---------------------------- revision 1.1 locked by: rjangra; date: 2017/02/16 16:16:46; author: rjangra; state: Exp; Initial revision
RCS file: client1.c,v Working file: client1.c head: 1.1 branch: locks: strict rjangra: 1.1 access list: symbolic names: keyword substitution: kv total revisions: 1; selected revisions: 1 description: client send the data on which operation is to be done to process client through server. client contains headers.h and declaration.h ---------------------------- revision 1.1 locked by: rjangra; date: 2017/02/16 16:18:54; author: rjangra; state: Exp; Initial revision =============================================================================
RCS file: data.h,v Working file: data.h head: 1.3 branch: locks: strict root: 1.3 access list: symbolic names: keyword substitution: kv total revisions: 3; selected revisions: 3 description: Data.h is also a header file which have definition of request structure ---------------------------- revision 1.3 locked by: root; date: 2017/03/06 17:52:05; author: root; state: Exp; lines: +10 -0 *** empty log message *** ---------------------------- revision 1.2 date: 2017/03/06 17:19:29; author: root; state: Exp; lines: +3 -2 add a new pid variable of "pid_t" type which is used to store the pid of any process ---------------------------- revision 1.1 date: 2017/03/03 18:13:40; author: root; state: Exp; Initial revision =============================================================================
RCS file: destructor.c,v Working file: destructor.c head: 1.2 branch: locks: strict root: 1.2 access list: symbolic names: keyword substitution: kv total revisions: 2; selected revisions: 2 description: ---------------------------- revision 1.2 locked by: root; date: 2017/03/06 18:30:17; author: root; state: Exp; lines: +100 -20 This is also a client which is use to destroy the server ---------------------------- revision 1.1 date: 2017/03/04 00:09:31; author: root; state: Exp; Initial revision =============================================================================
RCS file: fork1.c,v Working file: fork1.c head: 1.2 branch: locks: strict root: 1.2 access list: symbolic names: keyword substitution: kv total revisions: 2; selected revisions: 2 description: for running child ---------------------------- revision 1.2 locked by: root; date: 2017/03/03 23:59:28; author: root; state: Exp; lines: +5 -4 change in excel ---------------------------- revision 1.1 date: 2017/03/03 21:20:21; author: root; state: Exp; Initial revision ============================================================================= RCS file: header.h,v Working file: header.h head: 1.4 branch: locks: strict root: 1.4 access list: symbolic names: keyword substitution: kv total revisions: 4; selected revisions: 4 description: All header files are initialize in this header file ---------------------------- revision 1.4 locked by: root; date: 2017/03/07 17:05:52; author: root; state: Exp; lines: +1 -0 add a new header file "semaphore.h" which is used for semaphore and this semaphore is gonna used only for threads ---------------------------- revision 1.3 date: 2017/03/06 21:51:22; author: root; state: Exp; lines: +2 -0 add a header file for threads ---------------------------- revision 1.2 date: 2017/03/06 17:20:28; author: root; state: Exp; lines: +2 -1 for semaphores we add a new header file sys/sem.h ---------------------------- revision 1.1 date: 2017/03/03 18:15:22; author: root; state: Exp; Initial revision =============================================================================
RCS file: main_thread.c,v Working file: main_thread.c head: 1.18 branch: locks: strict root: 1.18 access list: symbolic names: keyword substitution: kv total revisions: 18; selected revisions: 18 description: ---------------------------- revision 1.18 locked by: root; date: 2017/04/02 20:41:58; author: root; state: Exp; lines: +1 -1 *** empty log message *** ---------------------------- revision 1.17 date: 2017/03/13 17:43:33; author: root; state: Exp; lines: +1 -1 *** empty log message *** ---------------------------- revision 1.16 date: 2017/03/10 16:44:10; author: root; state: Exp; lines: +4 -4 *** empty log message *** ---------------------------- revision 1.15 date: 2017/03/10 16:40:33; author: root; state: Exp; lines: +5 -1 *** empty log message *** ---------------------------- revision 1.14 date: 2017/03/09 19:02:19; author: root; state: Exp; lines: +5 -5 *** empty log message *** ---------------------------- revision 1.13 date: 2017/03/07 23:06:41; author: root; state: Exp; lines: +29 -17 *** empty log message *** ---------------------------- revision 1.12 date: 2017/03/07 21:38:08; author: root; state: Exp; lines: +3 -3 *** empty log message *** ---------------------------- revision 1.11 date: 2017/03/07 20:52:07; author: root; state: Exp; lines: +2 -2 ================================================================================================ now we replacing the the thread semaphore with a mutex so we use pthread_mutex_init() system call to create a mutex ================================================================================================ ---------------------------- revision 1.10 date: 2017/03/07 20:13:52; author: root; state: Exp; lines: +2 -2 also now we are not using the process semaphore inside the clients ---------------------------- revision 1.9 date: 2017/03/07 18:45:36; author: root; state: Exp; lines: +1 -1 wait until result is writen ---------------------------- revision 1.8 date: 2017/03/07 18:43:46; author: root; state: Exp; lines: +12 -12 using semaphore after thread creation ---------------------------- revision 1.7 date: 2017/03/07 18:18:57; author: root; state: Exp; lines: +3 -3 *** empty log message *** ---------------------------- revision 1.6 date: 2017/03/07 18:12:22; author: root; state: Exp; lines: +11 -11 sem_get() function calling is out side from the loop ---------------------------- revision 1.5 date: 2017/03/07 17:58:34; author: root; state: Exp; lines: +9 -9 use sem_post() system call before the creation of thread ---------------------------- revision 1.4 date: 2017/03/07 17:51:06; author: root; state: Exp; lines: +10 -2 *** empty log message *** ---------------------------- revision 1.3 date: 2017/03/07 17:21:05; author: root; state: Exp; lines: +2 -2 sending the address of sem_id extern ---------------------------- revision 1.2 date: 2017/03/07 17:09:02; author: root; state: Exp; lines: +18 -0 create a semaphore using sem_init() system call and increment in it using sem_post() system call ---------------------------- revision 1.1 date: 2017/03/06 23:00:45; author: root; state: Exp; Initial revision =============================================================================