0% found this document useful (0 votes)
10 views81 pages

Operating System Concepts Overview

The document provides an overview of operating system concepts, including their purpose, structure, and functions. It discusses key components such as process management, memory management, and storage management, as well as the architecture of computer systems and the role of the operating system as a resource allocator and control program. Additionally, it covers the importance of protection and security in operating systems and the various types of computing environments.

Uploaded by

Shana Apv
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views81 pages

Operating System Concepts Overview

The document provides an overview of operating system concepts, including their purpose, structure, and functions. It discusses key components such as process management, memory management, and storage management, as well as the architecture of computer systems and the role of the operating system as a resource allocator and control program. Additionally, it covers the importance of protection and security in operating systems and the various types of computing environments.

Uploaded by

Shana Apv
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

Module 1: Introduction

Operating System Concepts – 8th Edition Silberschatz, Galvin and Gagne ©2009
Objectives
 Fundamental understanding of the purpose, structure
and functions of operating system
 Key design issues of an Operating System

Operating System Concepts – 8th Edition 1.2 Silberschatz, Galvin and Gagne ©2009
Module 1: Introduction

Introduction:

Operating system overview Operations, Functions,


Service – System calls, Types – Operating System
structure - Simple structure, Layered approach,
Microkernel, Modules – System boot process.

Operating System Concepts – 8th Edition 1.3 Silberschatz, Galvin and Gagne ©2009
Objectives
 To provide a grand tour of the major operating systems
components
 To give an overview of the many types of computing
environments.
 To Describe the services an operating system provides
to users, processes, and other systems
 To discuss the various ways of structuring an operating
system
 Explain how operating systems are installed and
customized and how they boot

Operating System Concepts – 8th Edition 1.4 Silberschatz, Galvin and Gagne ©2009
What is an Operating System?

 A system software that manages the hardware and


acts as an intermediary between a user of a computer
and the computer hardware
 Provide basis for application program
 Provide a convenient environment in which user
programs can be executed in an efficient manner
 Operating system goals:
 Execute user programs and make solving user
problems easier
 Make the computer system convenient to use
 Use the computer hardware in an efficient manner

Operating System Concepts – 8th Edition 1.5 Silberschatz, Galvin and Gagne ©2009
Computer System Structure
 Computer system can be divided into four components:
 Hardware – provides basic computing resources
 CPU, memory, I/O devices
 Operating system
 Controls and coordinates use of hardware among
various applications for the various users
 Application programs – define the ways in which the
system resources are used to solve the computing
problems of the users
 Word processors, compilers, web browsers,
database systems, video games
 Users
 People, machines, other computers

Operating System Concepts – 8th Edition 1.6 Silberschatz, Galvin and Gagne ©2009
Four Components of a Computer System

Operating System Concepts – 8th Edition 1.7 Silberschatz, Galvin and Gagne ©2009
Functions of an Operating Systems
 Depends on the point of view
 Users want convenience, ease of use and good
performance
 Don’t care about resource utilization
 But shared computer such as mainframe or minicomputer
must keep all users happy
 Users of dedicate systems such as workstations have
dedicated resources but frequently use shared resources from
servers
 Handheld computers are resource poor, optimized for
usability and battery life
 Some computers have little or no user interface, such as
embedded computers in devices and automobiles
Operating System Concepts – 8th Edition 1.8 Silberschatz, Galvin and Gagne ©2009
Operating System – System view

 OS is a resource allocator
 Manages all resources
 Decides between conflicting requests for efficient
and fair resource use

 OS is a control program
 Controls execution of programs to prevent errors
and improper use of the computer

Operating System Concepts – 8th Edition 1.9 Silberschatz, Galvin and Gagne ©2009
Some important function of Operating
Systems
 Process management
 Memory management
 Storage management
 Device management
 File management
 Protection and Security

Operating System Concepts – 8th Edition 1.10 Silberschatz, Galvin and Gagne ©2009
Process Management
 A process is a program in execution. It is a unit of work within the
system. Program is a passive entity, process is an active entity.
 Process needs resources to accomplish its task
 CPU, memory, I/O, files
 Initialization data
 Process termination requires reclaim of any reusable resources
 Single-threaded process has one program counter specifying
location of next instruction to execute
 Process executes instructions sequentially, one at a time, until
completion
 Multi-threaded process has one program counter per thread
 Typically system has many processes, some user, some operating
system running concurrently on one or more CPUs
 Concurrency by multiplexing the CPUs among the processes /
threads

Operating System Concepts – 8th Edition 1.11 Silberschatz, Galvin and Gagne ©2009
Process Management Activities

The operating system is responsible for the following


activities in connection with process management:
 Scheduling process and threads on the CPUs
 Creating and deleting both user and system processes
 Suspending and resuming processes
 Providing mechanisms for process synchronization
 Providing mechanisms for process communication
 Providing mechanisms for deadlock handling

Operating System Concepts – 8th Edition 1.12 Silberschatz, Galvin and Gagne ©2009
Memory Management
 All data in memory before and after processing
 All instructions in memory in order to execute
 Memory management determines what is in memory
when
 Optimizing CPU utilization and computer
response to users
 Memory management activities
 Keeping track of which parts of memory are
currently being used and by whom
 Deciding which processes (or parts thereof) and
data to move into and out of memory
 Allocating and deallocating memory space as
needed
Operating System Concepts – 8th Edition 1.13 Silberschatz, Galvin and Gagne ©2009
Storage Management
 OS provides uniform, logical view of information storage

Abstracts physical properties to logical storage unit - file
 File-System management
 Store information on different media
 Each medium is controlled by device (i.e., disk drive, tape
drive)
 Varying properties include access speed, capacity, data-
transfer rate, access method (sequential or random)
 Files usually organized into directories
 Access control on most systems to determine who can
access what
 OS activities include
 Creating and deleting files
 Creating and deleting directories to organize files
 Supporting Primitives to manipulate files and dirs
 Mapping files onto secondary storage
 Backup files onto stable (non-volatile) storage media
Operating System Concepts – 8th Edition 1.14 Silberschatz, Galvin and Gagne ©2009
Mass-Storage Management
 Usually disks used to store data that does not fit in main
memory or data that must be kept for a “long” period of time
 Proper management is of central importance
 Entire speed of computer operation hinges on disk subsystem
and its algorithms
 OS activities
 Free-space management
 Storage allocation
 Disk scheduling
 Some storage need not be fast
 Tertiary storage includes optical storage, magnetic tape
 Still must be managed – by OS or applications
 Varies between WORM (write-once, read-many-times) and
RW (read-write)

Operating System Concepts – 8th Edition 1.15 Silberschatz, Galvin and Gagne ©2009
Caching
 Information normally kept in main memory
 Faster memory- cache- information copied into cache on
temporary basis
 Programmable registers such as Index register provide a high
speed cache
 Instruction cache -hold instruction expected to be executed
next
 Most systems have one or more high speed cache in memory
 Cache have limited size-cache management is important

Operating System Concepts – 8th Edition 1.16 Silberschatz, Galvin and Gagne ©2009
Performance of Various Levels of Storage

 Movement between levels of storage hierarchy can be explicit or


implicit

Operating System Concepts – 8th Edition 1.17 Silberschatz, Galvin and Gagne ©2009
Migration of Integer A from Disk to Register

 Multitasking environments must be careful to use most recent value, no


matter where it is stored in the storage hierarchy

 Multiprocessor environment must provide cache coherency in hardware


such that all CPUs have the most recent value in their cache

 Distributed environment situation even more complex


 Several copies of a datum can exist

Operating System Concepts – 8th Edition 1.18 Silberschatz, Galvin and Gagne ©2009
I/O Subsystem
 One purpose of OS is to hide peculiarities of hardware devices
from the user

 I/O subsystem responsible for


 Memory management of I/O including buffering (storing data
temporarily while it is being transferred), caching (storing
parts of data in faster storage for performance), spooling
(the overlapping of output of one job with input of other jobs)
 General device-driver interface
 Drivers for specific hardware devices

Operating System Concepts – 8th Edition 1.19 Silberschatz, Galvin and Gagne ©2009
Protection and Security
 Protection – any mechanism for controlling access of
processes or users to resources defined by the OS
 Security – defense of the system against internal and external
attacks
 Huge range, including denial-of-service, worms, viruses,
identity theft, theft of service
 Systems generally first distinguish among users, to determine
who can do what
 User identities (user IDs, security IDs) include name and
associated number, one per user
 User ID then associated with all files, processes of that
user to determine access control
 Group identifier (group ID) allows set of users to be
defined and controls managed, then also associated with
each process, file
 Privilege escalation allows user to change to effective ID
with more rights
Operating System Concepts – 8th Edition 1.20 Silberschatz, Galvin and Gagne ©2009
Computer-System Architecture
 Single-Processor Systems
 Multiprocessor Systems
 Clustered Systems

Operating System Concepts – 8th Edition 1.21 Silberschatz, Galvin and Gagne ©2009
Computer-System Architecture
 Most systems use a single general-purpose processor (PDAs
through mainframes)
 Most systems have special-purpose processors as well
 Multiprocessors systems growing in use and importance
 Also known as parallel systems, tightly-coupled systems
 Advantages include:
1. Increased throughput
2. Economy of scale
3. Increased reliability –
graceful degradation - ability to continue providing services
proportional to the level of surviving hardware
or fault tolerance – can suffer a failure of any single
component and still continue operation

Operating System Concepts – 8th Edition 1.22 Silberschatz, Galvin and Gagne ©2009
Symmetric Multiprocessing Architecture

 Two types:
1. Asymmetric Multiprocessing
2. Symmetric Multiprocessing

Operating System Concepts – 8th Edition 1.23 Silberschatz, Galvin and Gagne ©2009
A Dual-Core Design

Operating System Concepts – 8th Edition 1.24 Silberschatz, Galvin and Gagne ©2009
Blade server
 Recent development
 Multiple processor boards, I/O boards and networking boards are
placed in same chasis.
 Blade server boots independently and runs its own OS

Operating System Concepts – 8th Edition 1.25 Silberschatz, Galvin and Gagne ©2009
Clustered Systems
 Like multiprocessor systems, but multiple systems working together
 Clustered computer share storage and closely linked via LAN
 Usually sharing storage via a storage-area network (SAN)
 Provides a high-availability service which survives failures
 Asymmetric clustering has one machine in hot-standby
mode
 Symmetric clustering has multiple nodes running
applications, monitoring each other
 Some clusters are for high-performance computing (HPC)
 Applications must be written to use parallelization
• Some have distributed lock manager (DLM) to avoid conflicting
operations

Operating System Concepts – 8th Edition 1.26 Silberschatz, Galvin and Gagne ©2009
Clustered Systems

Operating System Concepts – 8th Edition 1.27 Silberschatz, Galvin and Gagne ©2009
Operating System Structure
 Multiprogramming needed for efficiency
 Single user cannot keep CPU and I/O devices busy at all times
 Multiprogramming organizes jobs (code and data) so CPU always
has one to execute
 A subset of total jobs in system is kept in memory
 One job selected and run via job scheduling
 When it has to wait (for I/O for example), OS switches to another job
 Timesharing (multitasking) is logical extension in which CPU switches
jobs so frequently that users can interact with each job while it is
running, creating interactive computing
 Response time should be < 1 second
 Each user has at least one program executing in memory -process
 If several jobs ready to run at the same time - CPU scheduling
 If processes don’t fit in memory, swapping moves them in and out
to run
 Virtual memory allows execution of processes not completely in
memory

Operating System Concepts – 8th Edition 1.28 Silberschatz, Galvin and Gagne ©2009
Memory Layout for Multiprogrammed System

Operating System Concepts – 8th Edition 1.29 Silberschatz, Galvin and Gagne ©2009
Operating-System Operations
 Interrupt driven by hardware
 Software error or request creates exception or trap

Division by zero, request for operating system service
 Other process problems include infinite loop, processes modifying
each other or the operating system
 Dual-mode operation allows OS to protect itself and other system
components
 User mode and kernel mode
 Mode bit provided by hardware
 Provides ability to distinguish when system is running user
code or kernel code
 Some instructions designated as privileged, only executable
in kernel mode
 System call changes mode to kernel, return from call resets it
to user

Operating System Concepts – 8th Edition 1.30 Silberschatz, Galvin and Gagne ©2009
Dual mode operation-Transition from
User to Kernel Mode
 System call provide means for a user program to ask the operating
system to perform tasks reserved for he operating system

Operating System Concepts – 8th Edition 1.31 Silberschatz, Galvin and Gagne ©2009
Timer
 Timer to prevent infinite loop / process hogging
resources
 Set interrupt after specific period
 Operating system decrements counter
 When counter zero generate an interrupt
 Set up before scheduling process to regain control
or terminate program that exceeds allotted time

Operating System Concepts – 8th Edition 1.32 Silberschatz, Galvin and Gagne ©2009
Operating System Services
 Operating systems provide an environment for execution of
programs and services to programs and users
 One set of operating-system services provides functions that are
helpful to the user:
 User interface - Almost all operating systems have a user
interface (UI).
 Varies between Command-Line (CLI), Graphics User
Interface (GUI), Batch
 Program execution - The system must be able to load a
program into memory and to run that program, end
execution, either normally or abnormally (indicating error)
 I/O operations - A running program may require I/O, which
may involve a file or an I/O device

Operating System Concepts – 9th Edition 2.33 Silberschatz, Galvin and Gagne ©2013
Operating System Services (Cont.)
 One set of operating-system services provides functions that are helpful to
the user (Cont.):
 File-system manipulation - The file system is of particular interest.
Programs need to read and write files and directories, create and delete
them, search them, list file Information, permission management.
 Communications – Processes may exchange information, on the same
computer or between computers over a network
 Communications may be via shared memory or through message
passing (packets moved by the OS)
 Error detection – OS needs to be constantly aware of possible errors
 May occur in the CPU and memory hardware, in I/O devices, in user
program
 For each type of error, OS should take the appropriate action to
ensure correct and consistent computing
 Debugging facilities can greatly enhance the user’s and programmer’s
abilities to efficiently use the system

Operating System Concepts – 9th Edition 2.34 Silberschatz, Galvin and Gagne ©2013
Operating System Services (Cont.)
 Another set of OS functions exists for ensuring the efficient operation
of the system itself via resource sharing
 Resource allocation - When multiple users or multiple jobs
running concurrently, resources must be allocated to each of them
 Many types of resources - CPU cycles, main memory, file
storage, I/O devices.
 Accounting - To keep track of which users use how much and
what kinds of computer resources
 Protection and security - The owners of information stored in a
multiuser or networked computer system may want to control use
of that information, concurrent processes should not interfere with
each other
 Protection involves ensuring that all access to system
resources is controlled
 Security of the system from outsiders requires user
authentication, extends to defending external I/O devices from
invalid access attempts

Operating System Concepts – 9th Edition 2.35 Silberschatz, Galvin and Gagne ©2013
A View of Operating System Services

Operating System Concepts – 9th Edition 2.36 Silberschatz, Galvin and Gagne ©2013
User Operating System Interface - CLI

CLI or command interpreter allows direct command entry


 Sometimes implemented in kernel, sometimes by systems
program
 Command interpreter - Shell
 Sometimes multiple command interpreters
 Primarily fetches a command from user and executes it
 Sometimes commands built-in, sometimes just names of
programs
 If the latter, adding new features doesn’t require shell
modification

Operating System Concepts – 9th Edition 2.37 Silberschatz, Galvin and Gagne ©2013
User Operating System Interface - GUI

 User-friendly desktop metaphor interface


 Usually mouse based window and menu system
 Icons represent files, programs, actions, etc
 Various mouse buttons over objects in the interface
cause various actions (provide information, options,
execute function, open directory (known as a folder)
 Invented at Xerox PARC
 Many systems now include both CLI and GUI interfaces
 Microsoft Windows is GUI with CLI “command” shell
 Apple Mac OS X is “Aqua” GUI interface with UNIX
kernel underneath and shells available
 Unix and Linux have CLI with optional GUI interfaces
(CDE, KDE, GNOME)

Operating System Concepts – 9th Edition 2.38 Silberschatz, Galvin and Gagne ©2013
Touchscreen Interfaces

 Touchscreen devices require


new interfaces
 Mouse not possible or not
desired
 Actions and selection based
on gestures
 Virtual keyboard for text
entry
 Voice commands.

Operating System Concepts – 9th Edition 2.39 Silberschatz, Galvin and Gagne ©2013
Choice of interface
 Mostly personal preference
 CLI – system administrators and power users
 CLI – fast access, make repetitive task easier
 GUI – subset of system function is available

Operating System Concepts – 9th Edition 2.40 Silberschatz, Galvin and Gagne ©2013
System Calls
 Programming interface to the services
provided by the OS
 Typically written in a high-level language (C
or C++)
 Mostly accessed by programs via a high-
level Application Programming Interface
(API) rather than direct system call use
 Three most common APIs are Win32 API
for Windows, POSIX API for POSIX-based
systems (including virtually all versions of
UNIX, Linux, and Mac OS X), and Java API
for the Java virtual machine (JVM)

Operating System Concepts – 9th Edition 2.41 Silberschatz, Galvin and Gagne ©2013
Example of System Calls

 System call sequence to copy the contents of one file to another file

Operating System Concepts – 9th Edition 2.42 Silberschatz, Galvin and Gagne ©2013
Example of Standard API

Operating System Concepts – 9th Edition 2.43 Silberschatz, Galvin and Gagne ©2013
System Call Implementation
 Typically, a number associated with each system call
 System-call interface maintains a table indexed
according to these numbers
 The system call interface invokes the intended system call
in OS kernel and returns status of the system call and any
return values
 The caller need know nothing about how the system call is
implemented
 Just needs to obey API and understand what OS will do
as a result call
 Most details of OS interface hidden from programmer
by API
 Managed by run-time support library (set of functions
built into libraries included with compiler)

Operating System Concepts – 9th Edition 2.44 Silberschatz, Galvin and Gagne ©2013
API – System Call – OS Relationship

Operating System Concepts – 9th Edition 2.45 Silberschatz, Galvin and Gagne ©2013
System Call Parameter Passing
 Often, more information is required than simply identity of
desired system call
 Exact type and amount of information vary according to
OS and call
 Three general methods used to pass parameters to the OS
 Simplest: pass the parameters in registers
 In some cases, may be more parameters than
registers
 Parameters stored in a block, or table, in memory, and
address of block passed as a parameter in a register
 This approach taken by Linux and Solaris
 Parameters placed, or pushed, onto the stack by the
program and popped off the stack by the operating
system
 Block and stack methods do not limit the number or
length of parameters being passed

Operating System Concepts – 9th Edition 2.46 Silberschatz, Galvin and Gagne ©2013
Parameter Passing via Table

Operating System Concepts – 9th Edition 2.47 Silberschatz, Galvin and Gagne ©2013
Types of System Calls
 Process control
 File manipulation
 Device manipulation
 Information maintenance
 Communications
 Protection

Operating System Concepts – 9th Edition 2.48 Silberschatz, Galvin and Gagne ©2013
Types of System Calls
 Process control
 create process, terminate process
 end, abort
 load, execute
 get process attributes, set process attributes
 wait for time
 wait event, signal event
 allocate and free memory
Dump memory if error
Debugger for determining bugs, single step execution
Locks for managing access to shared data between processes

Operating System Concepts – 9th Edition 2.49 Silberschatz, Galvin and Gagne ©2013
Types of System Calls

 File management
 create file, delete file
 open, close file
 read, write, reposition
 get and set file attributes
 Device management
 request device, release device
 read, write, reposition
 get device attributes, set device attributes
 logically attach or detach devices

Operating System Concepts – 9th Edition 2.50 Silberschatz, Galvin and Gagne ©2013
Types of System Calls (Cont.)

 Information maintenance
 get time or date, set time or date
 get system data, set system data
 get and set process, file, or device attributes
 Communications
 create, delete communication connection
 send, receive messages if message passing model to
host name or process name
 From client to server
 Shared-memory model create and gain access to
memory regions
 transfer status information
 attach and detach remote devices

Operating System Concepts – 9th Edition 2.51 Silberschatz, Galvin and Gagne ©2013
Types of System Calls (Cont.)

 Protection
 Control access to resources
 Get and set permissions
 Allow and deny user access

Operating System Concepts – 9th Edition 2.52 Silberschatz, Galvin and Gagne ©2013
Examples of Windows and Unix System Calls

Operating System Concepts – 9th Edition 2.53 Silberschatz, Galvin and Gagne ©2013
Standard C Library Example
 C program invoking printf() library call, which calls write()
system call

Operating System Concepts – 9th Edition 2.54 Silberschatz, Galvin and Gagne ©2013
Example: MS-DOS

 Single-tasking
 Shell invoked when
system booted
 Simple method to run
program
 No process created
 Single memory space
 Loads program into
memory, overwriting all
but the kernel
 Program exit -> shell
reloaded
At system startup running a program

Operating System Concepts – 9th Edition 2.55 Silberschatz, Galvin and Gagne ©2013
Example: FreeBSD
 Unix variant
 Multitasking
 User login -> invoke user’s choice of
shell
 Shell executes fork() system call to
create process
 Executes exec() to load program
into process
 Shell waits for process to
terminate or continues with user
commands
 Process exits with:
 code = 0 – no error
 code > 0 – error code

Operating System Concepts – 9th Edition 2.56 Silberschatz, Galvin and Gagne ©2013
Operating System Design and Implementation
 Design and Implementation of OS not “solvable”, but some
approaches have proven successful
 Internal structure of different Operating Systems can vary
widely
 Start the design by defining goals and specifications
 Affected by choice of hardware, type of system
 User goals and System goals
 User goals – operating system should be convenient to
use, easy to learn, reliable, safe, and fast
 System goals – operating system should be easy to
design, implement, and maintain, as well as flexible,
reliable, error-free, and efficient

Operating System Concepts – 9th Edition 2.57 Silberschatz, Galvin and Gagne ©2013
Operating System Design and Implementation (Cont.)

 Important principle to separate


Policy: What will be done?
Mechanism: How to do it?
 Mechanisms determine how to do something, policies
decide what will be done
 The separation of policy from mechanism is a very
important principle, it allows maximum flexibility if policy
decisions are to be changed later (example – timer)
 Specifying and designing an OS is highly creative task of
software engineering

Operating System Concepts – 9th Edition 2.58 Silberschatz, Galvin and Gagne ©2013
Implementation

 Much variation
 Early OS in assembly language
 Then system programming languages like Algol, PL/1
 Now C, C++
 Actually usually a mix of languages
 Lowest levels in assembly
 Main body in C
 Systems programs in C, C++, scripting languages like
PERL, Python, shell scripts
 HLL –code can be written faster, more compact, easier to
understand and debug
 high-level language easier to port to other hardware
 But slower, increased storage space

Operating System Concepts – 9th Edition 2.59 Silberschatz, Galvin and Gagne ©2013
Operating System Structure
 General-purpose OS is very large program
 Various ways to structure ones
 Simple structure – MS-DOS
 Monolithic structure -- UNIX
 Layered – an abstraction
 Microkernel –Mach
 Modules
 Hybrid systems

Operating System Concepts – 9th Edition 2.60 Silberschatz, Galvin and Gagne ©2013
Simple Structure -- MS-DOS

 MS-DOS – written to provide


the most functionality in the
least space
 Not divided into modules
 Although MS-DOS has
some structure, its
interfaces and levels of
functionality are not well
separated

Operating System Concepts – 9th Edition 2.61 Silberschatz, Galvin and Gagne ©2013
Monolithic Structure -- UNIX

UNIX – limited by hardware functionality, the original UNIX


operating system had limited structuring. The UNIX OS
consists of two separable parts
 Systems programs
 The kernel
 Consists of everything below the system-call interface
and above the physical hardware
 Provides the file system, CPU scheduling, memory
management, and other operating-system functions; a
large number of functions for one level
 Difficult to implement and maintain

Operating System Concepts – 9th Edition 2.62 Silberschatz, Galvin and Gagne ©2013
Traditional UNIX System Structure
Beyond simple but not fully layered

Operating System Concepts – 9th Edition 2.63 Silberschatz, Galvin and Gagne ©2013
Layered Approach
 The operating system is
divided into a number of
layers (levels), each built on
top of lower layers. The
bottom layer (layer 0), is the
hardware; the highest (layer
N) is the user interface.
 With modularity, layers are
selected such that each
uses functions (operations)
and services of only lower-
level layers

Operating System Concepts – 9th Edition 2.64 Silberschatz, Galvin and Gagne ©2013
Layered Approach
• Advantages
• The main advantage of the layered approach is
modularity.- simplicity of construction
• Each layers are independent, so debugging is simple
• Independent error checking is possible
• Design and implementation are simplified when the
system is broken down into layers.
• Each layer hides the existence of certain data
structures, operations, and hardware from higher-
level layers.

Operating System Concepts – 9th Edition 2.65 Silberschatz, Galvin and Gagne ©2013
Layered Approach
• Disadvantages
• appropriately defining the various layers.
• It is a difficult task to define the functions of each layer. Any Layer can
access only the layer below it.(Layer 1 - Layer 0)
• Less efficient because when user give a request, that process
is passes through each layer. So more time is consumed.

Operating System Concepts – 9th Edition 2.66 Silberschatz, Galvin and Gagne ©2013
Microkernel System Structure
 Moves as much from the kernel into user space
 Mach example of microkernel
 Mac OS X kernel (Darwin) partly based on Mach
 Communication takes place between user modules
using message passing
 Benefits:
 Easier to extend a microkernel
 Easier to port the operating system to new
architectures
 More reliable (less code is running in kernel mode)
 More secure
 Detriments:
 Performance overhead of user space to kernel space
communication

Operating System Concepts – 9th Edition 2.67 Silberschatz, Galvin and Gagne ©2013
Microkernel System Structure

Operating System Concepts – 9th Edition 2.68 Silberschatz, Galvin and Gagne ©2013
Modules
 Many modern operating systems implement loadable
kernel modules
 Uses object-oriented approach
 Each core component is separate
 Each talks to the others over known interfaces
 Each is loadable as needed within the kernel
 Overall, similar to layers but with more flexible
 Linux, Solaris, etc

Operating System Concepts – 9th Edition 2.69 Silberschatz, Galvin and Gagne ©2013
Solaris Modular Approach

Operating System Concepts – 9th Edition 2.70 Silberschatz, Galvin and Gagne ©2013
Hybrid Systems
 Most modern operating systems are actually not one pure model
 Hybrid combines multiple approaches to address
performance, security, usability needs
 Linux and Solaris kernels in kernel address space, so
monolithic, plus modular for dynamic loading of functionality
 Windows mostly monolithic, plus microkernel for different
subsystem personalities

Operating System Concepts – 9th Edition 2.71 Silberschatz, Galvin and Gagne ©2013
Kernel and Shell

• Kernel : is the central part of the OS


• Translating the commands that can be understand by
computer
• Main aim – manage communication between software and
hardware
• which is running all the time.
• Responsible for maintaining all the important abstractions of
OS.
• Placed at the lowest level just above the CPU/Hardware.

Operating System Concepts – 9th Edition 2.72 Silberschatz, Galvin and Gagne ©2013
Kernel and Shell

• Shell : Unix command interpreter-a computer program that


interface between user and the unix like OS.
• Not a part of OS.
• Makes use of OS features
• has a terminal as standard input and output.
• Interface between the user and OS/kernel.
• Shell starts up when user logs in.
• Starts out by the prompt eg: $,# indicate that the shell is
waiting to accept a command.

Operating System Concepts – 9th Edition 2.73 Silberschatz, Galvin and Gagne ©2013
System Boot
 When power initialized on system, execution starts at a fixed
memory location
 Firmware ROM used to hold initial boot code
 Operating system must be made available to hardware so
hardware can start it
 Small piece of code – bootstrap loader, stored in ROM
or EEPROM locates the kernel, loads it into memory, and
starts it
 Sometimes two-step process where boot block at fixed
location loaded by ROM code, which loads bootstrap
loader from disk
 Common bootstrap loader, GRUB, allows selection of kernel
from multiple disks, versions, kernel options
 Kernel loads and system is then running

Operating System Concepts – 9th Edition 2.74 Silberschatz, Galvin and Gagne ©2013
System Boot

-Booting- procedure of starting a computer by loading the


kernel.
- Bootstrap pgm/loader locate the kernel help it to load into
the memory thus start the OS. It is a small piece of code.
Hardware doesn't know how to load kernel into memory.
- On most computer systems, a small piece of code known as
bootstrap program or bootstrap loader locates the kernel,
loads it into the main memory and starts it’s execution.
- Some, compiler systems, such as PCs use a two step process in
which a simple bootstrap loader fetches a more complex boot
program from the disk, which in turn loads the kernel.

Operating System Concepts – 9th Edition 2.75 Silberschatz, Galvin and Gagne ©2013
System Boot

• when CPU receives a reset event, (when it is powered up or


rebooted) the instruction register is loaded with a predefined
memory location and execution starts there. At that location
is the initial bootstrap program. This program is in the form
of ROM. ROM is convenient because it needs no initialization
and cannot easily be affected by computer viruses. [ROM is
always active that is why it doesn't need initialization]. If
there is a virus some manipulations occur but since ROM is
read only nothing happens.
• bootstrap program can run a variety of tasks, such as run
diagnostics to determine the state of the machine. If
diagnostics pass, program can continue with booting steps.
• ROM is always ready it has it's contents on it even while
powered off, bootstrap program is always in the ROM
because it must be in a consistent state.

Operating System Concepts – 9th Edition 2.76 Silberschatz, Galvin and Gagne ©2013
System Boot
• bootstrap loader can also initialize all aspects of the system,
from CPU registers to device controllers and the contents of
the main memory, then it starts the OS.
• Some systems – eg: cellular phones, tablets store entire OS
and bootstrap loader in ROM. This is suitable for small OS,
simple supporting hardware.
• Disadvantage of this approach is that changing bootstrap
code requires changing the ROM hardware chips. This
problem is solved Erasable Programmable Read Only Memory
[EPROM]. This is also a kind of ROM but by giving an explicit
command, we can make it writable. So this technique can be
used in small devices.
• when the full bootstrap program has been loaded, it can
traverse the file system to find the OS kernel, load it into the
memory and start it's execution. it is only at this point that
the system is said to be running.

Operating System Concepts – 9th Edition 2.77 Silberschatz, Galvin and Gagne ©2013
System Boot

• booting stage

• running stage
1. boot up the system [bootstrap loader helps]
2. once bootstrap loader locates kernel.
3. loads it into the memory.
4. starts execution.
5. system is running.

Operating System Concepts – 9th Edition 2.78 Silberschatz, Galvin and Gagne ©2013
PC Boot and Linux Init Process
 BIOS: The Basic Input/Output System is the lowest level interface
between the computer and peripherals.
The BIOS performs integrity checks on memory and seeks
instructions on the Master Boot Record (MBR) on the floppy drive or
hard drive.
 The MBR points to the boot loader (GRUB or LILO: Linux boot
loader).
 Boot loader (GRUB or LILO) will then ask for the OS label which will
identify which kernel to run and where it is located (hard drive and
partition specified). The installation process requires to
creation/identification of partitions and where to install the OS.
GRUB/LILO are also configured during this process. The boot
loader then loads the Linux operating system.

Operating System Concepts – 9th Edition 2.79 Silberschatz, Galvin and Gagne ©2013
PC Boot and Linux Init Process
 The first thing the kernel does is to execute init program. Init is the
root/parent of all processes executing on Linux.
 The first processes that init starts is a script /etc/rc.d/[Link]
 Based on the appropriate run-level, scripts are executed to start
various processes to run the system and make it functional.

Operating System Concepts – 9th Edition 2.80 Silberschatz, Galvin and Gagne ©2013
End of Module 1

Operating System Concepts – 9th Edition 2.81 Silberschatz, Galvin and Gagne ©2013

You might also like