Urgetn plzzzzzz help

Hey guys!!!
CAn anyone tell me what actually is a shared memory.Is it part of the RAM or wht?I want the defenition…plz help
:cry: Meghs

It is a way of accessing normal RAM, but it can be accessed by more than one application at a time. i.e. if you do a normal malloc() the memory which is allocated can only be accessed by the application that allocated it, if another application were to try to access, it would error and probably crash. Shared memory allows many applications to access the same memory and it is a good way to pass data between different applications. It’s a software thing, not a hardware thing, you don’t need special DIMMs or anything like that.



In a system with virtual memory manangement (QNX for example), physical memory is mapped into virtual memory by the operating system. This memory is mapped in PAGE sized chunks (normally 4k). So when an application is created, the OS maps memory for the code and data out of the pool of physical memory.

When you want to share memory between two or more processes, you can ask the OS to share the memory - this tells the OS to map the same physical memory into the virtual memory of two of more processes. There is no promise that the virtual address in each process with be the same.

IE. Physical address 0x400000 may map as 0x1b00000 in process 1 and 0x8f00000 in process two.

In other words, you still can’t share pointers.

You can however tell the OS to map a particular physical address for you. This gives you the ability to access memory mapped hardware, or data (screen memory for example).

On a slightly related note, having virtual memory does not necessarily imply you have swap. On other unixes and windows, their virtual memory system also maps disk space as pages, so that you can appear to have more memory than you physically have. QNX chose to not to do this for reasons of real time performance (yes, I know there is a hack to some of the tool chain).

BTW, I can’t see how a request for a definition (which I am sure is available on the net through some other resource) can possibly be defined as requring urgent help.