Chapter 2. Waits

In an Oracle instance many processes (or threads of a single process) work together. To work together, they must communicate, and one of main ways that they communicate is via semaphores. A semaphore is a signal. It is somewhat like a railway signal that tells trains whether to stop and wait, and when to go. Oracle server processes often need to stop and wait:

  • Sometimes because a resource is not available

  • Sometimes because they have no work to do

  • Sometimes because they need to wait for another server process to perform a prerequisite task

Semaphores allow Oracle server processes to stop and wait, and then to be notified when they should resume processing.

Semaphores

There is a semaphore for every Oracle server process. Processes wait on their semaphore when they need to wait for a resource, or need work to do, or need work to be done. When the resource has been freed, or when there is work to do, or when the prerequisite work has been done, then their semaphore is posted as a signal to stop waiting.

For example, LGWR (the Log Writer process) may be waiting on its semaphore for work to do, while a user process may be copying redo information into the redo log buffer. When the user commits, LGWR must write the redo and commit marker to the log file while the user waits. To achieve this, the user process posts LGWR’s semaphore to signal that it can stop waiting for work to do, as some work is now available. The user process then waits on its own semaphore. When the log ...

Get Oracle Internals: An Introduction now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.