Memory access

Memory access

Post by Pedro Nunes da Cost » Fri, 01 Mar 2002 03:32:38



Hi,

I have Red Hat 7.2 installed.

I'm trying to develop a program to access a memory area used by other
running process.

I would apreciate some guidelines or book references.

Best regards,

Pedro

 
 
 

Memory access

Post by Norm Dresne » Fri, 01 Mar 2002 05:32:53


AFAIK, you can access "all" of physical memory using the /dev/mem device.
I believe any user can get read privileges but I doubt write unless you're
running as root.  But this is physical memory, not logical memory.  You'd
still have to find some way to map physical addresses back into a user's
virtual address space.

No, it's not easy.  That's intentional.

    Norm



Quote:> Hi,

> I have Red Hat 7.2 installed.

> I'm trying to develop a program to access a memory area used by other
> running process.

> I would apreciate some guidelines or book references.

> Best regards,

> Pedro


 
 
 

Memory access

Post by Mark Robso » Fri, 01 Mar 2002 05:39:39



Quote:> Hi,

> I have Red Hat 7.2 installed.

> I'm trying to develop a program to access a memory area used by other
> running process.

Are you trying to develop a de*, or just use shared memory?

If two processes are cooperating to share memory, one easy way is to mmap
a shared file (man mmap). They can both map it and it will be shared. You
can also use anonymous shared memory with system V shared memory - I'm
not sure how you do that.

If the other process is not "cooperating", for instance if you want to
hook into it or debug it, and see what's going on, you will need to do
some very system specific stuff.

I believe you should be able to read other processes' memory by reading
/proc/pid/maps and then mmaping bits of /proc/pid/mem into your own
memory space, which will give you read/write access to it. I think this
is how de*s do it.

Cheers
        Mark

 
 
 

Memory access

Post by Josef M?ller » Fri, 01 Mar 2002 16:51:03



Quote:

> Hi,

> I have Red Hat 7.2 installed.

> I'm trying to develop a program to access a memory area used by other
> running process.

> I would apreciate some guidelines or book references.

Have you looked at /proc/*/mem?

Josef
--
Josef M?llers (Pinguinpfleger bei FSC)
        If failure had no penalty success would not be a prize
                                                -- T.  Pratchett

 
 
 

Memory access

Post by Josh Jone » Sat, 02 Mar 2002 01:16:27



Quote:

> I'm trying to develop a program to access a memory area used by other
> running process.

man shmget

--
 J o s h u a   J o n e s  /  www.intmain.net  /  jajones(at)cc.gatech.edu
                                     __                             .~.
 College of Computing at the    |   / /     _  _  _  _  _ __  __    /V\
 Georgia Institue of Technology |  / /__  / / / \// //_// \ \/ /   // \\
 Atlanta, Georgia, U.S.         | /____/ /_/ /_/\/ /___/  /_/\_\  /(   )\
                                         *Debian GNU/Linux*        ^^-^^

 
 
 

1. Speeding up memory access in C

    Jorge> I've got memory region that I constantly need to access to,
    Jorge> so I would like it to be in cache. How can I do that.

You have no direct control over the hardware cache, if that's what you
mean.

    Jorge> I know that I can use 'register' in variable declarations,
    Jorge> to speed up it's acces.  

Yes, but keep in mind this is just a hint to the compiler.  It doesn't
have to put that variable in a register if it thinks it can do better.

    Jorge> Anyway if I have a pointer to that mem. region and I
    Jorge> declarated as 'register' I will get faster access to the
    Jorge> pointer, not to the mem.  region it points to, am I right?

Right.

    Jorge> If I declare a constant pointer (an array) p as a register,
    Jorge> since the allocated memory will remain the same, will the
    Jorge> declaration of p as 'register' speed up the acces to the
    Jorge> array elements?

No.

    Jorge> Thanks in advance.  J.A.  P.S: When compiling a c program
    Jorge> is there anyway I can make sure that it will use boolean
    Jorge> lazy evaluation?

That's part of the C language specification.

--

http://web.verbum.org/levanti
(1024D/C207843A) A580 5AA1 0887 2032 7EFB  19F4 9776 6282 C207 843A

2. Dialin + Dialout

3. [2.5.63] Kerneldoc for user space memory access

4. udp recvfrom() ECONNREFUSED question..

5. Need help!!! direct memory access

6. Mbox files being owned by root...

7. Dual Port Memory Access Problem

8. Help needed to setup ypserv

9. BIGMEM 64GB memory access

10. control of processs and memory access

11. IPC shared memory access and privileges..

12. URGENT" MEmory access in driver.

13. URGENT: memory access in Driver