shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Quote:
Originally Posted by imrantechi
i have gone through the link and found that the program is your 's
i regret for the issue
Even I did the same and so we would like to make sure we conclude that its an original contribution.
bashamsc's Avatar, Join Date: May 2007
Go4Expert Member
Quote:
Originally Posted by imrantechi
i m not so well versed with linux, so can you provide a little more explanation ,

so that even people like us also can understand.
See to understand the program first u need to have an idea of shared memory.

Shared memory comes under Inter-Process Communication.

Shared memory is the fastest of all IPC.

Shared memory comes under System V IPC.

SHARED MEMORY:

Shared memory is one of the three System V IPC.

It allows two unrelated processes to access the same logical memory.

Shared memory is a very efficient way of transferring data between two running processes.


In the program i have used these functions.

shmget and shmat for shared memory.

shmget is used to create shared memory.

shmat is used to attach the shared memory to the address space of the process.

When we come to the program,i have created two process i.e process-1 and process-2.

process-1 and process-2 uses same memory i.e shared memory.

I have created a single bit shared memory to control the two process not to access the shared memory at a time.

When process-1 uses the shared memory then process-2 waits until process-1 completes its work and wise versa .

Run the two process at a time (i.e in two terminals ) and u will observe that When process-1 uses the shared memory then process-2 waits until process-1 completes its work and wise versa .

Last edited by bashamsc; 26Feb2008 at 08:34..
imrantechi's Avatar, Join Date: Feb 2008
Ambitious contributor
Okay!!! Thanks man...
debleena_doll2002's Avatar
Ambitious contributor
Leave it bashamsc !!! your effort is really apprecited. Now please dont make issue more. That article should be nominated!!! Finallllll
lead.smart34's Avatar, Join Date: Feb 2008
Contributor
its complex
crazytolearn57's Avatar, Join Date: Feb 2008
Go4Expert Member
what is this problem of copy
rlearntowin1's Avatar, Join Date: Feb 2008
Go4Expert Member
good one
bashamsc's Avatar, Join Date: May 2007
Go4Expert Member
see this blog www.sharedmemoryprogram.blogspot.com
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Winner of the month for January 2008