Extension (Mac OS)

Last updated

On the classic Mac OS (the original Apple Macintosh operating system), 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 phrase "system extension" later came to encompass faceless background applications as well.

Contents

Extensions generally filled the same role as DOS's terminate and stay resident programs, or Unix's daemons, although by patching the underlying OS code, they had the capability to modify existing OS behaviour, the other two did not.[ dubious ]

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 suitcase's resource fork, meaning it was only really available to "power users" who would be comfortable using ResEdit or other resource editor.

Since taking advantage of this mechanism was an unsupported hack, and only 32 INITs could be loaded in this manner, Apple responded by providing a more managed solution. Initially this itself was in the form of an 'INIT' resource with ID 31 placed in the System file 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". [1] INITs could now be installed simply by placing a file in the System Folder, well within the abilities of the average user. Starting with System 7, extensions were relocated to the Extensions folder within the System Folder for convenience, and an auto-routing mechanism was implemented so that placing an extension into the System Folder through drag and drop would actually place the file in the appropriate subfolder.

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 protocols along the way, such as supplying an icon to be displayed at boot time (the 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, QuickDraw 3D and many others. A substantial number 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. Some extensions didn't work properly together, or worked only when loaded in a particular order. In addition, different extensions might try to patch the same part of the system, which could lead to extension conflicts and other instability. Tracking down these sources of trouble was another task most Mac users encountered at some point. Troubleshooting Mac OS extensions could be a time-consuming process of bisecting and trial and error.

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 sort the filenames returned by this function into a table, and provided an interface to allow software to change the table. [2]

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, control panels 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 faceless background applications similar to UNIX daemons or Windows Services, though using cooperative multitasking. Examples included Time Synchronizer (daylight saving time adjustment and remote time synchronization), Software Update Scheduler, and Folder Actions (folder event handling). Faceless background applications were regular applications with the restriction that they did not show up on the application menu. 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. They were prohibited from opening a normal application-level 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 Control Strip in Mac OS 8 and 9 was an example of a faceless background application that displayed 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".[ citation needed ]

Language features in the Open Scripting Architecture (and thus AppleScript) 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 could be placed into the Extensions folder as well, 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 were not loaded at boot time.

INIT-type files were not the only type of system extension. Another type was scri, or WorldScript extension. The BootX Linux bootloader was implemented as a scri simply because such files were 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.

See also

Related Research Articles

Hierarchical File System (HFS) is a proprietary file system developed by Apple Inc. for use in computer systems running Mac OS. Originally designed for use on floppy and hard disks, it can also be found on read-only media such as CD-ROMs. HFS is also referred to as Mac OS Standard, while its successor, HFS Plus, is also called Mac OS Extended.

The resource fork is a fork or section of a file on Apple's classic Mac OS operating system, which was also carried over to the modern macOS for compatibility, used to store structured data along with the unstructured data stored within the data fork.

<span class="mw-page-title-main">System 7</span> Apple Macintosh operating system released from 1991–1997

System 7, codenamed "Big Bang", and also known as Mac OS 7, is a graphical user interface-based operating system for Macintosh computers and is part of the classic Mac OS series of operating systems. It was introduced on May 13, 1991, by Apple Computer It succeeded System 6, and was the main Macintosh operating system until it was succeeded by Mac OS 8 in 1997. Current for more than six years, System 7 was the longest-lived major version series of the classic Macintosh operating system. Features added with the System 7 release included virtual memory, personal file sharing, QuickTime, QuickDraw 3D, and an improved user interface.

In computing, a loadable kernel module (LKM) is an object file that contains code to extend the running kernel, or so-called base kernel, of an operating system. LKMs are typically used to add support for new hardware and/or filesystems, or for adding system calls. When the functionality provided by an LKM is no longer required, it can be unloaded in order to free memory and other resources.

<span class="mw-page-title-main">Daemon (computing)</span> Computer program that runs as a background process

In 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. Traditionally, the process names of a daemon end with the letter d, for clarification that the process is in fact a daemon, and for differentiation between a daemon and a normal computer program. For example, syslogd is a daemon that implements system logging facility, and sshd is a daemon that serves incoming SSH connections.

<span class="mw-page-title-main">Multi-booting</span> Act of installing multiple operating systems on a single computer

Multi-booting is the act of installing multiple operating systems on a single computer, and being able to choose which one to boot. The term dual-booting refers to the common configuration of specifically two operating systems. Multi-booting may require a custom boot loader.

<span class="mw-page-title-main">Mac OS 8</span> 1997 Classic Mac OS operating system by Apple and eighth major release

Mac OS 8 is an operating system that was released by Apple Computer on July 26, 1997. It includes the largest overhaul of the classic Mac OS experience since the release of System 7, approximately six years before. It places a greater emphasis on color than prior versions. Released over a series of updates, Mac OS 8 represents an incremental integration of many of the technologies which had been developed from 1988 to 1996 for Apple's overly ambitious OS named Copland. Mac OS 8 helped modernize the Mac OS while Apple developed its next-generation operating system, Mac OS X.

<span class="mw-page-title-main">XNU</span> Computer operating system kernel

XNU is the computer operating system (OS) kernel developed at Apple Inc. since December 1996 for use in the Mac OS X operating system and released as free and open-source software as part of the Darwin OS, which in addition to macOS is also the basis for the Apple TV Software, iOS, iPadOS, watchOS, and tvOS OSes. XNU is an abbreviation of X is Not Unix.

The Macintosh Toolbox implements many of the high-level features of the Classic Mac OS, including a set of application programming interfaces for software development on the platform. The Toolbox consists of a number of "managers," software components such as QuickDraw, responsible for drawing onscreen graphics, and the Menu Manager, which maintain data structures describing the menu bar. As the original Macintosh was designed without virtual memory or memory protection, it was important to classify code according to when it should be loaded into memory or kept on disk, and how it should be accessed. The Toolbox consists of subroutines essential enough to be permanently kept in memory and accessible by a two-byte machine instruction; however it excludes core "kernel" functionality such as memory management and the file system. Note that the Toolbox does not draw the menu onscreen: menus were designed to have a customizable appearance, so the drawing code was stored in a resource, which could be on a disk.

HFS Plus or HFS+ is a journaling file system developed by Apple Inc. It replaced the Hierarchical File System (HFS) as the primary file system of Apple computers with the 1998 release of Mac OS 8.1. HFS+ continued as the primary Mac OS X file system until it was itself replaced with the Apple File System (APFS), released with macOS High Sierra in 2017. HFS+ is also one of the formats supported by the iPod digital music player.

launchd is an init and operating system service management daemon created by Apple Inc. as part of macOS to replace its BSD-style init and SystemStarter. There have been efforts to port launchd to FreeBSD and derived systems.

Extension conflicts were sometimes a common nuisance on Apple Macintosh computers running the classic Mac OS, 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 system when applications made system calls. Generally, once an extension completed its task, it was supposed to pass on the system call to the operating system's routine. If multiple extensions want to patch the same system call, they end up receiving the call in a chain, the first extension in line passing it on to the next, and so on in the order they are loaded, until the last extension passes to the operating system. If an extension does not hand the next extension in line what it is expecting, problems occur; ranging from unexpected behavior to full system crashes. This is triggered by several factors such as carelessly programmed and malicious extensions that change or disrupt the way part of the system software works.

In NeXTSTEP, OPENSTEP, GNUstep, and their lineal descendants macOS and iOS, a bundle is a file directory with a defined structure and file extension, allowing related files to be grouped together as a conceptually single item.

In computing, a dynamic linker is the part of an operating system that loads and links the shared libraries needed by an executable when it is executed, by copying the content of libraries from persistent storage to RAM, filling jump tables and relocating pointers. The specific operating system and executable format determine how the dynamic linker functions and how it is implemented.

<span class="mw-page-title-main">EFI system partition</span> Partition used by Unified Extensible Firmware Interface

The EFIsystem partition or ESP is a partition on a data storage device that is used by computers having the Unified Extensible Firmware Interface (UEFI). When a computer is booted, UEFI firmware loads files stored on the ESP to start installing operating systems and various utilities.

<span class="mw-page-title-main">BootX (Apple)</span> Boot loader developed by Apple Inc.

BootX is a software-based bootloader designed and developed by Apple Inc. for use on the company's Macintosh computer range. BootX is used to prepare the computer for use, by loading all required device drivers and then starting-up Mac OS X by booting the kernel on all PowerPC Macintoshes running the Mac OS X 10.2 operating system or later versions.

<span class="mw-page-title-main">System 1</span> First version of Apple Macintosh operating system

The Macintosh "System 1" is the first version of Apple Macintosh operating system and the beginning of the classic Mac OS series. It was developed for the Motorola 68000 microprocessor. System 1 was released on January 24, 1984, along with the Macintosh 128K, the first in the Macintosh family of personal computers. It received one update, "System 1.1" on December 29, 1984, before being succeeded by System 2.

<span class="mw-page-title-main">Apple Disk Image</span> Disk image file format developed by Apple and commonly used by macOS

AppleDisk Image is a disk image format commonly used by the macOS operating system. When opened, an Apple Disk Image is mounted as a volume within the Finder.

<span class="mw-page-title-main">Classic Mac OS</span> Original operating system of Apple Mac (1984–2001)

Mac OS is the series of operating systems developed for the Macintosh family of personal computers by Apple Computer from 1984 to 2001, starting with System 1 and ending with Mac OS 9. The Macintosh operating system is credited with having popularized the graphical user interface concept. It was included with every Macintosh that was sold during the era in which it was developed, and many updates to the system software were done in conjunction with the introduction of new Macintosh systems.

macOS Big Sur 17th major version of the macOS operating system

macOS Big Sur is the seventeenth major release of macOS, Apple Inc.'s operating system for Macintosh computers. It was announced at Apple's Worldwide Developers Conference (WWDC) on June 22, 2020, and was released to the public on November 12, 2020.

References