44
CE01000-3 Operating Systems Lecture 6 Overview of Unix/Linux operating systems

CE01000-3 Operating Systems Lecture 6 Overview of Unix/Linux operating systems

Embed Size (px)

Citation preview

Page 1: CE01000-3 Operating Systems Lecture 6 Overview of Unix/Linux operating systems

CE01000-3 Operating Systems

Lecture 6Overview of Unix/Linux operating

systems

Page 2: CE01000-3 Operating Systems Lecture 6 Overview of Unix/Linux operating systems

Overview of Unix/Linux OS

In this lecture we shall give an overview of

1. History and development of Unix/Linux operating systems – early versions; BSD; Linux

2. Design/philosophy of approach of Unix/Linux

3. Overall design/structure of Unix/Linux

Page 3: CE01000-3 Operating Systems Lecture 6 Overview of Unix/Linux operating systems

History of different versions of Unix

Page 4: CE01000-3 Operating Systems Lecture 6 Overview of Unix/Linux operating systems

Unix early History

First developed in 1969 by Ken Thompson and Dennis Ritchie of the Research Group at Bell Laboratories (AT&T); incorporated features of other operating systems, especially MULTICS.

Originally written for a small mini-computer – PDP 7 (only 8K of main memory)

Small elegant operating system

Page 5: CE01000-3 Operating Systems Lecture 6 Overview of Unix/Linux operating systems

Unix and C Most of Unix version 4 (1973) was re-written

in C from previous version, written entirely in assembly language. The C language was originally developed in order

to provide a high level language implementation of the Unix system by Dennis Ritchie

C evolved from 'B', developed by Ken Thompson.

Page 6: CE01000-3 Operating Systems Lecture 6 Overview of Unix/Linux operating systems

Early Advantages of Unix Written in a high-level language Distributed in source form Provided powerful operating-system

primitives that provided multi-user OS that would run on small mini-computers - inexpensive platforms

Small size, modular, clean design

Page 7: CE01000-3 Operating Systems Lecture 6 Overview of Unix/Linux operating systems

Educational involvement in development

Initially AT&T was unable to market Unix as a product, so source code was made available to universities for use in research and education.

A development group at the University of California at Berkeley were important in the development of Unix and produced a number of influential versions Known as Berkeley Software Distributions (BSD).

Page 8: CE01000-3 Operating Systems Lecture 6 Overview of Unix/Linux operating systems

BSD Unix

2 BSD : introduced text editor vi3 BSD : demand-paged virtual memory4.0BSD : major performance improvements –

funded by DARPA to develop standard Unix system for US government use

4.1BSD : job control, autoconfiguration

Page 9: CE01000-3 Operating Systems Lecture 6 Overview of Unix/Linux operating systems

BSD Unix (Cont.)

4.2/4.3BSD : developed for VAX architecture (important mini-computer architecture) - reliable signals, fast file system, improved networking (TCP/IP implementation), sophisticated IPC primitives

4.4 BSD : stackable and extensible vnode interface, network file system, log-structured file system, other file systems, POSIX support and other enhancements.

Page 10: CE01000-3 Operating Systems Lecture 6 Overview of Unix/Linux operating systems

Commercialisation Interactive Systems first commercial (1977) Microsoft and SCO collaborated to port Unix

to the Intel 8086 architecture: XENIX – ultimately unsuccessful as 8086 not powerful enough at the time to properly support multi-user OS

1982 Bill Joy left Berkeley and founded Sun Microsystems. SunOS originally based on BSD 4.2 SunOS 5 became Solaris OS

Page 11: CE01000-3 Operating Systems Lecture 6 Overview of Unix/Linux operating systems

Commercialisation (Cont.) In 1982 AT&T broken up and able to market

Unix. Released System III in 1982 and System V the following year.

System V UNIX introduced virtual memory (different implementation from BSD), IPC (shared memory, semaphores, message queues), remote file sharing, shared libraries and Streams.

Page 12: CE01000-3 Operating Systems Lecture 6 Overview of Unix/Linux operating systems

Commercialisation (Cont.) AIX from IBM HP/UX from Hewlett Packard Corporation ULTRIX from Digital Equipment

Corporation, followed by DEC OSF/1. DEC purchased by Compaq.

Page 13: CE01000-3 Operating Systems Lecture 6 Overview of Unix/Linux operating systems

Standard’s problem

Problem: Incompatible implementations of APIs and core service components across the different Unix variants. Software written for one version of Unix would not necessarily run on other versions.

Solution: Standard set of interfaces. Several standards exist that define the system call interface, shell and system utilities functions - both syntax and semantics (how it operates).

Page 14: CE01000-3 Operating Systems Lecture 6 Overview of Unix/Linux operating systems

Standard’s problem (Cont.) IEEE POSIX (Portable Operating System

Interface for Unix computing environments or portable OS for UNIX) specifications.

System V Interface Definition (SVID) from AT&T

X/Open Portability Guide (XPG) from the X/Open Consortium

Page 15: CE01000-3 Operating Systems Lecture 6 Overview of Unix/Linux operating systems

Linux origins

Linux is a modem, free operating system based on Unix standards.

First developed as a small but self-contained kernel in 1991 by Linus Torvalds, with the major design goal of Unix compatibility.

Its history has been one of collaboration by many users from all around the world.

Page 16: CE01000-3 Operating Systems Lecture 6 Overview of Unix/Linux operating systems

Linux origins (Cont.) It has been designed to run efficiently and

reliably on common PC hardware, but now also runs on a variety of other platforms.

The core Linux operating-system kernel is entirely original, but it can run most existing free Unix software, resulting in an entire Unix-compatible operating system free from proprietary code.

Page 17: CE01000-3 Operating Systems Lecture 6 Overview of Unix/Linux operating systems

The Linux Kernel

Version 0.01 (May 1991) had no networking, ran only on 80386-compatible Intel processors and on PC hardware, had extremely limited device-drive support, and supported only the Minix file system. Minix was a very simple version of a Unix like

OS that was developed for teaching purposes

Page 18: CE01000-3 Operating Systems Lecture 6 Overview of Unix/Linux operating systems

Linux Kernel (Cont.) Linux 1.0 (March 1994) included new features:

Support for Unix’s standard TCP/IP networking protocols

BSD-compatible socket interface for networking programming

Device-driver support for running IP over an Ethernet

Enhanced file system Support for a range of SCSI controllers for

high-performance disk access Extra hardware support

Page 19: CE01000-3 Operating Systems Lecture 6 Overview of Unix/Linux operating systems

Linux 2.0 2.0 added new capabilities:

Support for multiprocessor architectures Improved memory-management code Improved TCP/IP performance Support for internal kernel threads, for handling

dependencies between loadable modules, and for automatic loading of modules on demand.

Standardized configuration interface Available for Motorola 68000-series processors, Sun

Sparc systems, and for PC and PowerMac systems.

Page 20: CE01000-3 Operating Systems Lecture 6 Overview of Unix/Linux operating systems

Unix Design Principles Designed to be a time-sharing system Multiuser/multitasking Has a simple standard user interface (shell)

that can be replaced Toolbox approach

Combine multiple simple commands instead of using a single complex application

Designed by programmers for programmers

Page 21: CE01000-3 Operating Systems Lecture 6 Overview of Unix/Linux operating systems

Unix Design Principles (Cont.) File system with multilevel tree-structured

directories Files are supported by the kernel as unstructured

sequences of bytes Supports multiple processes; a process can easily

create new processes High priority given to making system interactive,

and providing facilities for program development

Page 22: CE01000-3 Operating Systems Lecture 6 Overview of Unix/Linux operating systems

Linux Design Principles Linux should be multi-user and multitasking with a

full set of Unix-compatible tools. Its file system should adhere to traditional Unix

semantics, and fully implement the standard Unix networking model.

Main goals are speed, efficiency, and standardisation.

Linux is designed to be compliant with the relevant POSIX standards

Page 23: CE01000-3 Operating Systems Lecture 6 Overview of Unix/Linux operating systems

Unix/Linux structure Essentially 2 layers – above and below kernel interface Above kernel interface (runs in user mode):

Shells System libraries System programs and utilities

Below kernel interface (in supervisory mode): System call interface Kernel itself – management of processes/threads, memory,

I/O, file system, device drivers

Page 24: CE01000-3 Operating Systems Lecture 6 Overview of Unix/Linux operating systems

Typical Unix Structure (4.4BSD)

Page 25: CE01000-3 Operating Systems Lecture 6 Overview of Unix/Linux operating systems

Linux System structure

system shared libraries

user utility processes

systemmanagement

programs

user processes

compilers

Linux kernel

loadable kernel modules

Page 26: CE01000-3 Operating Systems Lecture 6 Overview of Unix/Linux operating systems

Unix/Linux Components Unix/Linux have essentially similar set of

components. The kernel - everything below the system-call

interface and above the physical hardware. Provides file system, CPU scheduling, memory

management, and other OS functions through system calls.

Page 27: CE01000-3 Operating Systems Lecture 6 Overview of Unix/Linux operating systems

Unix/Linux Components (Cont.) Kernel code executes in system mode with full

access to all the physical resources of the computer.

All kernel code and data structures are kept in the same single address space.

This means every part of OS code/data structures is accessible from any other part of kernel

Page 28: CE01000-3 Operating Systems Lecture 6 Overview of Unix/Linux operating systems

Unix/Linux Components (Cont.) The system libraries define a standard set of

functions through which applications interact with the kernel, and which implement much of the operating-system functionality that does not need the full privileges of kernel code.

The system programs use the kernel-supported system calls to provide useful functions, such as compilation and file manipulation.

Page 29: CE01000-3 Operating Systems Lecture 6 Overview of Unix/Linux operating systems

Linux kernel modules

A feature introduced by Linux allows for the dynamic (at run-time) installation and removal of kernel components.

A kernel module is a section of kernel code that can be compiled, loaded, and unloaded independently of the rest of the kernel.

A kernel module may typically implement a device driver, a file system, or a networking protocol.

Page 30: CE01000-3 Operating Systems Lecture 6 Overview of Unix/Linux operating systems

Linux kernel modules (Cont.) Without kernel modules any change to kernel

code would require complete re-compilation of kernel.

The kernel module interface allows third parties to write and distribute, on their own terms, device drivers or file systems that could not be distributed free (under GPL which we will cover this in a later slide).

Page 31: CE01000-3 Operating Systems Lecture 6 Overview of Unix/Linux operating systems

Linux kernel modules (Cont.) Kernel modules allow a Linux system to be

set up with a standard, minimal kernel, without any extra device drivers built in. Linux can then allow additional modules to be loaded and integrated with the base system - tailored to underlying hardware and needs of system

Page 32: CE01000-3 Operating Systems Lecture 6 Overview of Unix/Linux operating systems

System call interface System calls define the programmer interface to

Unix The programmer and user interface define the

context that the kernel must support. Roughly three categories of system calls in Unix.

File manipulation (same system calls also support device manipulation)

Process control Information manipulation.

Page 33: CE01000-3 Operating Systems Lecture 6 Overview of Unix/Linux operating systems

File Manipulation A file is a sequence of bytes; the kernel does

not impose a structure on files. In Unix almost everything is represented by a

file Files are organized in tree-structured

directories. Directories are files that contain information

on how to find other files.

Page 34: CE01000-3 Operating Systems Lecture 6 Overview of Unix/Linux operating systems

File Manipulation (Cont.) Path name: identifies a file by specifying a

path through the directory structure to the file. Absolute path names start at root of file system Relative path names start at the current directory

System calls for basic file manipulation: create, open, read, write, close, unlink, trunc.

Page 35: CE01000-3 Operating Systems Lecture 6 Overview of Unix/Linux operating systems

Typical Unix/Linux type directory structure

/

bin etc lib usr dev tmp home

sh ls cat

passwd group

libc.so

bin man local

cs316

ttya null

egs msiegenkwalsh

binmail stuff

Page 36: CE01000-3 Operating Systems Lecture 6 Overview of Unix/Linux operating systems

Shells and Commands Shell – the user process which executes programs (it

is a command interpreter) Called a shell, because it surrounds the kernel The shell indicates its readiness to accept another

command by outputting a prompt and the user types a command on a single line

Examples Bourne shell (bash) C Shell (csh)

Page 37: CE01000-3 Operating Systems Lecture 6 Overview of Unix/Linux operating systems

Shells and Commands (Cont.) A typical command is an executable binary object

file The shell looks through the search path to find the

command executable file, which is then loaded and executed

The directories /bin and /usr/bin are almost always in the search path

The shell usually suspends its own execution until the command completes.

Page 38: CE01000-3 Operating Systems Lecture 6 Overview of Unix/Linux operating systems

Shells and Commands (Cont.) Programmers and users mainly deal with already

existing systems programs: the needed system calls are embedded within the program and do not need to be obvious to the user.

The most common systems programs are file or directory oriented e.g. mkdir, rmdir, cd, pwd, ls, cp, mv, rm

X Windows system provides basis for development of GUI interfaces

Page 39: CE01000-3 Operating Systems Lecture 6 Overview of Unix/Linux operating systems

Linux system specific Linux uses many tools developed as part of

Berkeley’s BSD operating system, MIT’s X Window System, and the Free Software Foundation’s GNU project.

The main system libraries were started by the GNU project, with improvements provided by the Linux community.

Page 40: CE01000-3 Operating Systems Lecture 6 Overview of Unix/Linux operating systems

Linux system specific (Cont.) Linux networking-administration tools were

derived from 4.3BSD code; recent BSD derivatives such as FreeBSD have borrowed code from Linux in return.

The Linux system is maintained by a loose network of developers.

Page 41: CE01000-3 Operating Systems Lecture 6 Overview of Unix/Linux operating systems

Linux Distributions Standard, precompiled sets of packages, or

distributions, include the Linux system kernel, system installation and management utilities, and ready-to-install packages of common Unix tools.

The first distributions managed these packages by simply providing a means of unpacking all the files into the appropriate places; modern distributions include advanced package management and automated installation.

Page 42: CE01000-3 Operating Systems Lecture 6 Overview of Unix/Linux operating systems

Linux Distributions (Cont.) Many distributions now available

Early distributions included Slackware. Red Hat is common distributions from a

commercial source. Ubuntu Debian Suse Many others

Page 43: CE01000-3 Operating Systems Lecture 6 Overview of Unix/Linux operating systems

Linux licensing The Linux kernel is distributed under the GNU

General Public License (GPL), the terms of which are set out by the Free Software Foundation.

Anyone using Linux, or creating their own derivate of Linux, may not make the derived product proprietary; software released under the GPL may not be redistributed as a binary-only product.

Page 44: CE01000-3 Operating Systems Lecture 6 Overview of Unix/Linux operating systems

References Operating System Concepts. Chapter 21 &

Appendix A.