views:

334

answers:

3

Hi all,

I was watching the WWDC 2009 Keynote and something someone said about Windows 7/Vista got me curious..

The speaker claimed that 7 was still a poor operating system because it still used the same technologies such as DLLs and the registry. How accurate are his claims and how different is OS X doing it? Even os x has dynamically loaded libraries right? I guess the Registry thing might have some weight..

Can anyone explain to me the differences in each OS' strategy?

I'm not trying to incite fanboys here or anything, I just want to know how both operating systems tackle problems in general..

Thanks,

kreb

A: 

DLL's are bad variations of libaries since they are unable to operate on their own, to use them a further wrapper executable is called(automatically), which adds unrequired overhead and makes it much harder to tell which libraries are actually in use. Another less important flaw, is the inability for systems to truely share a library. *nix systems avoid this by having libraries exist on the top level running on their own or under a larger wrapper(like kde-init ), the libraries may be shared by any applications, meaning only a single copy of each library is required, and you may at any time kill a single library with ease as required.

The registry is a great idea, except for the fact that it is used for so much, almost anything you install will use the registry, and a corrupt registry and render your operating system almost completely useless until it's fixed. This is avoided in *nix systems by having multiple different files for different content, drivers are refered to via Xorg's config file, installed applications will be written to their own database, and keys or identification will often be written into a directory, rather than a single all purpose file. This reduces the likely hood of a serious failure and means that at any time you can probably still repair the system. If Xorg becomes corrupt you just reconfigure it, if the installed applications database becomes corrupt you can repair or rebuild it, and should an applications individual settings directory become corrupt you need only reinstall one application(and most good commercial aps should have a way to repair this anyway)

scragar
Sorry, I thought it was possible to share DLLs? Hmm.. =/ Anyway thanks for the answer :)
krebstar
Actually, using DLLs doesn't require any wrapper executable, they are used directly by the applications. Furthermore, applications can certainly share DLLs. An example of sharing are the Windows' system DLLs or .NET GAC assemblies.
Bojan Resnik
The comments here about DLL's are very incorrect. DLL's can (and often are) fully shared amongst processes.
Foredecker
+5  A: 

Of course both operating systems have facilities for using DLLs (they're called dylibs or Frameworks on OS X depending on how they're packaged).dylibs are very much like DLLs--they are a dynamically linked library and as such there may be multiple versions of them floating around. Frameworks, on the other hand, are really a directory structure. They contain dynamically linked libraries (potentially multiple versions of them), resources, headers, documentation, etc. The dynamic linker on OS X automatically handles choosing the correct library version from the framework for each executable. The system appears to work better than Windows' DLL management which is, well, quite a mess still (of course, Windows' system is tied by legacy issues that Apple dropped when they moved to OS X). To be fair, Unix has had a solution to this problem for a long time, as well using symbolic links to link dylibs to their correct versioned implementation, allowing multiple installed versions.

There is no OS X equivalent of the Windows registry. This is good and bad. The good side is that it's much harder to corrupt an entire OS X system with a registry screw up. OS X instead stores configuration in many separate files, usually one or more per application, user, whatever. These files are generally a plist (an XML schema representing dictionaries, arrays, and primitive types) formatted file. The bad side is that, by retaining this Unix-y heritage, OS X doesn't have the same über-admin tools that can churn through the registry and do all sorts of crazy things.

Barry Wark
+1 Good answer thanks :)
krebstar
+2  A: 

DLLs

The major difference between OS X and Windows is that Windows historically tried to save space/memory by having everyone share code (i.e. you install one DLL, everyone can use it). Apple statically compiles (well, not really, but it may as well be) all of the non-system libraries into every application. Wastes disk space/memory, but makes app deployment way easier and no versioning issues.

Registry

OS X does have a registry, they're just flat files called plists, instead of a magic component that's mostly like a filesystem except where it's not. Apple's approach makes it easy to migrate settings from one machine to another, whereas Windows' approach is faster in-memory, and allows apps to easily "watch" a key without taking a big perf hit (i.e. one app changes a key and the other instantly knows about it).

In conclusion

The keynote presenter's full of it, 10.6 is mostly the same code as 10.5, which was mostly the same code as 10.4 et al, just like Win7 is mostly Vista, which is mostly Server '03, etc. There's far too much tested code in an operating system to throw it away every release, especially if you actually want your customers' apps to work.

Paul Betts
Thanks, that was very clear.. :) Accepting this as best answer, although Barry Wark's is also good..
krebstar
It is inacurate to say that all non-system libraries are statically linked into app bundles on OS X. Although app bundles may contain frameworks (dynamically linked libraries), and some do bundle non-system frameworks, it's also possible to install frameworks in a system-wide or user-wide Library/Frameworks folder where they can be used by many applications. OS X apps that are not drag 'n drop installable (i.e. they require a full installer) generally use the installer to install these frameworks.
Barry Wark
For all practical intents and purposes, the only people who can create Frameworks are Apple, or else every app becomes a .pkg file.
Paul Betts
Incorrect. Any developer can build frameworks. These frameworks can be installed system wide in /Library/Frameworks or user-wide in ~/Library/Frameworks. They can be installed by an installer package (.pkg) or by drag-n-drop. Apple reserves the /System/Library/Frameworks folder for themselves, but that's the only restriction.
Barry Wark
You are misunderstanding me. You are still 100% correct that you *can* create Frameworks. So you create SuperAwesome.Framework. Now how can I as a regular App developer use the *shared version* in my product (i.e. not make a copy in my .App)?
Paul Betts
Frameworks have an install path property (set at build time or by otool) which tells the dynamic linker what path to put into the linking binary to tell the dynamic linker where to find the framework at run time. So, if SuperAwesome.framework has an install path of `@executable_path/../Frameworks`, indicating that it expects to be installed in an app bundle, then a linking application would copy the framework into its bundle. If, the framework had an install path of /Library/Frameworks, then the app would use the framework from there (i.e. shared).
Barry Wark
...obviously SuperAwesome.framework would have to be installed in /Library/Frameworks or the linking application would crash at startup.
Barry Wark
And how would you guarantee that SuperAwesome.framework is installed, so your customers' apps won't crash?
Paul Betts
How would you go about it on Windows without entering DLL hell?I don't think this is really a platform question, since both platforms can take both approaches to distributing their shared libraries.
nschmidt