0% found this document useful (0 votes)
4 views

Unit 01 - Introduction - Structures

The document provides an overview of operating systems, detailing their components, definitions, goals, and design issues such as efficiency, robustness, flexibility, portability, security, and compatibility. It discusses the structure of computer systems, including hardware, operating systems, application programs, and users, as well as the services provided by operating systems and the types of system calls. Additionally, it highlights the differences between uniprocessor and multiprocessor systems, emphasizing the benefits of multiprocessor systems and the importance of fault tolerance.

Uploaded by

sarora203
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Unit 01 - Introduction - Structures

The document provides an overview of operating systems, detailing their components, definitions, goals, and design issues such as efficiency, robustness, flexibility, portability, security, and compatibility. It discusses the structure of computer systems, including hardware, operating systems, application programs, and users, as well as the services provided by operating systems and the types of system calls. Additionally, it highlights the differences between uniprocessor and multiprocessor systems, emphasizing the benefits of multiprocessor systems and the importance of fault tolerance.

Uploaded by

sarora203
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 49

Chapter 1: Introduction

Operating System Concepts Silberschatz, Galvin and Gagne


Computer System Structure

1. Hardware – provides basic computing resources


 CPU, memory, I/O devices
2. Operating system
 Controls and coordinates use of hardware among various
applications and users
3. 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
4. Users
 People, machines, other computers

Operating System Concepts 1.2 Silberschatz, Galvin and Gagne


What is an Operating System?

A program that acts as an intermediary between a user of a


computer and the computer hardware
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

Four Components
of a
Computer System

Operating System Concepts 1.3 Silberschatz, Galvin and Gagne


Operating System Definition

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 1.4 Silberschatz, Galvin and Gagne


Operating System Definition (Cont.)

No universally accepted definition


“Everything a vendor ships when you order an operating
system” is a good approximation
“The one program running at all times on the computer” is
the kernel.
Everything else is either
a system program (ships with the operating system) , or
an application program

Operating System Concepts 1.5 Silberschatz, Galvin and Gagne


Design Issues

1. Efficiency
2. Robustness
3. Flexibility
4. Portability
5. Security
6. Compatibility

Operating System Concepts 1.6 Silberschatz, Galvin and Gagne


Design Issues – 1. Efficiency
Operating system efficiency is characterized by the amount of
useful work accomplished by system compared to the time and
resources used.
The ratio of actual operating time to scheduled operating time of a
computer system.
In time-sharing system, the ratio of user time to the sum of user time
plus system time.

Operating System Concepts 1.7 Silberschatz, Galvin and Gagne


Design Issues – 2. Robustness

The word robust, when used with regard to computer software, refers
to an operating system or other program that performs well not only
under ordinary conditions but also under unusual conditions
that stress its designers' assumptions.
A major feature of Unix-like operating systems is their robustness.
That is, they can operate for prolonged periods (sometimes years)
without crashing (i.e., stopping operating) or requiring rebooting (i.e.,
restarting).
And although individual application programs sometimes crash, they
almost always do so without affecting other programs or the
operating system itself.

Operating System Concepts 1.8 Silberschatz, Galvin and Gagne


Design Issues – 3. Flexibility
Flexible operating systems are taken to be those
whose designs have been motivated to some degree by the desire to
allow the system to be tailored or changed
either statically or dynamically,
to the requirements of specific applications or application domains.

Operating System Concepts 1.9 Silberschatz, Galvin and Gagne


Design Issues – 4. Portability

Portability is the ability of an application to run properly in a


different platform to the one it was designed for, with little or no
modification.
Portability in high-level computer programming is the usability of the
same software in different environments.
When software with the same functionality is produced for several
computing platforms, portability is the key issue for development cost
reduction.

Operating System Concepts 1.10 Silberschatz, Galvin and Gagne


Design Issues – 5. Security
System is called secure if resources used and accessed as
intended under all circumstances which is practically
unachievable
There exist different categories of dangers to the security of an
operating system:
Security Violations
Program Threats
System Threats
Network Threats

Operating System Concepts 1.11 Silberschatz, Galvin and Gagne


Design Issues – 6. Compatibility
Compatibility is the capacity for two systems to work together without
having to be altered to do so.
Compatible software applications use the same data formats.
For example, if word processor applications are compatible, the user
should be able to open their document files in either product.
Due to a difference in the versions of software or because they are made
by different companies.
The huge variety of application software available and all the versions of
the same software mean there are bound to be compatibility issues, even
when people are using the same kind of software.
In Microsoft Word for example, documents created in Word 2016 or
2013 can be opened in Word 2010 or 2007, but some of the newer
features (such as collapsed headings or embedded videos) will not
work in the older versions.

Operating System Concepts 1.12 Silberschatz, Galvin and Gagne


Storage Structure
1. Main memory – only large storage media that the CPU can access
directly
Random access
Typically volatile (contents lost without power)
2. Secondary storage – extension of main memory that provides large
nonvolatile (contents retained even without power) storage capacity
3. Hard disks – rigid metal or glass platters covered with magnetic
recording material
4. Solid-state disks – faster than hard disks, nonvolatile

Operating System Concepts 1.13 Silberschatz, Galvin and Gagne


Storage-Device Hierarchy

Operating System Concepts 1.14 Silberschatz, Galvin and Gagne


Storage Hierarchy

Storage systems organized in hierarchy


1. Speed
2. Cost
3. Volatility
Caching – copying information into faster storage system;
main memory can be viewed as a cache for secondary
storage
Device Driver for each device controller to manage I/O
Provides uniform interface between controller and
kernel

Operating System Concepts 1.15 Silberschatz, Galvin and Gagne


Direct Memory Access (DMA)

(Direct Memory Access)

A Von Neumann Architecture

Operating System Concepts 1.16 Silberschatz, Galvin and Gagne


Uni and Multiprocessor Systems
Uniprocessor System
On a single or uniprocessor system, there is one main CPU capable of
executing a general-purpose instruction set, including instructions from user
processes.
Almost all single processor systems have other special-purpose processors
as well.
They may come in the form of device-specific processors, such as disk,
keyboard, and graphics controllers;
Or, on mainframes, they may come in the form of more general-purpose
processors, such as I/O processors that move data rapidly among the
components of the system.
Multiprocessor System
Multiprocessor systems (also known as parallel systems or multicore
systems) have now begun to dominate the landscape of computing.
Such systems have two or more processors in close communication, sharing
the computer bus and sometimes the clock, memory, and peripheral
devices.
Multiprocessor systems first appeared in servers, then in desktop and laptop
systems. Recently, appeared on mobile devices such as smartphones and
tablet computers.

Operating System Concepts 1.17 Silberschatz, Galvin and Gagne


Benefits of Multiprocessor Systems

1. Increased throughput
By increasing the number of processors, we expect to get more work done per
time.
The speed-up ratio with N processors is not N, however; rather, it is less than N.
Because a certain amount of overhead is incurred in keeping all the parts working
correctly, plus contention for shared resources, lowers the expected gain from
additional processors.
2. Economy of scale
Can cost less than single-processor systems, because they can share peripherals,
mass storage, and power supplies.
If several programs operate on the same set of data, it is cheaper to store those
data on one disk and to have all the processors share them than to have many
computers with local disks and many copies of the data.
3. Increased reliability
If functions can be distributed properly among several processors, then the failure
of one processor will not halt the system, only slow it down.
If we have ten processors and one fails, then each of the remaining nine
processors can pick up a share of the work of the failed processor. Thus, the
entire system runs only 10 percent slower, rather than failing altogether.

Operating System Concepts 1.18 Silberschatz, Galvin and Gagne


Fault Tolerant Systems
Increased reliability of a computer system is crucial in many applications.
The ability to continue providing service proportional to the level of surviving
hardware is called graceful degradation.
Some systems go beyond graceful degradation and are called fault tolerant.
Because they can suffer a failure of any single component and still continue
operation.
Fault tolerance requires a mechanism to allow the failure to be detected,
diagnosed, and, if possible, corrected.

Operating System Concepts 1.19 Silberschatz, Galvin and Gagne


Chapter 2: Operating-System
Structures

Operating System Concepts Silberschatz, Galvin and Gagne


Chapter 2: Operating-System Structures

Operating System Services


System Calls
System Programs
Operating System Structures

Operating System Concepts 1.21 Silberschatz, Galvin and Gagne


Operating System Services
Operating systems provide an environment for execution of programs and
services to programs and users
Operating-system services for the user:
User interface - Almost all operating systems have a user interface (UI).
 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
File-system manipulation - 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
Error detection – OS needs to be constantly aware of possible errors
 May occur in CPU, memory, hardware, I/O devices, user program

Operating System Concepts 1.22 Silberschatz, Galvin and Gagne


Operating System Services (Cont.)
OS services for the system itself:
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 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 1.23 Silberschatz, Galvin and Gagne


A View of Operating System Services

Operating System Concepts 1.24 Silberschatz, Galvin and Gagne


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)

Note that the system-call names used throughout this text are
generic

Operating System Concepts 1.25 Silberschatz, Galvin and Gagne


Example of System Calls

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

Operating System Concepts 1.26 Silberschatz, Galvin and Gagne


Application Programming Interfaces (APIs)
An application program interface (API) is code that allows two software
programs to communicate with each other.
An API defines the correct way for a developer to request services from
an operating system or other application and expose data within
different contexts and across multiple channels.
Operating System APIs are a key enabler to target independent
software and seamless upgrading from the software perspective when
the underlying hardware is changed. This is one of the significant cost
reduction mechanisms promised by the use of open systems.
There are four principal types of API commonly used in web-based
applications: public, partner, private and composite. In this context, the
API “type” indicates the intended scope of use.

Operating System Concepts 1.27 Silberschatz, Galvin and Gagne


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 1.28 Silberschatz, Galvin and Gagne


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
Information maintenance
get time or date, set time or date
get system data, set system data
get and set process, file, or device attributes

Operating System Concepts 1.29 Silberschatz, Galvin and Gagne


Types of System Calls (Cont.)

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
attach and detach remote devices
Protection
Control access to resources

Operating System Concepts 1.30 Silberschatz, Galvin and Gagne


Examples of Windows and Unix System Calls

Operating System Concepts 1.31 Silberschatz, Galvin and Gagne


System Programs
System programs provide a convenient environment for program
development and execution. They can be divided into:
File manipulation
Status information sometimes stored in a File modification
Programming language support
Program loading and execution
Communications
Background services
Application programs
Most users’view of the operation system is defined by system
programs, not the actual system calls

Operating System Concepts 1.32 Silberschatz, Galvin and Gagne


Operating System Structure
General-purpose OS is very large program
Various ways to structure ones
1. Simple structure – MS-DOS
2. More complex -- UNIX
3. Layered – an abstrcation
4. Microkernel -Mach

Operating System Concepts 1.33 Silberschatz, Galvin and Gagne


1. 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 1.34 Silberschatz, Galvin and Gagne


2. Non-Simple 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

Operating System Concepts 1.35 Silberschatz, Galvin and Gagne


Traditional UNIX System Structure
Beyond simple but not fully layered

Operating System Concepts 1.36 Silberschatz, Galvin and Gagne


3. 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 1.37 Silberschatz, Galvin and Gagne


4. 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 1.38 Silberschatz, Galvin and Gagne


Microkernel System Structure

Application File Device user


Program System Driver mode

messages messages

Interprocess memory CPU kernel


Communication managment scheduling mode

microkernel

hardware

Operating System Concepts 1.39 Silberschatz, Galvin and Gagne


5. Modular Approach
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 1.40 Silberschatz, Galvin and Gagne


Solaris Modular Approach

Operating System Concepts 1.41 Silberschatz, Galvin and Gagne


6. Hybrid Systems

Most modern OS 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
Apple Mac OS X hybrid, layered, Aqua UI plus Cocoa
programming environment
Below (next slide) is kernel consisting of Mach microkernel
and BSD Unix parts, plus I/O kit and dynamically loadable
modules (called kernel extensions)

Operating System Concepts 1.42 Silberschatz, Galvin and Gagne


Mac OS X Structure

graphical user interface


Aqua

application environments and services

Java Cocoa Quicktime BSD

kernel environment
BSD

Mach

I/O kit kernel extensions

Operating System Concepts 1.43 Silberschatz, Galvin and Gagne


Handheld - iOS

Apple mobile OS for iPhone, iPad


Structured on Mac OS X, added functionality
Does not run OS X applications natively
 Also runs on different CPU architecture
(ARM vs. Intel)
Cocoa Touch Objective-C API for
developing apps
Media services layer for graphics, audio,
video
Core services provides cloud computing,
databases
Core operating system, based on Mac OS X
kernel

Operating System Concepts 1.44 Silberschatz, Galvin and Gagne


Handheld - Android
Developed by Open Handset Alliance (mostly Google)
Open Source
Similar stack to IOS
Based on Linux kernel but modified
Provides process, memory, device-driver management
Adds power management
Runtime environment includes core set of libraries and Dalvik
virtual machine
Apps developed in Java plus Android API
 Java class files compiled to Java bytecode then translated
to executable than runs in Dalvik VM
Libraries include frameworks for web browser (webkit), database
(SQLite), multimedia, smaller libc

Operating System Concepts 1.45 Silberschatz, Galvin and Gagne


AndroidApplications
Architecture

Application Framework

Libraries Android runtime

SQLite openGL Core Libraries

surface media
Dalvik
manager framework
virtual machine
webkit libc

Linux kernel

Operating System Concepts 1.46 Silberschatz, Galvin and Gagne


Performance Tuning
We mentioned earlier that performance tuning seeks to improve
performance by removing processing bottlenecks.
To identify bottlenecks, we must be able to monitor system
performance.
Thus, the OS must have some means of computing and displaying
measures of system behavior.
In a number of systems, the OS does this by producing trace listings
of system behavior.
All interesting events are logged with their time and important
parameters and are written to a file.
Later, an analysis program can process the log file to determine
system performance and to identify bottlenecks and inefficiencies.
These same traces can be run as input for a simulation of a suggested
improved system.
Traces also can help people to find errors in OS behavior.

Operating System Concepts 1.47 Silberschatz, Galvin and Gagne


Performance Tuning
Another approach to performance tuning uses single-purpose,
interactive tools that allow users and administrators to question
the state of various system components to look for bottlenecks.
One such tool employs the UNIX command “top” to display the
resources used on the system, as well as a sorted list of the “top”
resource-using processes.
Other tools display the state of disk I/O, memory allocation, and
network traffic.
The Windows Task Manager (screenshot on next slide) is a
similar tool for Windows systems. The task manager includes
information for current applications as well as processes, CPU
and memory usage, and networking statistics.
Making OS easier to understand, debug, and tune as they run is
an active area of research and implementation.
A leading example of such a tool: Solaris 10 DTrace dynamic
tracing facility.

Operating System Concepts 1.48 Silberschatz, Galvin and Gagne


Performance – Windows Task Manager

Operating System Concepts 1.49 Silberschatz, Galvin and Gagne

You might also like