Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: question about internals of oracle on linux

Re: question about internals of oracle on linux

From: Tim X <timx_at_spamto.devnul.com>
Date: 10 Feb 2003 19:55:57 +1100
Message-ID: <87bs1ka50i.fsf@tiger.rapttech.com.au>


>>>>> "DA" == DA Morgan <damorgan_at_exesolutions.com> writes:

 DA> "Howard J. Rogers" wrote:
>> On Sun, 09 Feb 2003 06:45:13 +0000, MAASK Group wrote:
>>
>> > rnel. I presume that an oracle server spawns a new thread for
>> > serving each query. Which threads does it use? As in POSIX
>> > threads ( created by pthread_create() ) or linux threads (
>> > created by clone() ) ?? Also for protecting any shared (global)
>> > data among multiple threads or processes, does oracle use the
>> > linux semaphores (using semget(), semop() syste
>>
>> I could have sworn that only Oracle on Windows uses a true
>> multi-threaded architecture. That Oracle on Unix and Linux uses a
>> multi-process architecture. And that if you ps -ef | grep
>> <ORACLE_SID here>, you will see each of the processes listed.
>>
>> But you might be talking about something else entirely, I guess.
>>
>> Regards HJR

 DA> My recollection is the same as yours. Threads on Windows,  DA> Processes on UNIX.

 DA> Daniel Morgan

I'm not sure about that. Up until a few years ago, it would certainly have been multiple processes because Linux didn't support native threads. However, it does now and many programs (Like the JDK and I think JRE use threads). I think the IBM 1.1.8 JDK was the first one to use native linux threads.

the manual on my system says the threads are POSIX compliant threads and the library implements POSIX 1003.1b semaphores.

Doing an ldd on some of the shared libraries in my Oracle installation shows they are linked with libpthread (POSIX threads). Doing a "strings" on some of those shared libraries shows calls to pthread_create etc, so it looks like Oracle is using POSIX threads. However, I know the Oracle I am using (8.1.7) is linked with an older glibc library and something in the back of my mind says that early versions of libpthreads just used POSIX compliant wrappers around calls to clone() etc. I would suspect Oracle 9i is linked with a later libpthreads librarys and is therefore true POSIX threads - 8.1.7 is uncertain.

I'm pretty sure Oracle is using semaphores for shared memory management as part of the instll instructions for Linux includes a section where you have to increase the maximum number of semaphores the Kernel can create and re-compile the kernel.

Finally, I don't think you can tell if a process is a full process or a thread with ps as they both show up in the output from ps. This makes sense as threads are just light weight processes anyway - possibly if you use the f (forest) switch or some other ps switch, you may be able to more accurately determine what are threads and what are processes.

From what I can tell, Oracle runs multiple processes for some of its processing (like the standard background processes) which are always there and threads to handle things like client connections etc. Intuitevely, you would expect something like this as threads are just light-weight processes and take less resources to start/clean-up, but processes are a little more robust - so it would make sense to use threads for things like client connections which often may only be short-lived and where there might be lots of them and processes for things like the background processes which last the whole time the database is up and are static in number (in that you don't have lots of processes being forked and then exiting etc).

Of course, I have to put a disclaimer here - I haven't done any multi-process programming since my student days spending late nights trying to solve the dining philosophers problem and detecting deadlocks - back then, threads were only being vaguely thought about.

I'm also not really clear about windows and wether threads means the same thing on that platform as on a unix platform. Is windows a true multi-processing OS these days or is it still more a time-sliced type of architecture? (Can you believe how out of touch I am with windows - isn't it wonderful!) - can you fork a true process under NT/2k? I guess it must be able to by now!

Tim

-- 
Tim Cross
The e-mail address on this message is FALSE (obviously!). My real e-mail is
to a company in Australia called rapttech and my login is tcross - if you 
really need to send mail, you should be able to work it out!
Received on Mon Feb 10 2003 - 02:55:57 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US