Operating System: Operating Systems: Internals and Design Principles
Operating System: Operating Systems: Internals and Design Principles
Systems:
Internals Chapter 2
and Design
Principles Operating System
Overview
Seventh Edition
By William Stallings
Operating Systems:
Internals and Design Principles
Operating systems are those programs that interface the machine
with the applications programs. The main function of these systems
is to dynamically allocate the shared system resources to the
executing programs. As such, research in this area is clearly
concerned with the management and scheduling of memory,
processes, and other devices. But the interface with adjacent levels
continues to shift with time. Functions that were originally part of the
operating system have migrated to the hardware. On the other side,
programmed functions extraneous to the problems being solved by the
application programs are included in the operating system.
—WHAT CAN BE AUTOMATED?: THE COMPUTER SCIENCE AND
ENGINEERING RESEARCH STUDY,
MIT Press, 1980
Operating System
A program that controls the execution of application
programs
An interface between applications and hardware
Main objectives of an OS:
• Convenience
• Efficiency
• Ability to evolve
Computer Hardware and
Software Infrastructure
Operating System Services
New services
Fixes
Evolution of
Operating Systems
Stages include:
Time
Sharing
Multiprogrammed Systems
Batch Systems
Simple Batch
Systems
Serial
Processing
Serial Processing
Earliest Computers: Problems:
Scheduling:
No operating system most installations used a
programmers interacted hardcopy sign-up sheet to
directly with the computer reserve computer time
hardware
time allocations could
Computers ran from a console with run short or long,
display lights, toggle switches, resulting in wasted
some form of input device, and a computer time
printer
Setup time
Users have access to the computer a considerable amount of time
in “series” was spent just on setting up the
program to run
Simple Batch Systems
• while the user program is executing, it must not alter the memory area containing
the monitor
Timer
Privileged instructions
Interrupts
Multiprogramming
also known as multitasking
memory is expanded to hold three, four, or more programs and
switch among all of them
Multiprogramming Example
Effects on Resource
Utilization
Major advances in
development include:
• Processes
• Memory management
• Information protection and security
• Scheduling and resource
management
• System structure
Process
Fundamental to the structure of operating systems
a program in execution
an instance of a running program
the entity that can be assigned to, and executed on, a processor
time sharing
• be responsive to the individual user but be able to support many users
simultaneously
automatic support of
process protection and long-term
allocation and modular
isolation access control storage
management programming
Virtual Memory
A facilitythat allows programs to address
memory from a logical point of view, without
regard to the amount of main memory physically
available
Conceived to meet the requirement of having
multiple user jobs reside in main memory
concurrently
Paging
Allows processes to be comprised of a number of fixed-size
blocks, called pages
Program references a word by means of a virtual address
consists of a page number and an offset within the page
each page may be located anywhere in main memory
Provides for a dynamic mapping between the virtual
address used in the program and a real (or physical) address
in main memory
Virtual
Memory
Virtual Memory
Addressing
Information Protection
and Security
The nature of the
threat that concerns an
organization will vary Main
greatly depending on issues availability
the circumstances
The problem involves
authenticity confidentiality
controlling access to
computer systems and data
the information stored integrity
in them
Scheduling and
Resource Management
Key responsibility of an OS is managing
resources
Resource allocation policies must consider:
differential fairness
efficiency
responsiveness
Key Elements of an
Operating System
Different Architectural
Approaches
Demands on operating systems require new
ways of organizing the OS
• Microkernel architecture
• Multithreading
• Symmetric multiprocessing
• Distributed operating systems
• Object-oriented design
Microkernel Architecture
Assigns only a few essential functions to the
kernel:
interprocess
address basic
communication
spaces scheduling
(IPC)
The approach:
is well suited to a
simplifies provides
distributed
implementation flexibility
environment
Multithreading
Technique in which a process, executing an application, is
divided into threads that can run concurrently
Thread
• dispatchable unit of work
• includes a processor context and its own data area to enable subroutine branching
• executes sequentially and is interruptible
Process
• a collection of one or more threads and associated system resources
• programmer has greater control over the modularity of the application and the
timing of application related events
Symmetric
Multiprocessing (SMP)
Term that refers to a computer hardware architecture and also to
the OS behavior that exploits that architecture
Several processes can run in parallel
Multiple processors are transparent to the user
these processors share same main memory and I/O facilities
all processors can perform the same functions
Multi
OS Design
Distributed Operating
Object-Oriented Design
System
Provides the illusion of Used for adding modular
extensions to a small kernel
a single main memory space
single secondary memory space Enables programmers to
unified access facilities customize an operating system
without disrupting system
State of the art for distributed integrity
operating systems lags that of
uniprocessor and SMP operating Eases the development of
systems distributed tools and full-blown
distributed operating systems
Virtual Machines and
Virtualization
Virtualization
enables a single PC or server to simultaneously run multiple
operating systems or multiple sessions of a single OS
a machine can host numerous applications, including those
that run on different operating systems, on a single platform
host operating system can support a number of
virtual machines (VM)
each has the characteristics of a particular OS
and, in some versions of virtualization, the
characteristics of a particular hardware platform
Virtual
Memory
Concept
Virtual Machine
Architecture
Process perspective:
• the machine on which it executes consists of the virtual memory space assigned to
the process
• the processor registers it may use
• the user-level machine instructions it may execute
• OS system calls it may invoke for I/O
• ABI defines the machine as seen by a process
Application perspective:
• machine characteristics are specified by high-level language capabilities and OS
system library calls
• API defines the machine for an application
OS perspective:
• processes share a file system and other I/O resources
• system allocates real memory and I/O resources to the processes
• ISA provides the interface between the system and machine
Process and System Virtual Machines
Process and System Virtual Machines
Symmetric Multiprocessor
OS Considerations
A multiprocessor OS must provide all the functionality of a multiprogramming
system plus additional features to accommodate multiple processors
Kernel
controls execution of the processors
Device Drivers
dynamic libraries that extend the functionality of the Executive
Processes
it provides a suitable base
communicate via
for distributed computing
RPC
Threads and SMP
Two important characteristics of Windows are its support for
threads and for symmetric multiprocessing (SMP)
OS routines can run on any available processor, and different routines can
execute simultaneously on different processors
Server processes may use multiple threads to process requests from more than
one client simultaneously
Object
Encapsulation class and Inheritance Polymorphism
instance
n
C
o lenrK
ew
s
o
d
nWi
Windows 7
Changes and improvements:
Engineering improvements
the system is now built in layers which can be separately tested
Performance improvements
amount of memory required has been reduced
Reliability improvements
user-mode heap is more tolerant of memory allocation errors by C/C++
programmers
Energy efficiency
many improvements have been made
Security
BitLocker is now easier to set up and use
Thread improvements
can support hundreds of CPUs
Dynamic Fair Share Scheduling (DFSS)
Traditional UNIX Systems
Were developed at Bell Labs and became operational on a PDP-7 in 1970
PDP-11was a milestone because it first showed that UNIX would be an OS for all computers
First widely available version outside Bell Labs was Version 6 in 1976
Most important of the non-AT&T systems was UNIX BSD (Berkeley Software Distribution)
Description
of UNIX
Traditional
UNIX
Kernel
Modern
UNIX
Kernel
LINUX Overview
Started out as a UNIX variant for the IBM PC
Linus Torvalds, a Finnish student of computer science, wrote the initial
version
Linux was first posted on the Internet in 1991
Today it is a full-featured UNIX system that runs on several platforms
Is free and the source code is available
Key to success has been the availability of free software packages
Highly modular and easily configured
Modular
Monolithic Kernel
Loadable Modules
Includes virtually all of the OS Relatively independent blocks
functionality in one large block of
code that runs as a single process A module is an object file whose
with a single address space code can be linked to and unlinked
from the kernel at runtime
All the functional components of
the kernel have access to all of its A module is executed in kernel
internal data structures and
routines mode on behalf of the current
process
Linux is structured as a collection
of modules Have two important characteristics:
Dynamic linking
Stackable modules
Linux
Kernel
Modules
Linux Kernel Components
Linux Signals