You are on page 1of 37

Operating Systems:

Internals and Design Principles, 6/E


William Stallings

Chapter 2
Operating System Overview

Patricia Roy
Manatee Community College, Venice,
FL
©2008, Prentice Hall
Operating System
• A program that controls the execution of
application programs
• An interface between applications and
hardware
Operating System Objectives
• Convenience
• Efficiency
• Ability to evolve
Layers and Views
Services Provided by the OS
• Program development
– Editors and debuggers
• Program execution
• Access I/O devices
Services Provided by the OS
• Controlled access to files
• System access
Services Provided by the OS
• Error detection and response
– Internal and external hardware errors
– Software errors
– Operating system cannot grant request of
application
Services Provided by the OS
• Accounting
– Collect usage statistics
– Monitor performance
– Used to anticipate future enhancements
– Used for billing purposes
Operating System
• Responsible for managing resources
• Functions same way as ordinary computer
software
– It is a program that is executed
• Operating system relinquishes control of
the processor
OS as Resource Manager
Kernel
• Portion of operating system that is in main
memory
• Contains most frequently used functions
• Also called the nucleus
Evolution of Operating
Systems
• Hardware upgrades plus new types of
hardware
• New services
• Fixes
Evolution of Operating
Systems
• Serial processing
– No operating system
– Machines run from a console with display
lights, toggle switches, input device, and
printer
Evolution of Operating
Systems
• Serial processing
– Schedule time
– Setup included loading the compiler, source
program, saving compiled program, and
loading and linking
Evolution of Operating
Systems
• Simple batch system
– Monitor
• Software that controls the sequence of events
• Batch jobs together
• Program returns control to monitor when finished
Job Control Language
• Special type of programming language
• Provides instruction to the monitor
– What compiler to use
– What data to use
Hardware Features
• Memory protection
– Does not allow the memory area containing
the monitor to be altered
• Timer
– Prevents a job from monopolizing the system
Hardware Features
• Privileged instructions
– Certain machine level instructions can only be
executed by the monitor
• Interrupts
– Early computer models did not have this
capability
Memory Protection
• User program executes in user mode
– Certain instructions may not be executed
Memory Protection
• Monitor executes in system mode
– Kernel mode
– Privileged instructions are executed
– Protected areas of memory may be accessed
System Utilization Example
Uniprogramming
• Processor must wait for I/O instruction to
complete before proceeding
Multiprogramming
• When one job needs to wait for I/O, the
processor can switch to the other job
Multiprogramming
Utilization Histograms
Example
Time Sharing Systems
• Using multiprogramming to handle multiple
interactive jobs
• Processor’s time is shared among multiple
users
• Multiple users simultaneously access the
system through terminals
Batch Multiprogramming versus
Time Sharing
CTSS Operation
Major Achievements
• Processes
• Memory management
• Information protection and security
• Scheduling and resource management
• System structure
Process
• A program in execution
• An instance of a program running on a
computer
• The entity that can be assigned to and
executed on a processor
Modern Operating Systems
• Object-oriented design
– Used for adding modular extensions to a
small kernel
– Enables programmers to customize an
operating system without disrupting system
integrity
Monolithic Kernel OS
app. processes
Design critical OS
data
user system processes user processes structures and
mode
system calls device
kernel registers are
signals files CPU scheduling machine- protected from
kernel terminals swapping page replacement user programs
character I/O disk, tape virtual memory independent
mode
terminal device memory machine-
drivers drivers drivers dependent
hardware commands/interrupts
device controllers
• advantages: speed and ease of operation (everything is at hand)
• disadvantages:
– hard to develop, maintain, modify and debug
– kernel gets bigger as
59 the OS develops
Modular Kernel
• classic monolithic kernel requires all functionality to be
inbuilt into kernel and loaded at boot-time – waste of
RAM, limited flexibility
• loadable kernel module – object file to be loaded at boot
time or, possibly compile time
– extends base kernel functionality, common functions of kernel
modules
• device drivers/bus drivers, filesystems, system calls, CPU scheduling
classes, executable file formats
– loaded to kernel address space has full access to all kernel
memory
– has defined programming interface, possibly protected
• Linuxes, Windows, Solaris, Mac OS X support kernel
modules

60
Microkernel
system processes user processes
thread file
system system • small kernel implements
user network
CPU communication (usually
mode scheduling
support messages)
• when system services are
paging
required microkernel calls
kernel micro- communication protection other parts of OS running in
mode kernel low-level VM processor control user modes and passes the
hardware commands/interrupts request there
device controllers

• advantages: reliability, ease of development, modularity - parts can


be replaced and tailored to the architecture, user requirements etc.
• disadvantages: slow?
• examples: MacOS X, Windows XP

61
Virtual Machine
• OS’s system calls
are considered an
enhancement of
hardware’s
instruction set
– extend further –
virtual machine
• each user task is
provided with an abstract (virtual machine) which OS + hardware implement
– IBM – pioneered
– modern examples:
• Java VM – next slide
• VMware Player – extra guest/host bit, guest OS executes limited set of instructions, if different instruction – trap to
host OS
adv. – portability at binary-level, security, greater language flexibility
dis. – speed(?)

62
Java Virtual
Machine (JVM)
• Java source code is translated into an architecture
independent java bytecode
• bytecode is executed by JVM
• JVM can be implemented purely in software or in hardware
• JVM verifies bytecode’s correctness and then either interprets (translates the
code into machines instructions one by one)
• or just-in-time (JIT) compiles to optimize, or both
adv. – portability at binary-level, security, greater language flexibility
dis. – speed(?)

63

You might also like