Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

CS211 Lec 4

Download as pdf or txt
Download as pdf or txt
You are on page 1of 32

Operating Systems

Course Code: CS211


Instructor: Dr. Sarah Iqbal

Lecture # 4
Agenda for Today
 Review of previous lecture
 Linkers and Loaders
 Computing Environments
 Operating system design and implementation
 Operating system structures
 UNIX/Linux directory structure
 Useful UNIX/Linux commands
Linkers and Loaders
 Usually, a program resides on disk as a binary executable
file—for example, a.out or prog.exe.
 To run on a CPU, the program must be brought into memory
and placed in the context of a process.
Linkers and Loaders
Computing Environments
 Traditional Computing
 Mobile Computing
 Client‐Server Computing
 Peer‐to‐Peer Computing
 Cloud Computing
 Real‐Time Embedded Systems
System Design and Implementation
 Design Goals
 User Goals: operating system should be convenient to
use, easy to learn, reliable, safe, and fast.
 System designer and administrator Goals: operating
system should be easy to design, implement, and
maintain, as well as flexible, reliable, error‐free, and
efficient.
System Design and Implementation …
 Mechanism: determine how to do something
 Policy: determine what will be done
 Separation of mechanism and policy is important for
flexibility.
System Design and Implementation …
Implementation: operating systems are collections of many
programs, written by many people over a long period of
time, it is difficult to make general statements about how
they are implemented.
 Assembly language (early operating systems)
 Advantages of Higher level languages
 Easier to code
 Compact code
 Easier to port
Operating System Structures
 A system as large and complex as a modern operating
system must be engineered carefully if it is to function
properly and be modified easily.
 A common approach is to partition the task into small
components, or modules, rather than have one single
system.
 Each of these modules should be a well‐defined portion of
the system, with carefully defined interfaces and functions.
Operating System Structures…
Operating System Structures…
 Monolithic Structure
 Layered Approach
 Microkernels
 Modules
 Hybrid Systems
Monolithic Structure
 The simplest structure for organizing an operating system is
no structure at all.
 All of the functionality of the kernel into a single, static
binary file that runs in a single address space.
 It is a common technique for designing operating systems.
 An example of such limited structuring is the original UNIX
operating system, which consists of two separable parts: the
kernel and the system programs. The kernel is further
separated into a series of interfaces and device drivers,
which have been added and expanded over the years as
UNIX has evolved.
Monolithic Structure
Layered Approach
 This system is divided into separate, smaller components that have specific
and limited functionality.
 All these components together comprise the kernel.
 The OS is broken up into a number of layers
 The advantage of this modular approach is that changes in one component
affect only that component, and no others, allowing system implementers
more freedom in creating and changing the inner workings of the system.
 A system can be made modular in many ways. One method is the layered
approach, in which the operating system is broken into a number of layers
(levels).
 Bottom layer is hardware and the topmost layer ( layer N) is the user
interface
 A typical layer consists of data structures and a set of routines to service
the layer above it
 THE operating system by Dijkstra
Layered Approach …
Layered Approach …
 Modularity
 Each layer uses functions and services of only lower
layers
 Simplifies debugging and system verification.
 The major difficulty with layered approach is careful
definition of layers, because a layer can only use the
layers below it
 Less efficient than other approaches
Microkernel
 Structures the operating system by removing all non‐
essential components from the kernel and
implementing them as system and user level programs
 Smaller kernel
 Main function is to provide a communication facility
between client programs and the various services that
are also running in the user space.
Microkernel …
 Easier to extend the OS—new services are added to user
space and consequently do not require modification of the
kernel and/or its recompilation
 Easier to maintain operating system code (enhancement,
debugging, etc.)
 OS is easier to port from one hardware to another
 More security and reliability
 In the mid‐1980s, researchers at Carnegie Mellon University
developed an operating system called Mach that
modularized the kernel using the microkernel approach.
 Mach, MacOS X Server, QNX, and Windows NT
Microkernel …
Modules
 The best current methodology for operating‐system design
involves using loadable kernel modules (LKMs).
 Here, the kernel has a set of core components and can link
in additional services via modules, either at boot time or
during run time.
 This type of design is common in modern implementations
of UNIX, such as Linux, macOS, and Solaris, as well as
Windows.
Hybrid Systems
 In practice, very few operating systems adopt a single, strictly
defined structure.
 Instead, they combine different structures, resulting in hybrid
systems that address performance, security, and usability issues.
 For example, Linux is monolithic, because having the operating
system in a single address space provides very efficient
performance.
 However, it also modular, so that new functionality can be
dynamically added to the kernel.
 Windows is largely monolithic as well, but it retains some
behavior typical of microkernel systems, including providing
support for separate subsystems that run as user‐mode processes
Virtual Machines
 CPU scheduling and virtual memory techniques used to
emulate hardware of the underlying machine, on which
user can install an operating system that the virtual
machine supports
 On a time‐sharing system with virtual machine support,
users may be working on different operating systems
 Pioneered by IBM VM operating system that ran CMS, a
single‐user interactive operating system
Virtual Machines …
 Difficult to implement.
 System development done without disrupting normal
system operation.
Virtual Machines …
Introduction to UNIX and Linux
 Written by Dennis Ritchie and Ken Thomsom in at Bell
Labs in 1969
 Initially written in assembly language and a high‐level
language called B. Later converted from B to C language.
 Linux written by Linus Torvalds (an undergraduate
student at the Univ. of Helsinki, Finland) in 1991.
 Most popular operating systems
 Internet runs on UNIX and Linux
UNIX/Linux File System
 UNIX has a hierarchical file system structure consisting
of a root directory with other directories and files
hanging under it
 In a command‐line user interface, typed commands are
used to navigate the system
 Directories and files are specified by filenames
• cs211/assignments/assign1.c
• /home/students/ali/courses/cs211
Browsing Directory Structure
/ The root directory is the directory that contains
all other directories. When a directory structure is
displayed as a tree, the root directory is at the
top.

/bin This directory holds binary executable files that


are essential for correct operation of the system

/boot This directory includes essential system boot files


including the kernel image .
Browsing Directory Structure …
/dev This directory contains the devices available to
on the machine

/etc Linux uses this directory to store system


configuration files
/home This is where every user on a Linux system has a
personal directory
/lib Shared libraries and kernel modules are stored
in this directory
Browsing Directory Structure …

/root The home directory for the superuser


/sbin Utilities used for system administration (halt,
ifconfig, fdisk, etc.) are stored in this directory
/tmp Used for storing temporary files. Similar to
C:\Windows\Temp.
Browsing Directory Structure …

/usr Typically a shareable, read‐only directory.


Contains user applications and supporting
files for those applications.
/var This directory contains variable data files
such as logs (/var/log), mail (/var/mail), and
spools (/var/spool) among other things.
UNIX/Linux Directory Hierarchy
Reference & Reading Material
Operating Systems Concepts, by ABRAHAM SILBERSCHATZ
• Chapter 1: Introduction

Section 1.7 Virtualization


Section 1.10 Computing Environments
• Chapter 2: Operating System Structures

Section 2.5 Linkers and Loaders


Section 2.7 Operating‐System Design and Implementation
Section 2.8 Operating‐System Structure

You might also like