unix derivatives: mac osx and ubuntu

Upload: kyle-roach

Post on 02-Jun-2018

224 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/10/2019 UNIX Derivatives: Mac OSX and Ubuntu

    1/7

    UNIVERSITY OF THE SOUTHERN CARIBBEAN

    MARACAS ROYAL ROAD, MARACAS, ST. JOSEPH

    UNIX Derivatives: Mac OS X and Ubuntu

    A Kernel Approach

    An Assignment

    Presented in Partial Fulfilment

    Of the Requirements for the Course

    CPTR461: OPERATING SYSTEMS 1

    Instructor: Connell Byron Hunte

    By:

    Kyle Roach

    25th

    January 2014

    Approval.

  • 8/10/2019 UNIX Derivatives: Mac OSX and Ubuntu

    2/7

    Windows is the best operating system. This is a statement often made by ignorant

    Windows users who have never used another operating system. In the first quarter of 2014,

    88.99% of the worldwide desktop users had a Windows system as their operating system of

    choice (Stat Counter Global Stats 2014). Unfortunately this number includes users who have

    never used or been exposed to other operating systems. To them, Windows is the best and only

    choice for an operating system. However to smaller population, we know that other operatingsystems offer features and tools which far outweigh those of Windows. Outside of Windows

    systems, the other operating systems are all UNIX-based in some way. UNIX, the computer

    operating system from Bell Labs, is still regarded as one of the most powerful, versatile, and

    flexible operating systems in the computer world. Its popularity is due to many factors, including

    its ability to run a wide variety of machines, from micros to supercomputers, and its portability --

    all of which led to its adoption by many manufacturers (Bell Labs 2002). After modifications

    made my developers over the years we ended up with two prominent kernels XNU and Linux.

    In my paper I will seek to point out the differences and similarities between these two kernels

    and how they affect the operating systems that they run.

    On many online forums about operating systems, you would often see the comment being

    made that OS X is a Linux-based operating system. However OS X is actually built on the XNUkernel which like Linux, got its origins from UNIX. The operating systems we will use if needed

    are Apples OS X with its XNU kernel and Ubuntu with its Linux kernel. The criteria we will

    use to compare these are process management, storage management, and network management.

    The first and foremost biggest difference between the two operating systems lies in the

    architecture of the kernel. The kernel is the indispensable and therefore most important of an

    operating system. The kernel is the true brains of the OS and controls virtually all aspects of

    interacting with the underlying hardware (Taggart 2008). Basically without this essential

    component of the operating system your computer would just be an expensive paperweight with

    spinning fans. Roughly the operating system itself consists of two parts: the kernel space

    (privileged mode) and user space (unprivileged mode). It runs every basic system service like

    process and memory management, interrupt handling and I/O communication, file system, etc. in

    kernel space. There are two different concepts of kernels: monolithic kernel and -kernel

    (microkernel) (Roch 2004). A monolithic kernel is one in which the entire kernel exists as one

    large file. The second approach is known as the microkernel. An OS built on the microkernel

    approach will have many smaller kernels that all communicate with each other (Taggart 2008).

    Linux uses the monolithic approach in which its kernel is one large file that is made up

    of over 5.9 million lines of code. In fact, almost all of the hardware drivers are contained in the

    kernel itself. This makes installing "drivers" in Linux a non-issue. Most hardware simply works

    out of the box.

    On the other hand XNU is hybrid kernel, containing features of both monolithic kernels

    and microkernels, attempting to make the best use of both technologies, such as the messagepassing capability of microkernels enabling greater modularity and larger portions of the OS to

    benefit from protected memory, as well as retaining the speed of monolithic kernels for certain

    critical tasks (Taggart 2008). The basis for the XNU kernel however is the Mach microkernel.

    The Kernel and Device Drivers layer of OS X consists of the Mach kernel environment, device

    drivers, BSD library functions (libSystem), and other low-level components. The layer includes

    support for file systems, networking, security, interprocess communication, programming

    languages, device drivers, and extensions to the kernel. These combined form what we know as

  • 8/10/2019 UNIX Derivatives: Mac OSX and Ubuntu

    3/7

    Darwin.

    Process Management

    Now that we have identified the difference in kernel architecture, we can continue to how

    they each manage processes. The process is one of the fundamental abstractions in UNIX

    operating systems. A process is a program in execution. A program itself is not a process a

    process is an active program and related resources. Indeed, two or more processes can exist that

    are executing the same program. In fact, two or more processes can exist that share various

    resources, such as open files or an address space (Love 2005). In OS X, processes do not

    normally share memory. Instead, the kernel assigns each process its own address space,

    controlling access to these address spaces. This control ensures that no application can

    inadvertently access or modify another applications memory (protection) (Apple 2004).

    Threads of execution, often shortened to threads, are the objects of activity within the

    process. To Linux, a thread is just a special kind of process. It does not differentiate between

    threads and processes (Love 2005). In OS X each process is made up of one or more threads,each of which represents a single path of execution through the application's code. Every

    application starts with a single thread, which runs the application's main function. Processes do

    not directly interact with the processor, this is handled by threads. Applications can spawn

    additional threads, each of which executes the code of a specific function. When an application

    spawns a new thread, that thread becomes an independent entity inside of the application's

    process space (Apple 2013).

    Multitasking operating systems come in two flavours: cooperative

    multitaskingandpreemptive multitasking. Both OS X and Ubuntu use pre-emptive multitasking.

    In preemptive multitasking, the scheduler decides when a process is to cease running and a new

    process is to resume running. Both OS X and Ubuntu employ two general schedule techniques:

    time-sharing and fixed priority. A time-sharing threads priority is raised and lowered to balanceits resource consumption against other time-sharing threads. Fixed-priority threads execute for a

    certain quantum of time, and then are put at the end of the queue of threads of equal priority

    (Apple 2004), (Love 2005).

    Uniprogramming environments ran a task till it was finished and then started another

    task. With the introduction of multi programming and scheduling processes, came the problem of

    deadlocks. In OS X there are two deadlock implementations, a deadlock and a livelock. In a

    livelock situation, a thread gives up its first lock in an attempt to acquire its second lock. Once it

    acquires the second lock, it goes back and tries to acquire the first lock again and this process

    continues. Both OS X and Ubuntu use the same methods for detecting, preventing, and resolving

    deadlocks.

    Storage Management

    All computer applications need to store and retrieve information. While a process is

    running, it can store a limited amount of information within its own address space. However to

    store information persistently, a file system is needed. UNIX has provided four basic

    filesystem-related abstractions: files, directory entries, inodes, and mount points. The file-system

    component of Darwin is based on extensions to BSD and an enhanced Virtual File System (VFS)

    design (Apple 2004). The Virtual File System is the subsystem of the kernel that implements the

  • 8/10/2019 UNIX Derivatives: Mac OSX and Ubuntu

    4/7

    filesystem-related interfaces provided to user-space programs. This enables programs to use

    standard UNIX system calls to read and write to different filesystems on different media (Love

    2005). Both OS X and Ubuntu use a virtual filesystem as an abstraction layer between the

    user-space and the filesystem. There are three file system designs. (a) Single directory shared by

    all users. (b) One directory per user. (c) Arbitrary tree per user. In both OSs one directory is used

    per user (Tanenbaum, Woodhull 2006). Both OS X and Ubuntu have the same file system layout,however in OS X many of these directories are hidden by default from the user, and permissions

    to limit a users access to system files and other user directories are set automatically (Cone

    2011). A Linux system, just like UNIX, makes no difference between a file and a directory, since

    a directory is just a file containing names of other files. Programs, services, texts, images, and so

    forth, are all files. Input and output devices, and generally all devices, are considered to be files,

    according to the system. In order to manage all those files in an orderly fashion, man likes to

    think of them in an ordered tree-like structure on the hard disk, as we know from MS-DOS (Disk

    Operating System) for instance. The large branches contain more branches, and the branches at

    the end contain the tree's leaves or normal files (Garrels 2004). The default file system in OS X

    is HFS+ while Ubuntu uses Ext2, Ext3, Ext4. The kind of problem resulting in an error message

    saying that permission is denied somewhere is usually a problem with access rights in mostcases. Also, comments like, "It worked yesterday," and "When I run this as root it works," are

    most likely caused by the wrong file permissions. Both Ubuntu and OS X provide the chmod

    system call to modify user permissions.

    Networking Management

    Networking allows us to communicate with people all around the world. Networking also

    occurs at a device level, where devices communicate and transfer data across networks. Both OS

    X and Ubuntu both provide support for various communication protocols out of the box which

    provide for easy network management and usage. In network communication is described in

    what we call a protocol stack. Each layer of the protocol stack is connected or accessed by a

    group of protocols Integrated into OS Xs kernel is a customized version of the BerkeleySoftware Distribution (BSD) operating system. BSD serves as the basis for the file systems and

    networking facilities of OS X (Apple 2004). This provides strong TCP/IP networking with

    support for industry standards such as SLIP, PPP, and NFS. OS X can interoperate easily with

    other systems as well as act as an enterprise server, providing vital functions such as NFS

    (remote file access) and email services, or Internet services such as HTTP, FTP, routing, and

    firewall (security) services (Apple 2004).

    The network function is a very important part of the Linux kernel. More than 30% of the

    Web server on the Internet are constructed on Linux. The protocol stack of Linux is a part of the

    kernel and is embedded in the kernel code. The structure of the network protocol makes it

    possible to support lots of protocols at the same time. Linux provides a system call named

    sys_socketcall to provide an interface to application programs. It provides standard BSD Socket

    interface to realize the separation of the user program and the network functions of the Linux

    kernel. The data in the user space is copied into the kernel space. The kernel and the user

    programs are different running units, and have their own behavior. In order to protect the unity of

    the data, the user program and the kernel have a copy of the data of their own independently

    (Shaoren, & Chuanxiong 2000). TCP/IP networking has been present in Linux since its

    beginnings. It has been implemented from scratch. It is one of the most robust, fast and reliable

  • 8/10/2019 UNIX Derivatives: Mac OSX and Ubuntu

    5/7

    implementations and is one of the key factors of the success of Linux. Linux and networking are

    made for each other, in so much that not connecting your Linux system to the network may result

    in slow startup and other troubles. Even if you don't use any network connections to other

    computers, networking protocols are used for internal system and application communications.

    Linux expects to be networked (Garrels 2004).

    In conclusion the UNIX operating system and standards gave rise to spark of kernel

    modifications, which integrally led to the development of UNIX- based operating systems, such

    as OS X and Ubuntu. We saw that even though both operating systems were UNIX-based, they

    still had differences, which were primarily dependent on the structure and architecture of their

    kernels. Both operating systems offer advanced tools which allow them to be competent in the

    business world, providing solid alternatives to the Windows systems meta. In my opinion, OS X

    and its XNU kernel provides more power and features compared to Ubuntu and its Linux kernel,

    primarily because the XNU kernel is hybrid which allows features from both kernel

    architectures. However as the saying goes, A man will always use the right tool for the job. In

    saying this, there is no best operating system, for the needs of consumer will always determine

    what features of an os he needs. Windows isnt the only operating system on the market.

  • 8/10/2019 UNIX Derivatives: Mac OSX and Ubuntu

    6/7

    References

    Stat Counter Global Stats. (2014). Top 7 Desktop OSs from January to March 2014.Retrieved

    from http://gs.statcounter.com/#desktop-os-ww-monthly-201401-201403-bar

    Bell Labs. (2002). The Creation of the UNIX Operating System.Retrieved from

    http://www.bell-labs.com/history/unix/

    Roch, B. (2004).Monolithic Kernel vs Microkernel.Retrieved from

    http://www.davepowell.org/media/teaching/operating-systems/handouts/COMP354-Lec0

    2-KernelComparisons.pdf

    Tanenbaum, A. S., & Woodhull, A. S. (2006) Operating Systems Design and Implementation,

    (3rd ed.). New Jersey: Prentice Hall.

    Taggart, Michael. (2008).Linux vs. Windows vs. OS X - The Kernel Debate. Retrieved from

    http://roala.blogspot.com/2008/01/linux-vs-windows-vs-os-x-kernel-debate.html

    Love, R. (2005).Linux Kernel Development (2nd ed.). Indianapolis, IN: Sams Publishing.

    Apple Inc. (2004). Kernel Programming Guide.Retrieved from

    https://developer.apple.com/library/mac/documentation/Darwin/Conceptual/KernelProgra

    mming/Architecture/Architecture.html

    Apple Inc. (2013). Thread Programming Guide. Retrieved from

    https://developer.apple.com/library/mac/documentation/cocoa/conceptual/multithreading/

  • 8/10/2019 UNIX Derivatives: Mac OSX and Ubuntu

    7/7

    CreatingThreads/CreatingThreads.html#//apple_ref/doc/uid/10000057i-CH15-SW2

    Apple Inc. (2004).Mac Technology Overview.Retrieved from

    https://developer.apple.com/library/mac/documentation/MacOSX/Conceptual/OSX_Tech

    nology_Overview/SystemTechnology/SystemTechnology.html#//apple_ref/doc/uid/TP40

    001067-CH207-TPXREF102

    Rusling, D. A. (2000). The Linux Kernel.New Jersey: Pearson Education

    Shaoren, Z., & Chuanxiong, G. (2000). Analysis and Evaluation of the TCP/IP Protocol Stack of

    LINUX*. 2000 International Conference on Communication Technology Proceedings

    (Vol. 1). doi: 10.1109/ICCT.2000.889245

    Garrels, M. (2004).Introduction to Linux.California. Fultus Corporation

    Cone, M. (2011).How to Set File Permissions in Mac OS X. Retrieved from

    http://www.macinstruct.com/node/415

    http://www.google.com/url?q=http%3A%2F%2Fdx.doi.org%2F10.1109%2FICCT.2000.889245&sa=D&sntz=1&usg=AFQjCNEQseUdqgisLz3FR5Zm5leq08u9FQ