darwin os

26
[VIVA College] 09 [Case Study on Darwin] By:=> Nishant Nair

Upload: nishant-nair

Post on 18-Nov-2014

110 views

Category:

Documents


1 download

TRANSCRIPT

[VIVA College]

09

[Case Study on Darwin] By:=> Nishant Nair

2

VIVA

Vishnu Waman Thakur Charitable Trust’sCollege Of Arts, Commerce and Science

CERTIFICATE

FOR CASE STUDYThis is to Certify That NISHANT NAIR OF S.Y.Bsc. (IT)

Class Has Satisfactory completed the case study on DARWIN for the year 2008-09

Professor-in-Charge Head of the Dept

Date: College Stamp

3

4

Darwin Darwin is the UNIX technology-based foundation of Mac OS X. Darwin integrates several technologies. Among the most important are 4.4BSD-based operating-system services (built on the Mach 3.0 microkernel), the I/O Kit, networking facilities, and support for multiple integrated file systems. Developers can use Darwin to port UNIX/Linux applications and create kernel extensions. Darwin is Mac OS X without the user interface. The BSD Unix and Mach 3.0 based Kernel connects since the first release in 1999 characteristics of the booth worlds Apple and UNIX. Mac OS X has beside the Mac OS predecessor his origin in the knowhow of NeXT technology, taken over by Apple in 1997. NeXT has developed the OPENSTEP operating system which was the further development of NEXTSTEP which in turn is based on 4.3 BSD. Apple supports actively the BSD community, because Darwin is compatible with the FreeBSD distribution as a reference and takes advance of much open source projects. Mac OS X merge therefore the efficiency and stability of UNIX (protected memory area) with the simple usability of MacOS.

Affected by the open source concept developers of Apple and the open source community work together for the PowerPC and x86 operating system version. Modifications and further developments flow back to the public, after a free registration the source code can be downloaded from the Apple web site. It can not be excluded that Darwin with his operating system core xnu splits up into independent distribution. All developed applications for the Darwin system core work also under Mac OS X, except for special Mac OS X applications which do not run directly under Darwin. Standard format for executable applications in Darwin is Mach-O. Support for the primarily by Linux program used .ELF format is not possible at present, but Linux applications can be ported.

5

Architecture

By the related UNIX design Mac OS X profits from the protected memory area and established preemptive multitasking. The Kernel consists of 5 components. Included are the Mach Microkernel with the BSD subsystem, file system, network ability and the I/O Kit. The file system supports file names with up to 255 characters and unicode. The Mach Micro kernel cares about the resource management like processor performance, scheduler, memory protection and the communication between the system layers. The core is enclosed by a specified version of the 4.4 BSD-Lite2 Kernel and userland. This contains POSIX APIs and abstracts the file system and the network communication. The BSD Kernel takes care for the administration of system processes and security policies and threading of program parts for Mac OS X. The I/O Kit introduced with Darwin is a object-oriented development software which provides the resources for the development of driver software with the support of SMP and preemptive multitasking.

The project OpenDarwin was founded in 2002 with the goal to provide a development environment for the Mac OS X source code and to develop a Darwin derivate. The new created community is a test platform for bug fixes as well as new functions for Mac Os X and Darwin that Apple integrate into the official source code. At 2006-07-25 the OpenDarwin team and the administrators announced the termination of this project. For reason the failure of the reaching of the goals was named. The project involved more to a host for Mac Os X project than to a development platform.

6

Kernel

Darwin is built around XNU (XNU is the computer operating system kernel that Apple Inc. acquired and developed for use in the Mac OS X operating system and released as free and open source software as part of the Darwin operating system. XNU is an acronym for X is Not Unix.), a hybrid kernel that combines the Mach 3 microkernel, various elements of BSD (including the process model, network stack, and virtual file system), and an object-oriented device driver API called I/O Kit. BSD is Berkeley Software Distribution (BSD, sometimes called Berkeley Unix) is the Unix operating system derivative developed and distributed by the Computer Systems Research Group of the University of California, Berkeley, from 1977 to 1995.

Some of the benefits of this choice of kernel are the Mach-O [Mach-O, short for Mach object file format, is a file format for executables, object code, shared libraries, dynamically-loaded code, and core dumps] binary format, which allows a single executable file (including the kernel itself) to support multiple CPU architectures, and the mature support for symmetric multiprocessing in Mach. The hybrid kernel design compromises between the flexibility of a microkernel and the performance of a monolithic kernel. [A monolithic kernel is a kernel architecture where the entire kernel is run in kernel space in supervisor mode]

7

Hardware and software support

Darwin currently includes support for both 32-bit and 64-bit variants of the PowerPC and Intel x86 processors used in the Mac and Apple TV as well as the 32-bit ARM processor used in the iPhone and iPod Touch.

It supports the POSIX API by way of its BSD lineage and a large number of programs written for various other UNIX-like systems can be compiled on Darwin with no changes to the source code

Darwin and Mac OS X both use I/O Kit for their drivers and therefore support the same hardware, file systems, and so forth. Apple's distribution of Darwin included proprietary (binary-only) drivers for their AirPort wireless cards.

Darwin does not include many of the defining elements of Mac OS X, such as the Carbon and Cocoa APIs or the Quartz Compositor [Quartz Compositor is the windowing system in Mac OS X.] and Aqua user interface (Aqua is the graphical user interface and primary visual theme of Apple Inc.'s Mac OS X operating system. It is based around the theme of water, as its name suggests, with droplet-like elements and liberal use of translucency and reflection effects), and thus cannot run Mac applications. It does, however, support a number of lesser known features of Mac OS X, such as mDNSResponder, which is the multicast DNS responder and a core component of the Bonjour networking technology, and launchd, an advanced service management framework.

8

License

In July 2003, Apple released Darwin under version 2.0 of the Apple Public Source License (APSL) (The Apple Public Source License is the open source and free software license under which Apple's Darwin operating system was released. A free software and open source license was voluntarily adopted to further involve the community from which much of Darwin originated.) , which the Free Software Foundation (FSF) approved as a free software license. Previous releases had taken place under an earlier version of the APSL that did not meet the FSF's definition of free software, although it met the requirements of the Open Source Definition.

MascotThe Darwin developers decided to adopt a mascot in 2000, and chose Hexley the Platypus, over other contenders, such as an Aqua Darwin fish, Clarus the Dogcow, and an orca. Hexley is a cartoon platypus who usually wears a cap resembling a demon's horns. He carries a trident, similar to the BSD Daemon, to symbolize the daemon's forking of processes. Hexley was designed and copyrighted by Jon Hooper; Apple does not sanction Hexley as a logo for Darwin.

The name was a mistake: it was originally supposed to be named after Thomas Henry Huxley, a 19th century English biologist who was a well-known champion of Charles Darwin's theory of evolution (nick-named "Darwin's bulldog"); however, ignorance led not only to a mistake in Huxley's name but who he was (the developers apparently thought he was simply Darwin's assistant, when in fact he was a prominent biologist in his own right). By the time the mistake had been discovered, however, it was deemed too late to change and the incorrect name "Hexley" was kept.

9

Releases

This is a table of major Darwin releases with their dates of release and their corresponding Mac OS X releases. Note that the corresponding Mac OS X release may have been released on a different date; refer to the Mac OS X pages for those dates.

Version number

Release date

Corresponding releases

Features and changes

0.1 March 16, 1999

Mac OS X Server 1.0

1.0 April 5, 2000

Mac OS X DP4 (Darwin 1.0.2)

1.2.1 November 15, 2000

Mac OS X Public Beta

1.3.1 April 13, 2001

Mac OS X v10.0

1.4.1 October 2, 2001

Mac OS X v10.1 Performance improvements to "boot time, real-time threads, thread management, cache flushing, and preemption handling," support for SMB network file system, Wget replaced with cURL.

6.0.1 September 23, 2002

Mac OS X v10.2 (Darwin 6.0.2)

GCC upgraded from 2 to 3.1, IPv6 and IPSec support, mDNSResponder service discovery daemon (Rendezvous), addition of CUPS, Ruby, and Python, journaling support in HFS+ (Darwin 6.2), application profiles ("pre-heat files") for faster program launching

7.0 October Mac OS X v10.3 BSD layer synchronized with FreeBSD

10

24, 2003 5, automatic file defragmentation, hot-file clustering, and optional case sensitivity in HFS+, bash instead of tcsh as default shell, read-only NTFS support (Darwin 7.9).

8.0 April 29, 2005

Mac OS X v10.4Mac OS X for Apple TV (Darwin 8.8.2)

Stable kernel programming interface, finer-grained kernel locking, 64-bit BSD layer, launchd service management framework, extended file attributes, access control lists, commands such as cp and mv updated to preserve extended attributes and resource forks.[10]

9.0 October 26, 2007

iPhone OS 1.0 (Darwin 9.0.0d1)Mac OS X v10.5

Full POSIX compliance, improved hierarchical process scheduling model, dynamically allocated swap files, dynamic resource limits (for files and processes), process sandboxing, address space layout randomization, DTrace tracing framework, file system events daemon, directory hard links, Apache 1.3 and PHP 4 updated to Apache 2.2 and PHP 5, read-only ZFS support.

11

Derived projects

Due to the free software nature of Darwin, there are many projects that aim to modify or enhance the operating system. One of them is as follows

OpenDarwin

GNOME running on OpenDarwin.

OpenDarwin was a community-led operating system based on the Darwin platform. It was founded in April 2002 by Apple Inc. and Internet Systems Consortium. Its goal was to increase collaboration between Apple developers and the free software community. Apple theoretically benefited from the project because improvements to OpenDarwin would be incorporated into Darwin releases; and the free/open source community supposedly benefited from being given complete control over its own operating system, which could then be used in free software distributions such as GNU-Darwin.

On July 25, 2006, the OpenDarwin team announced that the project was shutting down, as they felt OpenDarwin had "become a mere hosting facility for Mac OS X related projects," and that the efforts to create a standalone Darwin operating system had failed. They also state: "Availability of sources, interaction with Apple representatives, difficulty building and tracking sources, and a lack of interest from the community have all contributed to this." The last stable release was version 7.2.1, released on July 16, 2004.

12

Mach

Mach is at the heart of Darwin because it provides some of the most critical functions of the operating system. Much of what Mach provides is transparent to applications. It manages processor resources such as CPU usage and memory, handles scheduling, enforces memory protection, and implements a messaging-centered infrastructure for untyped interprocess communication, both local and remote. Mach provides many important advantages to Macintosh computing:

Protected memory. The stability of an operating system should not depend on all executing applications being good citizens. Even a well-behaved process can accidentally write data into the address space of the system or another process, which can result in the loss or corruption of data or even precipitate system crashes. Mach ensures that an application cannot write in another application’s memory or in the operating system’s memory. By walling off applications from each other and from system processes, Mach makes it virtually impossible for a single poorly behaved application to damage the rest of the system. Best of all, if an application crashes as the result of its own misbehavior, the crash affects only that application and not the rest of the system.

Preemptive multitasking. With Mach, processes share the CPU efficiently. Mach watches over the computer’s processor, prioritizing tasks, making sure activity levels are at the maximum, and ensuring that every task gets the resources it needs. It uses certain criteria to decide how important a task is and therefore how much time to allocate to it before giving another task its turn. Your process is not dependent on another process yielding its processing time.

Advanced virtual memory. In Mac OS X, virtual memory is “on” all the time. The Mach virtual memory system gives each process its own private virtual address space. For 32-bit applications, this virtual address space is 4 GB. For 64-bit applications, the

13

theoretical maximum is approximately 18 exabytes, or 18 billion billion bytes. Mach maintains address maps that control the translation of a task’s virtual addresses into physical memory. Typically only a portion of the data or code contained in a task’s virtual address space resides in physical memory at any given time. As pages are needed, they are loaded into physical memory from storage. Mach augments these semantics with the abstraction of memory objects. Named memory objects enable one task (at a sufficiently low level) to map a range of memory, unmap it, and send it to another task. This capability is essential for implementing separate execution environments on the same system.

Real-time support. This feature guarantees low-latency access to processor resources for time-sensitive media applications.

Mach also enables cooperative multitasking, preemptive threading, and cooperative threading.

14

Device-Driver Support

Darwin offers an object-oriented framework for developing device drivers called the I/O Kit framework. This framework facilitates the creation of drivers for Mac OS X and provides much of the infrastructure that they need. It is written in a restricted subset of C++. Designed to support a range of device families, the I/O Kit is both modular and extensible.

Device drivers created with the I/O Kit acquire several important features:

True plug and play Dynamic device management (“hot plugging”)

Power management (for both desktops and portables)

If your device conforms to standard specifications, such as those for mice, keyboards, audio input devices, modern MIDI devices, and so on, it should just work when you plug it in. If your device doesn’t conform to a published standard, you can use the I/O Kit resources to create a custom driver to meet your needs. Devices such as AGP cards, PCI and PCIe cards, scanners, and printers usually require custom drivers or other support software in order to work with Mac OS X.

15

BSD

Integrated with Mach is a customized version of the Berkeley Software Distribution (BSD) operating system (currently FreeBSD 5). Darwin’s implementation of BSD includes much of the POSIX API, which higher-level applications can also use to implement basic application features. BSD serves as the basis for the file systems and networking facilities of Mac OS X. In addition, it provides several programming interfaces and services, including:

The process model (process IDs, signals, and so on) Basic security policies such as file permissions and user and group

IDs

Threading support (POSIX threads)

Networking support (BSD sockets)

File-System Support

The file-system component of Darwin is based on extensions to BSD and an enhanced Virtual File System (VFS) design. The file-system component includes the following features:

Permissions on removable media. This feature is based on a globally unique ID registered for each connected removable device (including USB and FireWire devices) in the system.

Access control lists (available in Mac OS X version 10.4 and later)

URL-based volume mount, which enables users (via a Finder command) to mount such things as AppleShare and web servers

Unified buffer cache, which consolidates the buffer cache with the virtual-memory cache

Long filenames (255 characters or 755 bytes, based on UTF-8)

16

Support for hiding filename extensions on a per-file basis

Journaling of all file-system types to aid in data recovery after a crash

Network configuration in Darwin

For Darwin, the default configuration mechanism, and the officially recommended way, is to edit the files as described below.

In Darwin, network devices are referred to by a short name followed by a number. The number starts with zero and increases as more network interfaces of the same type are detected. Some short names used in Darwin are "en" (ethernet devices), "lo" (loopback interface), "ppp" (PPP and, post-darwin-1.3.1, PPPoE), and "pppoe" (PPPoE, pre-darwin-5.1).

There are 3 places network configuration information is stored.

/etc/iftab is the interface configuration file. This is where you set information regarding a specific interface.

/etc/hostconfig is a general host configuration file. This is where the default router is set.

NetInfo: your nameservice configuration resides in NetInfo under Darwin.

17

Networking Extensions

Darwin offers kernel developers a technology for adding networking capabilities to the operating system: network kernel extensions (NKEs). The NKE facility allows you to create networking modules and even entire protocol stacks that can be dynamically loaded into the kernel and unloaded from it. NKEs also make it possible to configure protocol stacks automatically.

NKE modules have built-in capabilities for monitoring and modifying network traffic. At the data-link and network layers, they can also receive notifications of asynchronous events from device drivers, such as when there is a change in the status of a network interface

Scripting Support

Darwin includes all of the scripting languages commonly found in UNIX-based operating systems. In addition to the scripting languages associated with command-line shells (such as bash and csh), Darwin also includes support for Perl, Python, Ruby, and others.

In Mac OS X v10.5, Darwin added support for several new scripting features. In addition to adding support for Ruby on Rails, Mac OS X also added scripting bridges to the Objective-C classes of Cocoa. These

18

bridges let you use Cocoa classes from within your Python and Ruby scripts.

19