Linked by Thom Holwerda on Fri 2nd Sep 2005 09:44 UTC
Talk, Rumors, X Versus Y "We will shed more light on the whole Apple versus x86 PC, IBM G5 versus Intel CPU discussion by showing you what the G5 is capable of when running Linux. This gives us insight on the strength and weakness of Mac OS X, as we compare Linux and Mac OS X on the same machine."
Thread beginning with comment 26793
To read all comments associated with this story, please click here.
by bryanv on Fri 2nd Sep 2005 18:16 UTC
Member since:

Alright. Let me pick this apart.

First of, OS X is a Mach kernel, not a BSD kernel.

The BSD subsystem runs as a service (process, thread) ON TOP of the Mach kernel.

pthreads is a common (often lowest common denominator) threading library. There are pthreads implementations for BSD, Linux, etc.

It's reasonable to assume that the pthreads implementation that MySQL is running upon is running on the BSD subsystem in OS X, which is most likely (from what I understand) running as a single process on the Mach kernel. See how this is going?

|-> Mach Thread (BSD subsystem)
| |-> Pthread
| |-> Pthread
| |-> Pthread
|-> Other Mach thread (Native OS X application)
|-> Other Mach thread
|-> Other Mach thread

Now let's say that Mach only knows about the mach threads (totally reasonable to assume) it's going to schedule the BSD subsystem as a single process (which it is). This means anything running the BSD subsystem is going to be splitting up the time used by a SINGLE Mach thread. Performance hit? Uh. YEAH.

I'm completely unsure of the state of the OS X BSD subsystem in relation to the BGL from FreeBSD, which may further complicate I/O functions in regards to everything getting scheduled as a single process in the Mach kernel.

Linux, on the other hand has a native pthreads wrapper that maps pthreads 1 to 1 with linux threads.

Compare a compile of MySQL on OS X that uses a pthreads -> Mach thread wrapper, and uses native OS X / Mach (not BSD subsystem) API's to MySQL on Linux and _then_ I'll consider this a valid comparison.

Untill then, you're bitching that a platform emulation layer isn't working as fast as the real platforms do.

Reply Score: 2

RE: Deceiving.
by japail on Fri 2nd Sep 2005 18:41 in reply to "Deceiving."
japail Member since:

No, your understanding of the BSD subsystem in XNU is completely wrong. The BSD subsystem is responsible for managing processes, users, networking, the VFS, and numerous other things. This is largely why OS X has such coarse locking, despite using Mach 3.0 as the base. Much of the actual user-level operating system is provided by the BSD subsystem in terms of Mach primitives, and when XNU moved from FreeBSD/NetBSD/NeXT code it used they were all lacking fine-grained multithreading and Apple has had to gradually improve this. POSIX threads in XNU are implemented in terms of Mach threads (they're not green threads, which would probably improve their performance characteristics in certain ways and remove the seen scaling performance improvement at 2 cuncurrent connections among decreases elsewhere).

Reply Parent Score: 2

RE[2]: Deceiving.
by bryanv on Fri 2nd Sep 2005 18:51 in reply to "RE: Deceiving."
bryanv Member since:

Thank God. I was hoping I was wrong. :-)

So what we're seeing is terrible thread creation times, scheduling problems, and perhaps even leftovers of the BGL?

Reply Parent Score: 1