EmbLogic's Blog

Replacing Processes

Assignment- Create a file ,  Write into the file , Fork a child process , Use EXECL in the child process to call a new process , Read from the file in new process and Observe.

Status– Execution Successful and pipeling has to created if the writing in to the file and creation of FD was done in parent process.

Posted in Uncategorized | Leave a comment

Replacing Processes

Assignment- Create a file , Write into the file , Using EXECL to call a new process and passing FD as an argument , And Reading the file in the new process using the FD obtained.(without fork)

Status– Executed Successfully!

Posted in Uncategorized | Leave a comment

Program to understand the working of user defined signals:SIGUSR1 and SIGUSR2.

RCS file: sigusr_signal.c,v
Working file: sigusr_signal.c
head: 1.8
branch:
locks: strict
root: 1.8
access list:
symbolic names:
keyword substitution: kv
total revisions: 8;    selected revisions: 8
description:
Code to understand the working of SIGUSR1 and SIGUSR2.
—————————-
revision 1.8    locked by: root;
date: 2014/01/27 02:23:52;  author: root;  state: Exp;  lines: +8 -3
The pid of the parent process is coming incorrect due to missing ().
The parent process is getting terminated due to SIGINT signal.
—————————-
revision 1.7
date: 2014/01/27 02:18:19;  author: root;  state: Exp;  lines: +1 -0
Prototype of the signal_handler is added.
—————————-
revision 1.6
date: 2014/01/27 02:16:46;  author: root;  state: Exp;  lines: +16 -0
Defining the body of the signal handler that is invoked when a SIGUSR1 and SIGUSR2 is received.
—————————-
revision 1.5
date: 2014/01/27 02:00:48;  author: root;  state: Exp;  lines: +15 -2
After fork() system call,inside the child process:A signal is sent to the parent process
using kill() system call.
—————————-
revision 1.4
date: 2014/01/27 01:38:47;  author: root;  state: Exp;  lines: +11 -0
Installing a signal handler for SIGUSR1 and SIGUSR2.
Header file:<stdlib.h> is included to support exit() function.
—————————-
revision 1.3
date: 2014/01/27 01:32:49;  author: root;  state: Exp;  lines: +3 -1
Header file:<unistd.h> is included to support fork() system call.
—————————-
revision 1.2
date: 2014/01/27 01:30:39;  author: root;  state: Exp;  lines: +1 -0
Header file:<signal.h> is included to support various signal names.
—————————-
revision 1.1
date: 2014/01/27 01:30:08;  author: root;  state: Exp;
Initial revision
=============================================================================

Posted in Project 03: Client Server Communication using Linux and IPC | Leave a comment

Server process handling the requests of multiple clients using Shared memory IPC mechanism.

RCS file: server.c,v
Working file: server.c
head: 1.15
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 15;    selected revisions: 15
description:
Code of the server process that will handle multiple requests from the clients.
In this version,shared memory segment is created and a message is displayed to the user
if there is any error in creating the shared memory segment.
—————————-
revision 1.15
date: 2014/01/26 21:23:11;  author: root;  state: Exp;  lines: +7 -2
Synchronization between the clients is achieved using semaphore and sleep() system call.
The result is gettting displayed for both the clients.
But the problem is that the code is slow due to excessive use of sleep() system call.
—————————-
revision 1.14
date: 2014/01/26 20:18:25;  author: root;  state: Exp;  lines: +80 -77
The server process is calculating the requests infinite times.
Issue:Inside the while loop.
Checking….
—————————-
revision 1.13
date: 2014/01/26 20:08:25;  author: root;  state: Exp;  lines: +31 -2
The result is getting displayed for only a single client.
Logical error present.
Checking…..
—————————-
revision 1.12
date: 2014/01/26 19:18:08;  author: root;  state: Exp;  lines: +1 -0
The result is getting displayed inside the server as well as inside the client.
Coding is correct.
Now making the code work for more than one client.
—————————-
revision 1.11
date: 2014/01/26 16:21:03;  author: root;  state: Exp;  lines: +2 -0
The result is read inside the server correctly.
But the client is not able to read the result.
Logical error fixed.
This is due to the result is not written inside the shared memory segment.
—————————-
revision 1.10
date: 2014/01/26 16:12:15;  author: root;  state: Exp;  lines: +2 -1
Compilation error fixed.
Issue:Address is not passed inside the read() system call.
—————————-
revision 1.9
date: 2014/01/26 15:51:06;  author: root;  state: Exp;  lines: +31 -3
Inside the switch case,if operand is ‘+’ then fork and execl is done.
The data is passed to the processing client.
The result is received from the processing client but only for the addition operation.
—————————-
revision 1.8
date: 2014/01/26 15:02:22;  author: root;  state: Exp;  lines: +12 -1
Creating a switch case that will create a pipe for every request from a client.
—————————-
revision 1.7
date: 2014/01/26 05:18:59;  author: root;  state: Exp;  lines: +1 -1
Declaration error fixed.
Issue:Typing mistake.
—————————-
revision 1.6
date: 2014/01/26 05:02:07;  author: root;  state: Exp;  lines: +7 -0
Semaphore value is set using the semctl() system call.
—————————-
revision 1.5
date: 2014/01/26 04:56:03;  author: root;  state: Exp;  lines: +7 -0
A semaphore is created before creating the shared memory segment.
Initializing the semaphore inside the server…..
—————————-
revision 1.4
date: 2014/01/26 04:52:03;  author: root;  state: Exp;  lines: +8 -1
After storing the address at which the shared memory segment is attached.
The operands are fetched inside the server.
—————————-
revision 1.3
date: 2014/01/26 04:26:58;  author: root;  state: Exp;  lines: +8 -0
The size of the shared memory segment is checked using shmctl.
—————————-
revision 1.2
date: 2014/01/26 04:01:32;  author: root;  state: Exp;  lines: +6 -0
Shared memory segment is attached to the program’s address space using the shmat() system call.
If unsuccessfull a message is displayed to the user.
—————————-
revision 1.1
date: 2014/01/26 03:57:30;  author: root;  state: Exp;
Initial revision
=================================================================
RCS file: client1.c,v
Working file: client1.c
head: 1.12
branch:
locks: strict
root: 1.12
access list:
symbolic names:
keyword substitution: kv
total revisions: 12;    selected revisions: 12
description:
This is the client that requests the addition operation.
In this revision:shared memory segment is obtained inside the client,that is created by the server.
—————————-
revision 1.12    locked by: root;
date: 2014/01/26 16:24:28;  author: root;  state: Exp;  lines: +4 -2
The result is not collected from the shared memory segment inside the client.
Bug fixed.
Checking the final result inside the client process….
—————————-
revision 1.11
date: 2014/01/26 14:07:08;  author: root;  state: Exp;  lines: +15 -2
The result is read inside the client1 inside the sum variable.
After reading the result,shared memory segment is detached.
The code will display an error message if there is problem in detaching the shared memory segment.
—————————-
revision 1.10
date: 2014/01/26 05:21:47;  author: root;  state: Exp;  lines: +1 -1
Logical error fixed.
Inside the shmat(),few arguments are passed.
—————————-
revision 1.9
date: 2014/01/26 05:17:45;  author: root;  state: Exp;  lines: +1 -0
operand is written to the shared memory segment by type casting.
—————————-
revision 1.8
date: 2014/01/26 05:13:21;  author: root;  state: Exp;  lines: +12 -1
The definitions of the acquire and release semaphores are given.
—————————-
revision 1.7
date: 2014/01/26 05:06:23;  author: root;  state: Exp;  lines: +10 -0
Prototypes of the functions that will acquire and release semaphore are added.
The critical section region is defined.
Defining the body of the acquire and release functions……
—————————-
revision 1.6
date: 2014/01/26 04:46:12;  author: root;  state: Exp;  lines: +5 -1
Variables are stored in the shared memory segment and they will be available to the server.
—————————-
revision 1.5
date: 2014/01/26 04:42:39;  author: root;  state: Exp;  lines: +7 -0
Semaphore is obtained using the semget() system call.
—————————-
revision 1.4
date: 2014/01/26 04:36:46;  author: root;  state: Exp;  lines: +2 -1
A temporary variable is used to store the address at which the shared memory segment is attached.
—————————-
revision 1.3
date: 2014/01/26 04:34:06;  author: root;  state: Exp;  lines: +10 -1
The numbers are initialized with values and operator + is used to tell the server
that do the addition operation.
—————————-
revision 1.2
date: 2014/01/26 04:24:40;  author: root;  state: Exp;  lines: +7 -1
Shared memory segment is attached to the client’s address space,if there is an error
a message will get displayed.
—————————-
revision 1.1
date: 2014/01/26 04:21:03;  author: root;  state: Exp;
Initial revision
=========================================================================================
RCS file: header.h,v
Working file: header.h
head: 1.5
branch:
locks: strict
root: 1.5
access list:
symbolic names:
keyword substitution: kv
total revisions: 5;    selected revisions: 5
description:
The main header file is header.h
This includes all the required header files.
—————————-
revision 1.5    locked by: root;
date: 2014/01/26 15:07:59;  author: root;  state: Exp;  lines: +1 -0
header file:<unistd.h> is included to support pipe functions.
—————————-
revision 1.4
date: 2014/01/26 05:20:06;  author: root;  state: Exp;  lines: +1 -0
Header file:<sys/sem.h> is included to support the semaphore functions.
—————————-
revision 1.3
date: 2014/01/26 05:01:26;  author: root;  state: Exp;  lines: +4 -0
A union is declared inside this file.
—————————-
revision 1.2
date: 2014/01/26 05:00:30;  author: root;  state: Exp;  lines: +1 -0
Header file:stdlib.h is added to support exit().
—————————-
revision 1.1
date: 2014/01/26 03:48:37;  author: root;  state: Exp;
Initial revision
=============================================================================

Posted in Project 03: Client Server Communication using Linux and IPC | Leave a comment

Flash Player Installation Script for Fedora

#!/bin/bash
if [[ $(uname -a | grep x86_64) ]]
then
rpm -ivh http://linuxdownload.adobe.com/adobe-release/adobe-release-x86_64-1.0-1.noarch.rpm
rpm –import /etc/pki/rpm-gpg/RPM-GPG-KEY-adobe-linux
else
rpm -ivh http://linuxdownload.adobe.com/adobe-release/adobe-release-i386-1.0-1.noarch.rpm
rpm –import /etc/pki/rpm-gpg/RPM-GPG-KEY-adobe-linux
fi
yum install flash-plugin nspluginwrapper alsa-plugins-pulseaudio libcurl

Posted in Uncategorized | Leave a comment

Pthread program to understand the working of Thread Semaphore.

RCS file: simple_wait_and_post.c,v
Working file: simple_wait_and_post.c
head: 1.11
branch:
locks: strict
root: 1.11
access list:
symbolic names:
keyword substitution: kv
total revisions: 11;    selected revisions: 11
description:
Code to demonstrate the working of sem_wait and sem_post.
—————————-
revision 1.11    locked by: root;
date: 2014/01/25 06:30:56;  author: root;  state: Exp;  lines: +4 -2
After sem_wait() and sem_post() to see the updated value of semaphore use sem_getvalue() system call.
The result is coming as desired….
—————————-
revision 1.10
date: 2014/01/25 06:27:33;  author: root;  state: Exp;  lines: +4 -0
Now the child thread is executing,previously main thread is terminating before the child thread to finish.
sem_wait() and sem_post() are added to see theie functioning…
—————————-
revision 1.9
date: 2014/01/25 06:24:26;  author: root;  state: Exp;  lines: +1 -0
pthread_join() system call is used to make the main thread wait for the child thread.
Checking….
—————————-
revision 1.8
date: 2014/01/25 06:21:43;  author: root;  state: Exp;  lines: +1 -1
Compilation successfull.
Program is displaying the print statements present in the main threads but not in the child thread.
—————————-
revision 1.7
date: 2014/01/25 06:20:39;  author: root;  state: Exp;  lines: +1 -0
header file:<semaphore.h> is added to support built-in functions.
—————————-
revision 1.6
date: 2014/01/25 06:18:09;  author: root;  state: Exp;  lines: +13 -0
sem_getvalue() and sem_init() system calls are used to initialize and retrieving the value of the thread
semaphore.
—————————-
revision 1.5
date: 2014/01/25 06:12:00;  author: root;  state: Exp;  lines: +5 -0
Prototype of the display() function is given.
A global variable of type sem_t is declared.
Defining the body of the display function……
—————————-
revision 1.4
date: 2014/01/25 06:09:26;  author: root;  state: Exp;  lines: +1 -0
Header file:<pthread.h> is included to support built-in thread functions.
—————————-
revision 1.3
date: 2014/01/25 06:07:53;  author: root;  state: Exp;  lines: +11 -0
A variable of type pthread_t is declared that will store the thread_id.
pthread_create() system call is used to create the thread.
—————————-
revision 1.2
date: 2014/01/25 06:04:43;  author: root;  state: Exp;  lines: +5 -1
Header file:<stdio.h> is added to support I/O functions.
Defining the body of the main thread…
—————————-
revision 1.1
date: 2014/01/25 06:03:50;  author: root;  state: Exp;
Initial revision
=============================================================================

Posted in Project 04: FTP based Client Server using Threads and Sockets | Leave a comment

Pthreads program to find Sum of first n-natural numbers,thread synchronization is achieved by using sleep() system call.

RCS file: sum_of_n_natural_number.c,v
Working file: sum_of_n_natural_number.c
head: 1.7
branch:
locks: strict
root: 1.7
access list:
symbolic names:
keyword substitution: kv
total revisions: 7;    selected revisions: 7
description:
Code to demonstrate the sum of first n-natural numbers using Pthreads.
—————————-
revision 1.7    locked by: root;
date: 2014/01/25 05:49:00;  author: root;  state: Exp;  lines: +1 -0
The program is compiling successfully.
Logical error is fixed.
Issue:The threads are attempting to modify the shared resource i.e the global variable sum at the same time.
Bug is fixed by using sleep system call inside the main thread after the creation of thread.
The result is getting displayed correctly.
—————————-
revision 1.6
date: 2014/01/25 05:46:11;  author: root;  state: Exp;  lines: +4 -1
Definition of the function is given.
pthread_exit(NULL) is added inside the function body to terminate the thread.
Checking the result….
—————————-
revision 1.5
date: 2014/01/25 05:43:27;  author: root;  state: Exp;  lines: +5 -0
Prototype of the function is declared.
Defining the body of the calculate_sum() function……
—————————-
revision 1.4
date: 2014/01/25 05:41:08;  author: root;  state: Exp;  lines: +3 -0
Header file:pthread.h and stdlib.h is included to support inbuilt functions.
—————————-
revision 1.3
date: 2014/01/25 05:37:31;  author: root;  state: Exp;  lines: +21 -1
An array of pthread_t type is created that will store the thread-id’s.
Inside the loop,pthread_create() function is called that will create thread and prints an appropriate message.
As soon as the thread gets created it will start executing calculate_sum() function.
—————————-
revision 1.2
date: 2014/01/25 05:30:59;  author: root;  state: Exp;  lines: +7 -1
A global variable “sum” is declared that acts as a shared resourse and is accessible to the threads.
defining the body of the main thread.
—————————-
revision 1.1
date: 2014/01/25 05:29:53;  author: root;  state: Exp;
Initial revision
=============================================================================

Posted in Project 04: FTP based Client Server using Threads and Sockets | Leave a comment

Creating N-number of threads specified in the command line by the user and each of them will display a message and it’s thread-id

RCS file: N_threads.c,v
Working file: N_threads.c
head: 1.10
branch:
locks: strict
root: 1.10
access list:
symbolic names:
keyword substitution: kv
total revisions: 10;    selected revisions: 10
description:
Code that will create N number of threads specified in the command line,each of which prints
out a hello message and its own thread-id.
—————————-
revision 1.10    locked by: root;
date: 2014/01/23 13:39:32;  author: root;  state: Exp;  lines: +4 -2
Logical error fixed.
The program is creating N number of threads specified by the user.
After a thread is created it is displaying a message and it’s thread-id.
—————————-
revision 1.9
date: 2014/01/23 13:22:38;  author: root;  state: Exp;  lines: +1 -1
Bug fixed.
Issue:The program is not linked with the pthreads library.
—————————-
revision 1.8
date: 2014/01/23 13:06:52;  author: root;  state: Exp;  lines: +10 -3
Definition for the display function is added.
pthread_exit() and pthread_join() system calls are added in the program.
After comilation:Error is undefined reference to pthread.
—————————-
revision 1.7
date: 2014/01/22 23:00:58;  author: root;  state: Exp;  lines: +1 -1
Declaration error is fixed.
Issue:ret_val variable which will store the return value from pthread_create() is undeclared.
—————————-
revision 1.6
date: 2014/01/22 22:59:38;  author: root;  state: Exp;  lines: +1 -0
Prototype for the display_message() is added in the code.
—————————-
revision 1.5
date: 2014/01/22 22:56:15;  author: root;  state: Exp;  lines: +1 -0
Header file:<pthread.h> is included to support pthread functions and data structures.
—————————-
revision 1.4
date: 2014/01/22 22:54:14;  author: root;  state: Exp;  lines: +15 -2
The N number of threads will get created by using the for loop in the main thread.
pthread_create() system call is used to create a thread.
—————————-
revision 1.3
date: 2014/01/22 22:40:39;  author: root;  state: Exp;  lines: +4 -1
The number of threads that will be given as an input by the user is converted from string to int
using sscanf() successfully.
—————————-
revision 1.2
date: 2014/01/22 22:15:13;  author: root;  state: Exp;  lines: +2 -2
Two arguments are passed to main().The first is the number of arguments supplied to the program
and second is an array of pointers to strings.
—————————-
revision 1.1
date: 2014/01/22 22:10:19;  author: root;  state: Exp;
Initial revision
=============================================================================

Posted in Project 04: FTP based Client Server using Threads and Sockets | Leave a comment

Code to demonstrate how to pass string to a thread

RCS file: passing_string.c,v
Working file: passing_string.c
head: 1.4
branch:
locks: strict
root: 1.4
access list:
symbolic names:
keyword substitution: kv
total revisions: 4;    selected revisions: 4
description:
Code to pass string to a thread.
—————————-
revision 1.4    locked by: root;
date: 2014/01/23 04:10:07;  author: root;  state: Exp;  lines: +8 -1
pthread_exit() is used to kill the thread.
pthread_join() is used to make the main thread to wait untill the child thread finishes.
Type casting is done correctly.
Message is passed successfully to the thread.
—————————-
revision 1.3
date: 2014/01/23 04:04:15;  author: root;  state: Exp;  lines: +1 -0
Header file:<pthread.h> header file is included.
Still error is coming,probably prototype and definition of the function is not included.
—————————-
revision 1.2
date: 2014/01/23 04:02:31;  author: root;  state: Exp;  lines: +12 -0
Declaration errors.
Checking:probably pthread.h header file is not added.
—————————-
revision 1.1
date: 2014/01/23 03:53:43;  author: root;  state: Exp;
Initial revision
=============================================================================

Posted in Project 04: FTP based Client Server using Threads and Sockets | Leave a comment

Code to demonstrate how to pass integer data to a thread.

RCS file: passing_data_to_threads.c,v
Working file: passing_data_to_threads.c
head: 1.9
branch:
locks: strict
root: 1.9
access list:
symbolic names:
keyword substitution: kv
total revisions: 9;    selected revisions: 9
description:
Code to demonstrate how to pass data to threads.
—————————-
revision 1.9    locked by: root;
date: 2014/01/23 00:42:31;  author: root;  state: Exp;  lines: +2 -4
Logical bug fixed.
Issue:Type casting is done incorrectly.
The data is passed to a thread and is getting displayed by the thread successfully.
—————————-
revision 1.8
date: 2014/01/23 00:31:32;  author: root;  state: Exp;  lines: +3 -1
A warning is coming:assignment makes integer from pointer without a cast.
Inside display_data() garbage is getting displayed.
Logical error checking…..
—————————-
revision 1.7
date: 2014/01/23 00:22:25;  author: root;  state: Exp;  lines: +1 -0
pthread_join() system call is added to make the main thread to wait for
the other threads to terminate.
—————————-
revision 1.6
date: 2014/01/23 00:19:06;  author: root;  state: Exp;  lines: +1 -1
Logical error fixed.
Issue:Type casting is not done inside the display_data() function.
Program still not displaying the data passed to thread in the output.
Possible reasons:Main thread is terminating first.
—————————-
revision 1.5
date: 2014/01/23 00:17:09;  author: root;  state: Exp;  lines: +6 -2
Definition of the display_data function is added.
Checking….
—————————-
revision 1.4
date: 2014/01/23 00:13:10;  author: root;  state: Exp;  lines: +4 -1
Prototype of the display_data() function and header file:<pthread.h> is included.
—————————-
revision 1.3
date: 2014/01/23 00:06:52;  author: root;  state: Exp;  lines: +11 -1
pthread_create() system call is used to create a thread.
As soon as the thread gets created it will start executing display() function.
—————————-
revision 1.2
date: 2014/01/23 00:01:42;  author: root;  state: Exp;  lines: +3 -0
Taking a number from the user to pass to the thread.
—————————-
revision 1.1
date: 2014/01/22 23:59:59;  author: root;  state: Exp;
Initial revision
=============================================================================

Posted in Project 04: FTP based Client Server using Threads and Sockets | Leave a comment

Creating two threads which then display two different messages untill a condition is satisfied and making the main thread to wait for them to finish.

RCS file: simple_thread.c,v
Working file: simple_thread.c
head: 1.14
branch:
locks: strict
root: 1.14
access list:
symbolic names:
keyword substitution: kv
total revisions: 14;    selected revisions: 14
description:
A simple thread program in which 2 threads are created and 2 separate
messages are displayed by them.
—————————-
revision 1.14    locked by: root;
date: 2014/01/22 03:00:52;  author: root;  state: Exp;  lines: +1 -0
pthread_join() system call is added in the main thread to wait for the second thread to finish.
—————————-
revision 1.13
date: 2014/01/22 02:55:41;  author: root;  state: Exp;  lines: +2 -2
Errors like missing semicolons and variable undeclared fixed.
Checking…the functionality.
—————————-
revision 1.12
date: 2014/01/22 02:53:36;  author: root;  state: Exp;  lines: +23 -3
A second thread is created in the same program.
A different function is prepared with a different message.
pthread_join() is not added in the main thread for the second thread.
—————————-
revision 1.11
date: 2014/01/22 02:44:46;  author: root;  state: Exp;  lines: +2 -1
pthread_join() system call is added to inform the main thread to wait for the thread
with thread-id to finish.If this is not done the main thread does its work and terminates,
without checking any other thread is working or not.
—————————-
revision 1.10
date: 2014/01/22 02:35:06;  author: root;  state: Exp;  lines: +2 -1
pthread_self() system call is added to obtain the thread’s ID.
—————————-
revision 1.9
date: 2014/01/22 02:03:40;  author: root;  state: Exp;  lines: +2 -1
Terminating the main thread using pthread_exit() system call.
—————————-
revision 1.8
date: 2014/01/22 02:00:33;  author: root;  state: Exp;  lines: +5 -0
pthread_exit() system call is added in the program to terminate the
thread after 8 seconds.
—————————-
revision 1.7
date: 2014/01/22 01:51:28;  author: root;  state: Exp;  lines: +6 -4
sleep() system call is added in the thread’s display_func1().
The thread is getting terminated due to the main thread performing a return.
—————————-
revision 1.6
date: 2014/01/22 01:44:42;  author: root;  state: Exp;  lines: +16 -2
A check is added to see if the thread is created successfully.
Adding sleep() system call to analyse the output.
—————————-
revision 1.5
date: 2014/01/22 01:35:38;  author: root;  state: Exp;  lines: +4 -0
Definition for the display_func1() function is included.
—————————-
revision 1.4
date: 2014/01/22 01:31:09;  author: root;  state: Exp;  lines: +1 -0
Prototype for the display_func1() is added.
This function will display the message for thread1.
It will also display the thread_id.
—————————-
revision 1.3
date: 2014/01/22 01:29:21;  author: root;  state: Exp;  lines: +2 -0
header file:<pthread.h> is included to support pthread_create() system call.
—————————-
revision 1.2
date: 2014/01/22 01:25:54;  author: root;  state: Exp;  lines: +1 -0
Two variables of pthread_t type are declared that will store the thread_ids.
—————————-
revision 1.1
date: 2014/01/22 01:23:36;  author: root;  state: Exp;
Initial revision
=============================================================================

Posted in Project 04: FTP based Client Server using Threads and Sockets | Leave a comment

Implementation of Client/Server application to compute SUM using IPC mechanism shared memory.

RCS file: client.c,v
Working file: client.c
head: 1.4
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 4;    selected revisions: 4
description:
Client/Server program where client provides input to server via shared memory and
server provides the result to client.
Shared memory segment is created successfully.
Shared memory segment is attached to this program address space.
—————————-
revision 1.4
date: 2014/01/20 15:33:40;  author: root;  state: Exp;  lines: +6 -3
Logical error fixed.
Issue:pointer is not incremented to point to the next address.
The client program is able to retrieve the value of sum successfully.
—————————-
revision 1.3
date: 2014/01/20 00:58:04;  author: root;  state: Exp;  lines: +11 -1
The shared memory segment is detached successfully.
After detaching,remove the shared memory segment.
—————————-
revision 1.2
date: 2014/01/20 00:50:07;  author: root;  state: Exp;  lines: +14 -2
shmctl() system call is used to provide the size of the segment.
—————————-
revision 1.1
date: 2014/01/20 00:37:33;  author: root;  state: Exp;
Initial revision
=============================================================================
RCS file: server.c,v
Working file: server.c
head: 1.6
branch:
locks: strict
root: 1.6
access list:
symbolic names:
keyword substitution: kv
total revisions: 6;    selected revisions: 6
description:
Header file:header.h that includes all the necessary header files.
This is the code for the server process.
—————————-
revision 1.6    locked by: root;
date: 2014/01/20 15:28:43;  author: root;  state: Exp;  lines: +1 -0
Value of sum in the variable is computed successfully.
—————————-
revision 1.5
date: 2014/01/20 15:14:00;  author: root;  state: Exp;  lines: +6 -5
Logical error fixed.
Issue:Assignment operation.
—————————-
revision 1.4
date: 2014/01/20 15:01:08;  author: root;  state: Exp;  lines: +12 -1
A check is added in the program to check if the shared memory identifier is obtained successfully
or not.Server not reading the client values.
Checking……..
—————————-
revision 1.3
date: 2014/01/20 01:37:10;  author: root;  state: Exp;  lines: +1 -1
Declaration error fixed.
Error:The variable “sum” undeclared.
—————————-
revision 1.2
date: 2014/01/20 01:35:27;  author: root;  state: Exp;  lines: +12 -1
The shared memory segment is attached to this program’s address space.
The value of 2 numbers are read in the server process.
Sum is calculated.
—————————-
revision 1.1
date: 2014/01/20 01:24:49;  author: root;  state: Exp;
Initial revision
=============================================================================

Posted in Project 03: Client Server Communication using Linux and IPC | Leave a comment

AVR-USB-LINUX

Posted in Uncategorized | Leave a comment

Program to show how parent and child processes communicate via a shared memory IPC mechanism

RCS file: simple_shared.c,v
Working file: simple_shared.c
head: 1.11
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 11;    selected revisions: 11
description:
Implementation of IPC mechanism:Shared memory.
Child process is created using fork().
Shared memory segment is created using shmget().
—————————-
revision 1.11
date: 2014/01/19 20:39:18;  author: root;  state: Exp;  lines: +1 -0
After detaching the shared memory segment,deallocate the shared memory segment using shmctl()
system call.
—————————-
revision 1.10
date: 2014/01/19 20:35:05;  author: root;  state: Exp;  lines: +28 -8
Code is working absolutely fine.
After performing the desired operation,Shared memory segment is detached using shmdt().
—————————-
revision 1.9
date: 2014/01/19 14:45:21;  author: root;  state: Exp;  lines: +1 -1
Segmentation fault occurred in the program.
—————————-
revision 1.8
date: 2014/01/19 14:42:02;  author: root;  state: Exp;  lines: +10 -1
A value is stored in the shared memory segment.
The same variable is assigned different values in the parent and child process.
Checking….
—————————-
revision 1.7
date: 2014/01/19 14:32:25;  author: root;  state: Exp;  lines: +5 -1
A check is added to display an error if the call to shmctl is failed.
—————————-
revision 1.6
date: 2014/01/19 14:29:33;  author: root;  state: Exp;  lines: +1 -1
Declaration error fixed.
Issue:spelling mistake of the variable segment_size.
—————————-
revision 1.5
date: 2014/01/19 14:27:37;  author: root;  state: Exp;  lines: +5 -1
shmctl() system call is used to know the size of the created segment.
—————————-
revision 1.4
date: 2014/01/19 13:47:24;  author: root;  state: Exp;  lines: +4 -4
New line character is added to display the messages in an
appropriate way.
—————————-
revision 1.3
date: 2014/01/19 13:40:49;  author: root;  state: Exp;  lines: +2 -1
Warning fixed.
Issue:Comparison between pointer and integer.
Another issue:Misplaced braces.
—————————-
revision 1.2
date: 2014/01/19 13:32:33;  author: root;  state: Exp;  lines: +25 -14
Shared memory segment is attached successfully.
Using the shmat() system call.
—————————-
revision 1.1
date: 2014/01/19 12:59:42;  author: root;  state: Exp;
Initial revision
=============================================================================

Posted in Project 03: Client Server Communication using Linux and IPC | Leave a comment

Implementation of signal and wait operation on a semaphore

RCS file: signalandwait.c,v
Working file: signalandwait.c
head: 1.6
branch:
locks: strict
root: 1.6
access list:
symbolic names:
keyword substitution: kv
total revisions: 6;    selected revisions: 6
description:
Implementing wait and signal operation in a program.
—————————-
revision 1.6    locked by: root;
date: 2014/01/17 15:36:28;  author: root;  state: Exp;  lines: +4 -1
Signal and wait operations on a semaphore are tested successfully.
—————————-
revision 1.5
date: 2014/01/16 16:12:22;  author: root;  state: Exp;  lines: +3 -3
Next line character is added to enhance the readability of code.
—————————-
revision 1.4
date: 2014/01/16 16:10:44;  author: root;  state: Exp;  lines: +20 -5
Logical and declaration errors are present in the program.
Checking the errors
—————————-
revision 1.3
date: 2014/01/16 16:01:04;  author: root;  state: Exp;  lines: +29 -3
acquire_semaphore() and release_semaphore() function are called.
A critical region is created to test these functions.
—————————-
revision 1.2
date: 2014/01/16 15:46:51;  author: root;  state: Exp;  lines: +1 -1
Bug fixed.Issue:SET_VAL is given instead of SETVAL.
—————————-
revision 1.1
date: 2014/01/16 15:46:15;  author: root;  state: Exp;
Initial revision
=============================================================================

Posted in Project 03: Client Server Communication using Linux and IPC, Uncategorized | Leave a comment