Re: Does Oracle PGA take out memory out of SGA?

From: Mladen Gogala <gogala.mladen_at_gmail.com>
Date: Thu, 1 Apr 2021 16:09:41 -0400
Message-ID: <475c137a-dab8-41d8-8f51-e77255aa8d86_at_gmail.com>



Hi Paul,

Long time no see. Are you still in NYC? I moved across the Hudson to the Garden State. Lots of Steelers fans around here. Semaphore requirements are 1 per process + 5 for the system. There are no requirements or recommendations for the semaphore set size. I usually prefer smaller set size, like 64 semaphores per set, for better granularity. Usually, I configure 1024 semaphore sets, 64 semaphores each. That brings the total to 65536  semaphores on the system. Semaphore operations per set is normally the same as the set size: you want to allow 1 operation per each semaphore in the set. I haven't done any measurements, those values are based on my personal understanding of how Oracle operates. I've also had no problems with those settings. Maybe Tanel or Kevin Closson have something to add.

Regards

On 4/1/21 1:17 PM, Paul Drake wrote:
> Mladen,
>
> Do you have a recommendation regarding the use of semaphores?
>
> I've read about the position of RH (RedHat) and LH (Left Hand storage)
> for mapping out the semaphore alphabet. Flapping my arms about with
> red and yellow colored flags is having no effect and I feel like a
> real concurrency killer.
>
> I don't see how increasing the number of semaphores is going to help
> but as the flags wear the number of threads on them is becoming larger.
>
> Happy 1 April.
>
> Paul
>
>
>
> On Thu, Apr 1, 2021, 00:10 Mladen Gogala <gogala.mladen_at_gmail.com
> <mailto:gogala.mladen_at_gmail.com>> wrote:
>
> ORA-7445 is an Oracle bug, by definition. You should open a
> service request with Oracle Support. Other than that, shared
> memory is an operating system trick. Virtual memory is based on
> page tables. There is a table somewhere in the OS which contains
> virtual addresses and their translations. Translation can be an
> address of a physical page in RAM or can be a page in a page file.
> If two processes map the same  page table into their address
> space, we talk of shared memory. Yes, there are some details about
> that, such mapping is performed by shmat system call and not by
> sbrk, malloc or calloc. Shared memory is used for SGA. You can see
> the shared memory on your system by using ipcs -m.
>
> PGA, on the other hand, is allocated from the process private
> memory. That means that PGA consists of segments which are only
> mapped to a single process. PGA is allocated using sbrk, malloc or
> calloc. If PGA is expanded beyond limits, it will eventually hit
> another segment or OS limit and produce SIGSEGV "segmentation
> violation" signal and produce ORA-04036. Note that ORA-4036 is NOT
> the same as ORA-7445. ORA-7445 is a bug which needs to be resolved
> by Oracle Support. If you want to learn the basics of the Linux
> operating system, I would recommend 2 books:
>
> 1. Understanding the Linux Kernel by Daniel Bovet
> 2. Modern Operating Systems by Andrew Tannenbaum
>
> Both books are available on Amazon. Of course, the unspoken
> prerequisite for both books is certain book by Kernighan & Ritchie
> which should be taught to K12 children (ANSI edition, of course).
> What you are asking is quite complex to explain. The usual answer
> is that PGA and SGA are "two different types of memory" but I
> don't find that answer satisfactory. In order to understand the
> memory handling on Linux, you would need to understand interrupts,
> paging, processes, page tables, address spaces and IPC
> (Inter-Process Communication). PGA is allocated from the process
> private address space, SGA is allocated from shared memory. Now
> what is private memory space, how does Linux manage it, what is a
> page fault and other questions are rather difficult to explain. Of
> course, you are the only person who can decide whether you need
> deep knowledge of the Linux or not.
>
> On 3/31/21 3:03 PM, Amit Saroha wrote:
>> Dear All,
>>
>> Please help me understanding PGA and SGA.
>>
>> I was under the impression that PGA and Memory and SGA Memory are
>> differently allocated. But, in a recent situation, we observed
>> *ORA-7445 [kghalf] *and my DBA is saying - out of a total of 256
>> GB system memory one session's PGA consumed everything and only 8
>> MB was left for other sessions. But, apart from one process, no
>> other processes were impacted so I have doubt that - Oracle
>> consumes SGA memory and Allocates it to PGA of a single process.
>>
>> Please help me understand.
>
> --
> Mladen Gogala
> Database Consultant
> Tel: (347) 321-1217
> https://dbwhisperer.wordpress.com <https://dbwhisperer.wordpress.com>
>
> -- http://www.freelists.org/webpage/oracle-l
> <http://www.freelists.org/webpage/oracle-l>
>

-- 
Mladen Gogala
Database Consultant
Tel: (347) 321-1217
https://dbwhisperer.wordpress.com


--
http://www.freelists.org/webpage/oracle-l
Received on Thu Apr 01 2021 - 22:09:41 CEST

Original text of this message