PROGRAMMING: Sharing a Locked Memory

PROGRAMMING: Sharing a Locked Memory

Post by John Petriti » Tue, 22 Jul 1997 04:00:00



Problem:

I would like to lock down memory (mlock) and then allow 2 processes
to write to it.

-------

Situation:

I have a program that locks down 64Meg (in sevral pieces).
I cannot make it multithreaded due to a thread UNSAFE third party
component.
I need to break it up into 2 processes.

-------

Thanks

John B. Petritis


p.s. Please send a copy of your reply directly to me at my email addr.

 
 
 

PROGRAMMING: Sharing a Locked Memory

Post by Boris Goldber » Wed, 23 Jul 1997 04:00:00



> Problem:

> I would like to lock down memory (mlock) and then allow 2 processes
> to write to it.

> -------

> Situation:

> I have a program that locks down 64Meg (in sevral pieces).
> I cannot make it multithreaded due to a thread UNSAFE third party
> component.
> I need to break it up into 2 processes.

> -------

> Thanks

> John B. Petritis


> p.s. Please send a copy of your reply directly to me at my email addr.

Create a shared memory segment and mlock() it.

 
 
 

PROGRAMMING: Sharing a Locked Memory

Post by Bryan Altha » Wed, 23 Jul 1997 04:00:00


: Problem:
:
: I would like to lock down memory (mlock) and then allow 2 processes
: to write to it.
:
: -------
:
: Situation:
:
: I have a program that locks down 64Meg (in sevral pieces).
: I cannot make it multithreaded due to a thread UNSAFE third party
: component.
: I need to break it up into 2 processes.
:
[emailed author also]

You really haven't asked a question as I see no '?', so are you asking
for a way to get around having to fork 2 processes and instead use
threads?  Are you asking how to keep the 2 processes out of each others
way?  It's not clear why you lock down several pieces instead of all at once.

As for the 2 process r/w problem, the obvious solution is to use a semaphore(s).
As for shared memory, I find mmap(2)'d files more useful and let the OS
decided what memory is being accessed and should stay in memory and avoid
the mlock problems all together.  

Hope this helps.

-bryan

 
 
 

1. How do I start for UNIX process,shared memory,rpc programming?

Hi all:
  I've bought the book Unix network programming II and try the examples
on the Ultra 5,SunOs 5.7 but it doesn't work and it seems that it dosen't
support Posix IPC, a *working* pthreads library, Posix realtime signals,
...etc.
  Is there any simple examples for fork, and parent, child process
communication and semephores.

Thanks,
Regards,
Peter

2. threads

3. More about shared memory programming

4. When will be the birthday of the xfree3.4 ?

5. shared memory programming issue

6. Test Please ignore

7. Programming with shared memory?

8. Virtual (Multiple ) Ipaddresses using RH 6.1

9. about share memory programming

10. Crash Course in Programming w/ Shared Memory

11. Shared memory programming examples and docs needed

12. shared memory programming

13. Crash Course in Programming w/ Shared Memory