Extension (Mac OS)
Encyclopedia
On the Apple Macintosh operating system prior to Mac OS X
Mac OS X
Mac OS X is a series of Unix-based operating systems and graphical user interfaces developed, marketed, and sold by Apple Inc. Since 2002, has been included with all new Macintosh computer systems...

, extensions were small pieces of code that extended the system's functionality. They were run initially at start-up time, and operated by a variety of mechanisms, including trap patching and other code modifying techniques. Initially an Apple developer hack, extensions became the standard way to provide a modular operating system. Large amounts of important system services such as the TCP/IP network stacks (MacTCP and Open Transport) and USB and Firewire support were optional components implemented as extensions. The term "system extension" later came to encompass faceless background applications as well.

Extensions generally filled the same role as DOS
DOS
DOS, short for "Disk Operating System", is an acronym for several closely related operating systems that dominated the IBM PC compatible market between 1981 and 1995, or until about 2000 if one includes the partially DOS-based Microsoft Windows versions 95, 98, and Millennium Edition.Related...

's terminate and stay resident
Terminate and Stay Resident
Terminate and Stay Resident is a computer system call in DOS computer operating systems that returns control to the system as if the program has quit, but keeps the program in memory...

 programs, or Unix
Unix
Unix is a multitasking, multi-user computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs, including Ken Thompson, Dennis Ritchie, Brian Kernighan, Douglas McIlroy, and Joe Ossanna...

's daemons
Daemon (computer software)
In Unix and other multitasking computer operating systems, a daemon is a computer program that runs as a background process, rather than being under the direct control of an interactive user...

, although they did have additional functionality to modify existing OS behaviour the other two did not.

The INIT mechanism

The concept of extensions was not present in the original Macintosh system software, but the system nevertheless had a private patching mechanism that developers soon learned to take advantage of - the INIT loader. This code would search for system resources of type 'INIT', and load and run them at boot time. The code resources had to be stored directly in the Mac System file's resource fork
Resource fork
The resource fork is a construct of the Mac OS operating system used to store structured data in a file, alongside unstructured data stored within the data fork. A resource fork stores information in a specific form, such as icons, the shapes of windows, definitions of menus and their contents, and...

, meaning it was only really available to "power users" who would be comfortable using ResEdit
ResEdit
ResEdit was a developer tool application for the Apple Macintosh, used to create and edit resources directly in the Mac's resource fork architecture. It was an alternative to tools such as REdit, and the resource compiler Rez. For the average user, ResEdit was generally easier to use, because it...

 or other resource editor.

Since taking advantage of this mechanism was an unsupported hack, Apple responded by providing a more managed solution. Initially this itself was in the form of an 'INIT' resource placed in the System file, 'INIT 31' that would search for further files of type 'INIT' in the System Folder, and load and run INIT resources inside them. (This is why some veteran Mac programmers still refer to the extensions loading mechanism as the "INIT 31 trick" http://www.mactech.com/articles/mactech/Vol.07/07.06/AShareUserName/). INITs could now be installed simply by placing a file in the System Folder, well within the abilities of the average Mac user. Starting with System 7, extensions were relocated to the Extensions folder within the System Folder for convenience.

Extensions retained the resource type of 'INIT' throughout their lifetime, and the loader was gradually enhanced to search for these resources in numerous places, including in the resource forks of control panels in a variety of formats and the Chooser.

Extensions

INITs evolved into system extensions, gaining additional ad hoc
Ad hoc
Ad hoc is a Latin phrase meaning "for this". It generally signifies a solution designed for a specific problem or task, non-generalizable, and not intended to be able to be adapted to other purposes. Compare A priori....

 protocols along the way, such as supplying an icon to be displayed at boot time (origin of this was ShowINIT). The 'parade of puzzle pieces and icons' across the screen as each extension loaded became familiar to all Mac users. Apple themselves eventually released major (but optional) pieces of the operating system as extensions, such as QuickTime
QuickTime
QuickTime is an extensible proprietary multimedia framework developed by Apple Inc., capable of handling various formats of digital video, picture, sound, panoramic images, and interactivity. The classic version of QuickTime is available for Windows XP and later, as well as Mac OS X Leopard and...

, QuickDraw 3D
QuickDraw 3D
QuickDraw 3D, or QD3D for short, is a 3D graphics API developed by Apple Inc. starting in 1995, originally for their Macintosh computers, but delivered as a cross-platform system....

 and many others. A substantial amount of services and drivers in Mac OS—both official and third party—were provided as extensions, allowing for the OS to be trimmed down by disabling them.
System extensions were a common source of instability on the Macintosh, as third-party code was of variable quality and would often patch the system in ways that did not always work correctly. In addition different extensions might try to patch the same part of the system, which could lead to extension conflict
Extension conflict
Extension conflicts were sometimes a problem on Apple Macintosh computers running versions of Mac OS prior to X, especially System 7. Extensions were bundles of code that extended the operating system's capabilities by directly patching OS calls, thus receiving control instead of the operating...

s and other instability. Tracking down these sources of trouble was another task most Mac users encountered at some point.

The simplest way to clean-boot the operating system was to hold the shift key: loading of extensions would be bypassed. System 7.5 added the Extensions Manager, which allowed the user to quickly enable or disable particular extensions, and also to define sets of them that would work correctly together. Extensions Manager came with two read-only base sets provided: one that contained the subset of extensions needed for basic OS operation, and one that enabled all the official extensions that shipped with the OS but disabled all third-party extensions.

The loading order of extensions was a side-effect of the GetFInfo function that was used by the loader to enumerate the files in the Extension folder. While Apple always have said that the order that results from enumeration of files using this function is undefined, on HFS volumes this function enumerated files in the order stored in the HFS catalog. People figured out that changing the first character in the file name could change the extension loading order, which caused trouble when Mac OS 8.1 moved to HFS+. Apple ended up having to change the loader to manually sort the filenames returned by this function into a table, and provided a interface to allow software to manually change the table. http://developer.apple.com/legacy/mac/library/technotes/tn/tn1123.html

Configuration, and control panels

System extensions had no user interface: there was no standard mechanism by which the user could configure the services provided by an extension. Extensions were able to alter the graphical interface (such as adding new menus to the menu bar) and thus accept user configuration, or they could be accompanied by an application to provide the configuration interface.

With System 7
System 7
System 7 is the name of a Macintosh operating system introduced in 1991.System 7 may also refer to:* System 7 , a British dance/ambient band* System 7 , 1991 album* IBM System/7, a 1970s computer system...

, control panels
Control panel (Mac OS)
Under Mac OS 9 and earlier, a control panel is a small application which enabled the user to modify software and hardware settings such as the sound volume and desktop pattern. Control panels differ from extensions in that they allow the user to specify options, whereas extensions provide the user...

 become separate Finder plugins on disc that could be launched by the user. By inserting INIT code into a control panel, it became possible to build extension/control panel hybrids that modified the operating system at boot time and contained their own in-built configuration interface in the same form as any other operating system control panel.

Faceless background applications

MultiFinder and System 7 and later supported full-fledged faceless background applications similar to UNIX daemons
Daemon (computer software)
In Unix and other multitasking computer operating systems, a daemon is a computer program that runs as a background process, rather than being under the direct control of an interactive user...

. Examples included Time Synchronizer (daylight saving time
Daylight saving time
Daylight saving time —also summer time in several countries including in British English and European official terminology —is the practice of temporarily advancing clocks during the summertime so that afternoons have more daylight and mornings have less...

 adjustment and remote time synchronisation), Software Update Scheduler, and Folder Actions (folder event handling). Faceless background applications were regular applications with the simple restriction that they did not show up on the application menu. As such, they were prohibited from opening a window: if they did so, the system would freeze.
They were free to open global floating windows, however, since these could neither gain nor lose focus.

The only technical differences between a faceless background application and a regular application were that the "Only background" flag was set in the 'SIZE' resource.

The Control Strip
Control Strip
The Control Strip is a user interface component of the "classic" System 7 Mac OS which and remained until the Macintosh OS X system replaced the class Macintosh OS in December 2001.- History :...

 in Mac OS 8 and 9 was an example of a faceless background application that displayed—in defiance of the term "faceless"—a global floating window to provide user interaction. The Application Switcher was another. However, the user was not aware at any time that the Control Strip was a running process; it was simply presented as an extra interface feature. The system simply described faceless background applications as system applications.

Language features in the Open Scripting Architecture (and thus AppleScript
AppleScript
AppleScript is a scripting language created by Apple Inc. and built into Macintosh operating systems since System 7. The term "AppleScript" may refer to the scripting system itself, or to particular scripts that are written in the AppleScript language....

) were initially implemented as dynamically loadable plugins known as "scripting additions" or OSAXes. In Mac OS 8 and 9, these were augmented by faceless background applications that were loaded in the background on demand. Just as with regular applications, these applications were accessed using tell clauses: the global namespace was not updated as was the case with OSAXes. The operating system did not indicate the launch of such processes nor indicate whether or not they were running.

Other non-INIT extensions

INIT-type extensions were loaded at boot time to update the operating system. Confusingly, various other files were placed into the Extensions folder, many of which were not loaded at boot time. The most notable of these were shared libraries which were commonly put into the Extensions folder for ease of location. Shared libraries are not loaded at boot time.

INIT was not the only type of system extension. Another type is the scri, or WorldScript extension. The BootX
BootX (Linux)
BootX is the name of a graphical bootloader developed by Benjamin Herrenschmidt, which runs as an application or an extension to Mac OS 8 and 9 that allows Old World Apple computers to boot Linux. It is no longer maintained by its original author, as it does not work with any current hardware, but...

Linux bootloader was implemented as a scri simply because they are loaded very early on in the boot process before all other extensions. BootX could then display a dialog offering to let the user finish booting Mac OS or load Linux instead.
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK