1753792 Members
7067 Online
108799 Solutions
New Discussion юеВ

Re: shared memory

 
Waugh
Frequent Advisor

shared memory

Hi,

1) what is shared memory segment and semaphores.what is the impact of SHMMAX on application.

2)what is the imprtance of semaphores for Database

Regards
Rkumar
2 REPLIES 2
Dennis Handly
Acclaimed Contributor

Re: shared memory

Shared memory is how you can have multiple process communicate. Or keep data in memory a in Oracle's SGA. It stays after all of the processes finish.

You can use semaphores to synchronize access to shared resources.

SHMMAX is the maximum size of any shared memory segment. In 32 bit, the number is much smaller due to the fact that there is one global address space that is normally two 1 Gb quadrants.

To see your segments or semaphores:
ipcs -ma
ipcs -sa
Srimalik
Valued Contributor

Re: shared memory

>what is shared memory segment and semaphores.what is the impact of SHMMAX on application.

dedicated memory:
When you call a malloc you can memory which can be used by only the program which calls malloc, the memory manager makes sure that the data stored in this memory is not accessible to other programs running on the system.

Shared memory:
There may be cases where you want to share data kept in memory between two different programs, In such cases you ask the OS for shared memory segments(call shmget), these segments are such that every program can see this memory and read/write data to it.

Now we know that shared memory is visible to many different programs which may want to read/write the data stored in shared memory.
a program may sometime want exclusive access to the shared memory segment at a times so what all programs do(they are coded like that) is create a semaphore and fix a protocol as:

before doing operations on shared memory which required exclusive access you need to take the semaphore so that everybody else knows that smbdy is using it and do not use the memory in exclusive mode.

Its like trial rooms in clothing stores:

The trials rooms are shared memory and a ring outside the room is the semaphore.
Before entering the room you chk for the ring if its there you take the ring and enter if its not it means that sombdy is using the room and you have to wait.

Maybe a bad example but that is what it is.

SHMMAX is already explain by D.

-Sri

abandon all hope, ye who enter here..