0% found this document useful (0 votes)
61 views18 pages

ch1 of Os

Uploaded by

SmilingSana
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
61 views18 pages

ch1 of Os

Uploaded by

SmilingSana
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 18

Chapter 1: Introduction

• What Operating Systems Do


• Computer-System Organization
• Computer-System Architecture
Chapter 1: Introduction • Operating-System Structure
• Operating-System Operations
• Process Management
• Memory Management
• Storage Management
• Protection and Security
• Distributed Systems
• Special-Purpose Systems
• Computing Environments
What is an Operating System?
Objectives
• A program that acts as an intermediary
• To provide a grand tour of the major operating between a user of a computer and the
systems components computer hardware.
• Operating system goals:
• To provide coverage of basic computer system – Execute user programs and make solving user
organization problems easier.
– Make the computer system convenient to
use.
• Use the computer hardware in an
efficient manner.
Computer System Structure
• Computer system can be divided into four Four Components of a Computer System
components
– Hardware – provides basic computing resources
• CPU, memory, I/O devices
– Operating system
• Controls and coordinates use of hardware among various
applications and 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 Definition
Operating System Definition
(Cont.)
• OS is a resource allocator • No universally accepted definition
– Manages all resources • “Everything a vendor ships when you
– Decides between conflicting requests for order an operating system” is good
efficient and fair resource use approximation
• OS is a control program – But varies wildly
– Controls execution of programs to prevent • “The one program running at all times
errors and improper use of the computer on the computer” is the kernel.
Everything else is either a system
program (ships with the operating
system) or an application program
Computer Startup Computer System Organization
• bootstrap program is loaded at power-up or • Computer-system operation
reboot – One or more CPUs, device controllers connect
– Typically stored in ROM or EEPROM, generally through common bus providing access to shared
known as firmware memory
– Initializates all aspects of system – Concurrent execution of CPUs and devices
– Loads operating system kernel and starts competing for memory cycles
execution
Computer-System Operation
Common Functions of Interrupts
• I/O devices and the CPU can execute
concurrently. • Interrupt transfers control to the interrupt service
routine generally, through the interrupt vector, which
• Each device controller is in charge of a particular contains the addresses of all the service routines.
device type.
• Interrupt architecture must save the address of the
• Each device controller has a local buffer. interrupted instruction.
• CPU moves data from/to main memory to/from • Incoming interrupts are disabled while another
local buffers interrupt is being processed to prevent a lost interrupt.
• I/O is from the device to local buffer of controller. • A trap is a software-generated interrupt caused either
• Device controller informs CPU that it has finished by an error or a user request.
its operation by causing an interrupt. • An operating system is interrupt driven.

Interrupt Handling
Interrupt Timeline
• The operating system preserves the state of the
CPU by storing registers and the program counter.
• Determines which type of interrupt has occurred:
– polling
– vectored interrupt system
• Separate segments of code determine what
action should be taken for each type of interrupt
Two I/O Methods
I/O Structure
• After I/O starts, control returns to user Synchronous Asynchronous
program only upon I/O completion.
– Wait instruction idles the CPU until the next
interrupt
– Wait loop (contention for memory access).
– At most one I/O request is outstanding at a time,
no simultaneous I/O processing.
• After I/O starts, control returns to user
program without waiting for I/O completion.
– System call – request to the operating system to
allow user to wait for I/O completion.
– Device-status table contains entry for each I/O
device indicating its type, address, and state.
– Operating system indexes into I/O device table to
determine device status and to modify table
entry to include interrupt.
Direct Memory Access Structure
Device-Status Table • Used for high-speed I/O devices able to
transmit information at close to memory
speeds.
• Device controller transfers blocks of data from
buffer storage directly to main memory
without CPU intervention.
• Only on interrupt is generated per block,
rather than the one interrupt per byte.
Storage Structure Storage Hierarchy
• Main memory – only large storage media that the • Storage systems organized in hierarchy.
CPU can access directly.
– Speed
• Secondary storage – extension of main memory
– Cost
that provides large nonvolatile storage capacity.
– Volatility
• Magnetic disks – rigid metal or glass platters
covered with magnetic recording material • Caching – copying information into faster
– Disk surface is logically divided into tracks, which are storage system; main memory can be viewed
subdivided into sectors. as a last cache for secondary storage.
– The disk controller determines the logical interaction
between the device and the computer.
Storage-Device Hierarchy Caching
• Important principle, performed at many levels in a
computer (in hardware, operating system, software)
• Information in use copied from slower to faster storage
temporarily
• Faster storage (cache) checked first to determine if
information is there
– If it is, information used directly from the cache (fast)
– If not, data copied to cache and used there
• Cache smaller than storage being cached
– Cache management important design problem
– Cache size and replacement policy
Migration of Integer A from Disk to Register
Performance of Various Levels of Storage
• Multitasking environments must be careful to use most recent
value, not matter where it is stored in the storage hierarchy
• Movement between levels of storage
hierarchy can be explicit or implicit

• 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
– Various solutions covered in Chapter 17
Memory Layout for Multiprogrammed System
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 Operations Transition from User to Kernel Mode
• Interrupt driven by hardware
• Software error or request creates exception or trap
• Timer to prevent infinite loop / process
– Division by zero, request for operating system service hogging resources
• Other process problems include infinite loop, processes – Set interrupt after specific period
modifying each other or the operating system
• Dual-mode operation allows OS to protect itself and – Operating system decrements counter
other system components
– User mode and kernel mode – When counter zero generate an interrupt
– Mode bit provided by hardware – Set up before scheduling process to regain control
• Provides ability to distinguish when system is running user code or
kernel code or terminate program that exceeds allotted time
• Some instructions designated as privileged, only executable in
kernel mode
• System call changes mode to kernel, return from call resets it to
user

Process Management
Process Management Activities
• A process is a program in execution. It is a unit of work within the The operating system is responsible for the following
system. Program is a passive entity, process is an active entity.
• Process needs resources to accomplish its task activities in connection with process management:
– CPU, memory, I/O, files • Creating and deleting both user and system processes
– Initialization data
• Process termination requires reclaim of any reusable resources • Suspending and resuming processes
• Single-threaded process has one program counter specifying location of
next instruction to execute
• Providing mechanisms for process synchronization
– Process executes instructions sequentially, one at a time, until • Providing mechanisms for process communication
completion
• Multi-threaded process has one program counter per thread • Providing mechanisms for deadlock handling
• 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
Memory Management Storage Management
• OS provides uniform, logical view of information
• All data in memory before and after processing storage
– Abstracts physical properties to logical storage unit - file
• All instructions in memory in order to execute – Each medium is controlled by device (i.e., disk drive, tape
• Memory management determines what is in memory drive)
• Varying properties include access speed, capacity, data-transfer
when rate, access method (sequential or random)
– Optimizing CPU utilization and computer response to users • File-System management
– Files usually organized into directories
• Memory management activities – Access control on most systems to determine who can
– Keeping track of which parts of memory are currently access what
being used and by whom – OS activities include
• Creating and deleting files and directories
– Deciding which processes (or parts thereof) and data to • Primitives to manipulate files and dirs
move into and out of memory • Mapping files onto secondary storage
• Backup files onto stable (non-volatile) storage media
– Allocating and deallocating memory space as needed
Mass-Storage Management I/O Subsystem
• 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
• One purpose of OS is to hide peculiarities of
• Entire speed of computer operation hinges on disk subsystem and its algorithms hardware devices from the user
• OS activities
– Free-space management • I/O subsystem responsible for
– Storage allocation
– Disk scheduling
– Memory management of I/O including buffering
• Some storage need not be fast (storing data temporarily while it is being
– Tertiary storage includes optical storage, magnetic tape
– Still must be managed
transferred), caching (storing parts of data in
– Varies between WORM (write-once, read-many-times) and RW (read-write) 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
Protection and Security Computing Environments
• Protection – any mechanism for controlling access of processes or • Traditional computer
users to resources defined by the OS – Blurring over time
• Security – defense of the system against internal and external – Office environment
attacks
– Huge range, including denial-of-service, worms, viruses, identity theft, • PCs connected to a network, terminals attached to mainframe or
theft of service minicomputers providing batch and timesharing
• Systems generally first distinguish among users, to determine who • Now portals allowing networked and remote systems access to same
can do what
– User identities (user IDs, security IDs) include name and associated resources
number, one per user – Home networks
– User ID then associated with all files, processes of that user to • Used to be single system, then modems
determine access control
– Group identifier (group ID) allows set of users to be defined and • Now firewalled, networked
controls managed, then also associated with each process, file
– Privilege escalation allows user to change to effective ID with more
rights
Computing Environments (Cont.)
 Client-Server Computing
Peer-to-Peer Computing
 Dumb terminals supplanted by smart PCs
 Many systems now servers, responding to requests generated by • Another model of distributed system
clients
 Compute-server provides an interface to client to request • P2P does not distinguish clients and servers
services (i.e. database)
 File-server provides interface for clients to store and retrieve – Instead all nodes are considered peers
files
– May each act as client, server or both
– Node must join P2P network
• Registers its service with central lookup service on
network, or
• Broadcast request for service and respond to requests
for service via discovery protocol
– Examples include Napster and Gnutella
Web-Based Computing
• Web has become ubiquitous
• PCs most prevalent devices
• More devices becoming networked to allow
web access End of Chapter 1
• New category of devices to manage web
traffic among similar servers: load balancers
• Use of operating systems like Windows 95,
client-side, have evolved into Linux and
Windows XP, which can be clients and servers

You might also like