Database Reference
In-Depth Information
revision of a popular interview question about the Oracle architecture. Looking back the Oracle architecture has
always distinguished between the major process types:
The foreground process
The background process
Potential slave processes
The new threaded architecture allows the administrator to create most background processes as threads within
a process. User processes in the dedicated server model will also be created as threads. It should also be stated clearly
that the new threaded model is not an option for Oracle on the Windows platform since Oracle has always used that
threaded approach on this platform.
The Reason for Threads
Before explaining how the thread architecture is different from the process model it is important to review the actual
difference between the two approaches. As with almost anything in the Linux history there have been different
implementations for threads. Since kernel 2.6 (its release date now seems like an eternity ago) the native POSIX
thread library (NPTL) is the standard. You can see that it is referenced in the make.log file which lists all the output of
the linking phase. Search for -lpthread to see which binaries are linked against it. The main executable certainly links
against it:
[oracle@server1 ~]$ ldd $(which oracle) | grep thread
libpthread.so.0 => /lib64/libpthread.so.0 (0x000000314f600000)
This library is part of the standard C library on Linux and therefore is available by default. But why has Oracle
gone to the great length to implement the background processes using threads? First, a thread is an independent
execution unit within a process. In the most basic case there will be a one-to-one mapping between processes and
threads. Such an implementation however would not make much sense. Instead most models—including the one
described here—use multiple threads per process. Threads share the address space and are not as independent as
processes, but on the other hand allow for faster context switching. Using a threaded model of execution could help
with scalability as you can see later.
The Process Model
The default mode of operation in 12c on Unix is still the process model. The main background processes are listed
in the dynamic performance view v$bgprocess . Reviewing the process model allows me to remind you of the many
background processes that have been added with every release! On a typical system you will find the background
processes using the following query:
SQL> select name,description
2 from v$bgprocess
3 where paddr <> '00';
Each of the processes you will see when executing the query on your system corresponds to exactly one
process on the operating system. Oracle uses column SPID in view v$process to pair a process in the database to its
corresponding process on the operating system. To change from the process model to the threaded model you need to
change an initialization parameter:
SQL> alter system set threaded_execution=true scope=spfile;
System altered.
 
Search WWH ::




Custom Search