Jump to content

MAC OS X vs. Linux


ChesWiz
 Share

23 posts in this topic

Recommended Posts

Hello PPL

I'm quite new to the MAC OS-X86 scene, and I am rather enthusiastic, so please forgive me if this issue was raised before, and kindly refer me to the correct forum thread...

 

A little history:

As a very long time computer user (does the model ZX-81 rings a bell anyone?), I've been in this computer industry for quite a while.

I looked into the OS-X history and found that it is built upon Darwin OS, which is based on some form of BSD, that in turn is derived from AT&T Unix => which means that OS-X is basically Unix.

Nothing new so far!

 

I've noticed that there is severe lack of device drivers for the upcoming OSx86 (essentially 3D Acc, Audio, etc.).

I also know that there are many Linux/Unix dist. that have many of these drivers available, and, being based and distributed under GPL/BSD License, allow the re-use of such code. though I am not familiar with the lisence under which the OS-X is distributed, but as it seems, most users on this forums don't give a donkie's tail about licenses (neither do I).

Anyway, my point is, (and correct me if I'm wrong), that those open drivers from linux can be used in OS-X with some minor modifications and a re-compilation.

 

all is needed is the source code for those drivers.

 

now, here comes the tricky part, can these sources be obtained from the hardware mfg.?

I believe so, since it's the mfg. interest to sell those products to MAC machines. (charge absurd prices for a piece of hardware that would cost fifth as much for PC). As far as I know, these drivers are consisted of small Binaries that actually handles the Hardware, and some HAL function providers, that are open coded.

I think that taking the binaries and fitting the code to the system, the result can run on any OS, namely OS-X

 

This all sounds simple, but is it really so? can someone enlighten me ?

 

oh, and here's another teaser, and maybe the subject of a whole new thread:

I know there are some Linux/BSD distro. out there, with the MAC-Like window manager.

has anyone tried it, and what are the noticeable differences (advantages and disadvantages) between the OS-X and a MAC flavored Unix?

 

wow, that was a long one for a first post......

don't worry, I won't make it a habit ;-)

Please feel free to answer, flame, and otherwise reply to this post....

Link to comment
Share on other sites

From what I have read, Linux has defined one set of relationships between its kernel and drivers (extensions) and BSD uses a different structure. Darwin apparently has a third way of doing things that is different enough from BSD and from Linux to make porting either Linux or BSD source code for drivers/extensions over to Darwin a non-trivial thing. That is why, so far, you only see a few drivers/extensions beyond what is included already in OS X for x86. I am sure over time both vendors and hackers will increase the driver pool for Intel-based Macs.

Link to comment
Share on other sites

I understand that the difference is the Kernel system used:

OS-X is Darwin systems used Mach 3.0 derived Micro-Kernel Structure with BSD mods (XNU).

making it (technically speaking) a Monolithic Kernel once again.

 

not getting too technical, this does call for recompilation of the existing Linux drivers, using the libc of the OSX, and platform-dependant compiler directives, that Should result in a fully functional OS-X device driver.

 

has anyone tried it ?

please report results...

Link to comment
Share on other sites

I understand that the difference is the Kernel system used:

OS-X is Darwin systems used Mach 3.0 derived Micro-Kernel Structure with BSD mods (XNU).

making it (technically speaking) a Monolithic Kernel once again.

 

not getting too technical, this does call for recompilation of the existing Linux drivers, using the libc of the OSX, and platform-dependant compiler directives, that Should result in a fully functional OS-X device driver.

 

has anyone tried it ?

please report results...

 

As it is hybrid kernel (FreeBSD and Mach) I do know that some calls from freebsd are not supported but anyway, freebsd drivers are fair more comparable to those in osx as those in linux. I think that there is way to convert them from fbsd to osx but I'm afraid that I don't know how.

C programers please tell us if it is easily possible :(

Link to comment
Share on other sites

  • 1 month later...
...what are the noticeable differences (advantages and disadvantages) between the OS-X and a MAC flavored Unix?

...

I understand that the difference is the Kernel system used:

OS-X is Darwin systems used Mach 3.0 derived Micro-Kernel Structure with BSD mods (XNU).

making it (technically speaking) a Monolithic Kernel once again.

 

Regarding the Micro versus Monolithic-kernel, some SQL serving tests of OS X Server versus Linux (both on PPC, G5) strongly suggest that the OS X's Micro-kernel architecture has a flaw that significantly impacts it's performance when running a large number of threads:

 

mysqlperformance24ez.gif

 

http://www.anandtech.com/printarticle.aspx?i=2520

 

Some might find this to be expected:

"Microkernels generally underperform in comparison to traditional designs, sometimes dramatically. This is due in large part to the overhead of moving in and out of the kernel, a context switch, in order to move data between the various applications and servers" - http://en.wikipedia.org/wiki/Microkernel

 

I believe that Apple knows they have this Mico-kernel architectural problem, but I do not sure how difficult it would be to switch a Monolithic-kernel design. However, see this: http://lowendmac.com/musings/05/1214.html

 

PS: This thread does not belong in the "Thunderdome".

Link to comment
Share on other sites

Anyway, my point is, (and correct me if I'm wrong), that those open drivers from linux can be used in OS-X with some minor modifications and a re-compilation.

 

No. The Mac OS X device driver architecture is radically different. An experienced driver developer can certainly make use of code and algorithms from drivers developed for other platforms, but the changes required are most certainly not "minor".

 

 

Regarding the Micro versus Monolithic-kernel, some SQL serving tests of OS X Server versus Linux (both on PPC, G5) strongly suggest that the OS X's Micro-kernel architecture has a flaw that significantly impacts it's performance when running a large number of threads:

 

Mac OS X has a monolithic kernel; it does not use a microkernel architecture.

Link to comment
Share on other sites

Mac OS X has a monolithic kernel; it does not use a microkernel architecture.

 

Good point, but I think you are only half right. OS X does not technically use a "micro" kernel, even though OS X's kernel has a component based on Mach 3.0, which is a bone fide "micro" kernel. However, I do not believe that OS X has a true "monolithic" kernel either after reading what Apple has to say:

 

n Mac OS X, Mach is linked with other kernel components into a single kernel address space. This is primarily for performance; it is much faster to make a direct call between linked components than it is to send messages or do remote procedure calls (RPC) between separate tasks. This modular structure results in a more robust and extensible system than a monolithic kernel would allow, without the performance penalty of a pure microkernel.

 

http://developer.apple.com/documentation/D..._section_1.html

 

It clearly appears that Apple is using something in between a "micro" and "monolithic" kernel design. Of course, the "micro" kernel confusion stems from Apple's unqualified use of the word "Mach" and the proper name for OS X's kernel is "XNU" (which contains a Mach-based component):

 

http://www.kernelthread.com/mac/osx/arch_xnu.html

Link to comment
Share on other sites

Don't have very much to add here. Just a bit anoyed that everyone missed the crucialpart when porting *drivers*.

 

What's differs most is the Framework that the drivers interface with. (All drivers interface with some kind of "Framework". ie, a NIC driver interfaces with a Network Stack, in a predefined way, so you can use diffrent NIC drivers, without changing the stack)

 

In a traditional Unix, you basically have todo everything on your own. You register a set of callbacks, then you have to make sure you have correct locking between threads, make sure recursive callbacks works and similar.

In IOKit (The Main framework for kernel drivers), you, for starters, code everything in C++. You override some default class for the type of driver you are writing, and add code specific to your hardware.

Things like locking can be handled very easily, as all calls into your driver is handled by a "Workloop", and you can easily change the locking mechanism used here (Serialized as the most basic, or an arbitary complex one).

 

As you understand, it will never be as easy as simply recompiling a *BSD driver. It'll require lots of new design decisions to be able to port a *BSD driver to IOKit, so it'll interface "nicely". Just porting the code to c++ can be tricky at times, Gcc 3.x is kinda strict on casting and such...

Link to comment
Share on other sites

I am wondering why Linux and/or OS X can not make use of some adapter for Windows drivers in general.

 

Let's take OS X's IOKit, does Windows have something simiiar? If so, then why can't some kind of adapter be made that translates such that Windows drivers can be used on OS X?

 

Has anyone tried something like this with Linux?

Link to comment
Share on other sites

I am wondering why Linux and/or OS X can not make use of some adapter for Windows drivers in general.

 

They do. At the very least, both Linux and FreeBSD support the use of Windows NDIS drivers.

 

Let's take OS X's IOKit, does Windows have something simiiar?

 

Generally speaking, it does not.

 

If so, then why can't some kind of adapter be made that translates such that Windows drivers can be used on OS X?

 

For some specific Windows driver interfaces, such as NDIS, it might be done. Others such as the miniport interface are so lacking that drivers written to this interface are forced to make heavy use of other Windows kernel services. Emulating these in the Mac OS kernel would be very difficult.

 

As a consequence, it is generally better to rewrite the driver from scratch.

Link to comment
Share on other sites

Actually Mac OS X uses a hybrid kernel, basically its a modified microkernel.

 

As u know, Mac OS X/Darwin uses XNU, wich its composed by the Mach 3 kernel with specific components from the FreeBSD project, and on top of that a newly built C++ API for its drivers, aka IOKit ( thats why freebsd's drivers dont work with mac os, it uses a completly new API, but as many refered, u hv more chances of porting a freebsd driver than any linux driver ).

 

Overall we can say that the darwin kernel is more of a microkernel than a monolithic kernel, because most part of XNU's kernel implementation comes from Mach 3, specially its primitives and fundamental services, wich then are extended with freebsd bits and newly built bit to form the mac kernel we all know.

 

Mach was built to be a simple and very extensible kernel, the problem with that is that with great extensibility comes performance degradation, mostly because of his IPC system, it just makes too many context switches and memory mappings.

 

Anyway, Mac OS X is a hibrid kernel that shares concepts and implementations form both micro and monolithic kernels.

 

Its just not a monolithic kernel that can load modules on boot, the big different is that while it retains 'non-essential' code in the uses space ( microkernel ) it also retains 'non-essential' code within the kernel ( monolithic ) to speed up things.

 

Most of modern OS's use this system, even Windows ( kernel and NT Executive ).

Link to comment
Share on other sites

  • 2 weeks later...

But what I don't understand, is why FreebSD driver support was left out. IT would have been to hard to implement, and it would have made Darwin so much more versatil. But since it is opensource, i don't see why the kernel couldn't be modified. I was tryng this some months ago, but I just didn't have the time. I was previously think about running a loop to check for default drivers in IOKIT, if they were found, it would run the BSD kernel calls, if no BSD drivers were found it would revert back to IOKIT. However, there were alot of calls, i wasn't able to translate or implement, and it kept crashing. But hey, someone with time and talent shoudl definetly try it.

Link to comment
Share on other sites

  • 2 months later...
Hello PPL

I'm quite new to the MAC OS-X86 scene, and I am rather enthusiastic, so please forgive me if this issue was raised before, and kindly refer me to the correct forum thread...

 

A little history:

As a very long time computer user (does the model ZX-81 rings a bell anyone?), I've been in this computer industry for quite a while.

I looked into the OS-X history and found that it is built upon Darwin OS, which is based on some form of BSD, that in turn is derived from AT&T Unix => which means that OS-X is basically Unix.

Nothing new so far!

 

I've noticed that there is severe lack of device drivers for the upcoming OSx86 (essentially 3D Acc, Audio, etc.).

I also know that there are many Linux/Unix dist. that have many of these drivers available, and, being based and distributed under GPL/BSD License, allow the re-use of such code. though I am not familiar with the lisence under which the OS-X is distributed, but as it seems, most users on this forums don't give a donkie's tail about licenses (neither do I).

Anyway, my point is, (and correct me if I'm wrong), that those open drivers from linux can be used in OS-X with some minor modifications and a re-compilation.

 

all is needed is the source code for those drivers.

 

now, here comes the tricky part, can these sources be obtained from the hardware mfg.?

I believe so, since it's the mfg. interest to sell those products to MAC machines. (charge absurd prices for a piece of hardware that would cost fifth as much for PC). As far as I know, these drivers are consisted of small Binaries that actually handles the Hardware, and some HAL function providers, that are open coded.

I think that taking the binaries and fitting the code to the system, the result can run on any OS, namely OS-X

 

This all sounds simple, but is it really so? can someone enlighten me ?

 

oh, and here's another teaser, and maybe the subject of a whole new thread:

I know there are some Linux/BSD distro. out there, with the MAC-Like window manager.

has anyone tried it, and what are the noticeable differences (advantages and disadvantages) between the OS-X and a MAC flavored Unix?

 

wow, that was a long one for a first post......

don't worry, I won't make it a habit ;-)

Please feel free to answer, flame, and otherwise reply to this post....

 

search for:

EFI

OSI and FSF compliant Apple Open Source License 2.0

 

also: Mac != MAC (Mac is a platform, MAC is something about networks)

Link to comment
Share on other sites

  • 1 month later...

The big problem is that OSX uses somthing like a microkernal and Linux uses a monolithic kernal so I think that the operating system accesses the hardware in a diferent way between the two so the drivers would not work and probobly just crash the system, so it would be easier to write them from scratch then port them because the two original lines that youd end up keeping you would have known how to write any way.

 

good concept though

 

 

bwhsh8r

Link to comment
Share on other sites

OSX using a (sort of) microkernel and Linux using a (sort of) monokernel has nothing to do with why porting a driver is nigh impossible. I think previous posts have explained why quite eloquently.

Link to comment
Share on other sites

 Share

×
×
  • Create New...