Unix Programming - djake@excite.it

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > October 2004 > djake@excite.it





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author djake@excite.it
djake@excite.it

2004-10-29, 5:51 pm

Do you know how to syncronize under unix two processes to access a
shared memory (read/write) in a non-blocking way. Therefore to have
error when the memory is already locked (and not timout).

Do you know how to do?
Steve Graegert

2004-10-29, 5:52 pm

djake@excite.it wrote:

> Do you know how to syncronize under unix two processes to access a
> shared memory (read/write) in a non-blocking way. Therefore to have
> error when the memory is already locked (and not timout).
>
> Do you know how to do?


The solution would be the use of the following set of functions: shmget,
shmctl, shmat and shmdt. This involves IPC and is suitable for use with
unrelated processes. To synchronize access to regions of shared memory
you may want to incorporate semaphores. If you are using an SVR4-based
system, /dev/zero may also help. I can't provide a working sample (no
UNIX machine at hand). For more information on shared memory via IPC
take a look at this one: http://www.cs.cf.ac.uk/Dave/C/node27.html.

\Steve
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com