Operating System Concepts
System Structure System structured as a series of levels - each level performs a
related subset of functions Each level relies on the next lower level for more primitive functions Layers Concepts z
Hardware abstraction layer
z
Microkernel
z
Device drivers
Operating System Concepts
Computer System Structure Computer system can be divided into four components z
Hardware – provides basic computing resources CPU,
z
memory, I/O devices
Operating system Controls
and coordinates use of hardware among various applications and users
z
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
z
Users People,
machines, other computers
Operating System Concepts
Four Components of a Computer System
Operating System Concepts
Operating System ?? Computer applications today require a single machine to perform
many operations and the applications may compete for the resources of the machine. This demands a high degree of coordination This coordination is handled by system software known as the
operating system
Operating System Concepts
Operating System ?? What is an operating system? z
Hard to define precisely, because operating systems arose historically as people needed to solve problems associated with using computers.
z
How about… “Software that makes computing power available to users by controlling the hardware.” “A collection of software modules including device drivers, libraries, and access routines.”
Operating System Concepts
Operating System Objectives Operating systems are among the most critical pieces of software
ever developed z
Convenience Makes
z
the computer more convenient to use
Efficiency Allows
computer system resources to be used in an efficient manner
z
Ability to evolve Permit
effective development, testing, and introduction of new system functions without interfering with service
Operating System Concepts
Operating System Services Program development z
Editors, debuggers, frameworks
Program execution z
Initialization, scheduling
Access to I/O devices z
Uniform interface, hides details
Controlled access to files z
Authorization, sharing, caching
System access z
Protection, authorization, resolve conflicts
Error detection and response z
Hardware errors: memory error or device failure
z
Software errors: arithmetic errors, access forbidden memory locations, allocation errors
Operating System Concepts
OS as a Resource Manager OS executes same way as ordinary computer software - it is set of
computer programs The key difference is in the intent z
Directs use of resources
z
Relinquishes control of the processor to execute other programs
Kernel or nucleus z
Portion of operating system that is in main memory
z
Contains most-frequently used functions
Operating System Concepts
Evolution of Operating Systems Operating systems have evolved because z
New types of hardware and hardware upgrades
z
Development of new services and needs
z
Fixes to OS faults
Distributed Processing Systems Time-Sharing Systems Multi-programmed Batch Systems Simple Batch Processing Serial Processing
Operating System Concepts
OS for batch jobs z
Program execution required significant preparation of equipment
z
Program execution (job)
z
OS was a system to simplify program setup and simplify transition between jobs
z
Physical separation of users and equipment led to computer operators
z
Users left jobs with the operator and came back the next day (batch jobs)
z
Users had no interaction with computer during program execution. Maybe okay for some applications, but not for all.
Operating System Concepts
OS for Interactive Processing z
Allowed programs to carry on dialogue with user via remote terminals (workstations)
z
Real-time processing
z
Users demand timely response
z
Machines too expensive to serve only one user
z
Common for several users to want interactive services at the same time
Operating System Concepts
OS for time-sharing z
To accommodate multiple real-time users, the OS rotates its various jobs in and out of execution via time-sharing
z
Each job gets a predetermined “time slice”
z
At end of time slice current job is set aside and a new one starts
z
By rapidly shuffling jobs, illusion of several jobs executing simultaneously is created
z
Without time slicing, a computer spends most of its time waiting for peripheral devices or users
z
A collection of tasks can be completed in less time with timesharing than when completed sequentially
Operating System Concepts
Different Operating Systems on the Same Machine ? It is possible to have more than one operating system available to
be used on a machine. Only one operating system is run at a time, though. Examples: z
PCs -- DOS, Windows, or Linux
Operating System Concepts
Distributed Processing Systems Distributed operating systems z
provides the illusion of a single main memory and single secondary memory space
z
used for distributed file system
Operating System Concepts
Modern OS Architecture
Operating System Concepts
Computer Startup bootstrap program is loaded at power-up or reboot z
Typically stored in ROM or EPROM, generally known as firmware
z
Initializates all aspects of system
z
Loads operating system kernel and starts execution
Operating System Concepts
Computer System Organization Computer-system operation z
One or more CPUs, device controllers connect through common bus providing access to shared memory
z
Concurrent execution of CPUs and devices competing for memory cycles
Operating System Concepts
Computer-System Operation I/O devices and the CPU can execute concurrently. Each device controller is in charge of a particular device type. Each device controller has a local buffer. CPU moves data from/to main memory to/from local buffers I/O is from the device to local buffer of controller. Device controller informs CPU that it has finished its operation by
causing an interrupt.
Operating System Concepts
Storage Structure Main memory – only large storage media that the CPU can access
directly. Secondary storage – extension of main memory that provides large
nonvolatile storage capacity. Magnetic disks – rigid metal or glass platters covered with
magnetic recording material z
Disk surface is logically divided into tracks, which are subdivided into sectors.
z
The disk controller determines the logical interaction between the device and the computer.
Operating System Concepts
Storage Hierarchy Storage systems organized in hierarchy. z
Speed
z
Cost
z
Volatility
Caching – copying information into faster storage system; main
memory can be viewed as a last cache for secondary storage.
Operating System Concepts
Storage-Device Hierarchy
Operating System Concepts
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 z
If it is, information used directly from the cache (fast)
z
If not, data copied to cache and used there
Cache smaller than storage being cached z
Cache management important design problem
z
Cache size and replacement policy
Operating System Concepts
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 z
Several copies of a datum can exist
z
Various solutions covered in Chapter 17
Operating System Concepts
Memory Layout for Multiprogrammed System
Operating-System Structures
Operating System Concepts
The OS Kernel The internal part of the OS is often called the kernel Kernel Components z
File Manager
z
Device Drivers
z
Memory Manager
z
Scheduler
z
Dispatcher
Operating System Concepts
User Operating System Interface - CLI CLI allows direct command entry Sometimes
implemented in kernel, sometimes by systems
program Sometimes Primarily –
multiple flavors implemented – shells
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
User Operating System Interface - GUI User-friendly desktop metaphor interface z
Usually mouse, keyboard, and monitor
z
Icons represent files, programs, actions, etc
z
Various mouse buttons over objects in the interface cause various actions (provide information, options, execute function, open directory (known as a folder)
z
Invented at Xerox PARC
Many systems now include both CLI and GUI interfaces z
Microsoft Windows is GUI with CLI “command” shell
z
Apple Mac OS X as “Aqua” GUI interface with UNIX kernel underneath and shells available
z
Solaris is CLI with optional GUI interfaces (Java Desktop, KDE)
Operating System Concepts
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
Program 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) Why use APIs rather than system calls?
(Note that the system-call names used throughout this text are generic)
Operating System Concepts
API – System Call – OS Relationship
Write()
Write() Implementation of Write()
Operating System Concepts
Standard C Library Example C program invoking printf() library call, which calls write() system call
Operating System Concepts
Simple Structure MS-DOS – written to provide the most functionality in the least
space z
Not divided into modules
z
Although MS-DOS has some structure, its interfaces and levels of functionality are not well separated
Operating System Concepts
MS-DOS Layer Structure
Operating System Concepts
Layered Operating System
Operating System Concepts
Microkernel System Structure Moves as much from the kernel into “user” space Communication takes place between user modules using message
passing Benefits: z
Easier to extend a microkernel
z
Easier to port the operating system to new architectures
z
More reliable (less code is running in kernel mode)
z
More secure
Detriments: z
Performance overhead of user space to kernel space communication
Operating System Concepts
Solaris Modular Approach
Operating System Concepts
Virtual Machines A virtual machine takes the layered approach to its logical
conclusion. It treats hardware and the operating system kernel as though they were all hardware A virtual machine provides an interface identical to the
underlying bare hardware The operating system creates the illusion of multiple
processes, each executing on its own processor with its own (virtual) memory
Operating System Concepts
Virtual Machines (Cont.) The resources of the physical computer are shared to create the
virtual machines z
CPU scheduling can create the appearance that users have their own processor
z
Spooling and a file system can provide virtual card readers and virtual line printers
z
A normal user time-sharing terminal serves as the virtual machine operator’s console
Operating System Concepts
Virtual Machines
Non-virtual Machine
(a) Non-virtual machine
Virtual Machine
(b) virtual machine
Operating System Concepts
Virtual Machines (Cont.) The virtual-machine concept provides complete protection of system
resources since each virtual machine is isolated from all other virtual machines. This isolation, however, permits no direct sharing of resources. A virtual-machine system is a perfect vehicle for operating-systems
research and development. System development is done on the virtual machine, instead of on a physical machine and so does not disrupt normal system operation. The virtual machine concept is difficult to implement due to the effort
required to provide an exact duplicate to the underlying machine
Operating System Concepts
VMware Architecture
Operating System Concepts
The Java Virtual Machine
Operating System Concepts
Operating-System Operations Process Management Memory Management Storage Management Protection and Security Distributed Systems
Processes …
Operating System Concepts
Process Concept An operating system executes a variety of programs: z
Batch system – jobs
z
Time-shared systems – user programs or tasks
Textbook uses the terms job and process almost
interchangeably
Process – a program in execution; process execution must
progress in sequential fashion
A process includes: z
program counter
z
stack
z
data section
Operating System Concepts
Process in Memory
Operating System Concepts
Process State
As a process executes, it changes state z
new: The process is being created
z
running: Instructions are being executed
z
waiting: The process is waiting for some event to occur
z
ready: The process is waiting to be assigned to a processor
z
terminated: The process has finished execution
Operating System Concepts
Diagram of Process State
Operating System Concepts
Process Control Block (PCB) Information associated with each process Process state Program counter CPU registers CPU scheduling information Memory-management information Accounting information I/O status information
Operating System Concepts
Process Control Block (PCB)
Operating System Concepts
CPU Switch From Process to Process
Operating System Concepts
Process Creation Parent process create children processes, which, in turn create
other processes, forming a tree of processes Resource sharing z
Parent and children share all resources
z
Children share subset of parent’s resources
z
Parent and child share no resources
Execution z
Parent and children execute concurrently
z
Parent waits until children terminate
Operating System Concepts
Process Creation (Cont.) Address space z
Child duplicate of parent
z
Child has a program loaded into it
UNIX examples z
fork system call creates new process
z
exec system call used after a fork to replace the process’ memory space with a new program
Operating System Concepts
Process Creation
Operating System Concepts
Process Termination Process executes last statement and asks the operating system to
delete it (exit) z
Output data from child to parent (via wait)
z
Process’ resources are deallocated by operating system
Parent may terminate execution of children processes (abort) z
Child has exceeded allocated resources
z
Task assigned to child is no longer required
z
If parent is exiting Some
operating system do not allow child to continue if its parent terminates –
All children terminated - cascading termination
Operating System Concepts
Inter-process Communication (IPC) Mechanism for processes to communicate and to synchronize their
actions
Message system – processes communicate with each other
without resorting to shared variables
IPC facility provides two operations: z
send(message) – message size fixed or variable
z
receive(message)
If P and Q wish to communicate, they need to: z
establish a communication link between them
z
exchange messages via send/receive
Implementation of communication link z
physical (e.g., shared memory, hardware bus)
z
logical (e.g., logical properties)
Operating System Concepts
Communications Models
Operating System Concepts
Direct Communication Processes must name each other explicitly: z
send (P, message) – send a message to process P
z
receive(Q, message) – receive a message from process Q
Properties of communication link z
Links are established automatically
z
A link is associated with exactly one pair of communicating processes
z
Between each pair there exists exactly one link
z
The link may be unidirectional, but is usually bi-directional
Operating System Concepts
Client-Server Communication Sockets Remote Procedure Calls Remote Method Invocation (Java)
Operating System Concepts
Sockets A socket is defined as an endpoint for communication Concatenation of IP address and port The socket 161.25.19.8:1625 refers to port 1625 on host
161.25.19.8 Communication consists between a pair of sockets
Operating System Concepts
Socket Communication
Operating System Concepts
Remote Procedure Calls Remote procedure call (RPC) abstracts procedure calls between
processes on networked systems. Stubs – client-side proxy for the actual procedure on the server. The client-side stub locates the server and marshalls the
parameters. The server-side stub receives this message, unpacks the
marshalled parameters, and peforms the procedure on the server.
Note : Marshalling is the process of packaging and sending interface method parameters across thread, process or machine boundaries.
Operating System Concepts
Remote Method Invocation Remote Method Invocation (RMI) is a Java mechanism similar to
RPCs. RMI allows a Java program on one machine to invoke a method on
a remote object.
Threads
Operating System Concepts
Single and Multithreaded Processes
Operating System Concepts
User Threads Thread management done by user-level threads library Three primary thread libraries: z
POSIX Pthreads
z
Win32 threads
z
Java threads
Operating System Concepts
Kernel Threads Supported by the Kernel Examples z
Windows XP/2000
z
Solaris
z
Linux
z
Tru64 UNIX
z
Mac OS X
Operating System Concepts
Multithreading Models Many-to-One One-to-One Many-to-Many
Operating System Concepts
Many-to-One Many user-level threads mapped to single kernel thread Examples: z
Solaris Green Threads
z
GNU Portable Threads
Operating System Concepts
Many-to-One Model
Operating System Concepts
One-to-One Each user-level thread maps to kernel thread Examples z
Windows NT/XP/2000
z
Linux
z
Solaris 9 and later
Operating System Concepts
One-to-one Model
Operating System Concepts
Many-to-Many Model Allows many user level threads to be mapped to many
kernel threads Allows the operating system to create a sufficient
number of kernel threads Solaris prior to version 9 Windows NT/2000 with the ThreadFiber package
Operating System Concepts
Many-to-Many Model
Operating System Concepts
Two-level Model Similar to M:M, except that it allows a user thread to be
bound to kernel thread Examples z
IRIX
z
HP-UX
z
Tru64 UNIX
z
Solaris 8 and earlier
Operating System Concepts
Two-level Model
Operating System Concepts
Threading Issues Semantics of fork() and exec() system calls Thread cancellation Signal handling Thread pools Thread specific data Scheduler activations
Operating System Concepts
Thread Cancellation Terminating a thread before it has finished Two general approaches: z
Asynchronous cancellation terminates the target thread immediately
z
Deferred cancellation allows the target thread to periodically check if it should be cancelled
Operating System Concepts
Signal Handling
Signals are used in UNIX systems to notify a process that a particular event has occurred
A signal handler is used to process signals
1.
Signal is generated by particular event
2.
Signal is delivered to a process
3.
Signal is handled
Options: z
Deliver the signal to the thread to which the signal applies
z
Deliver the signal to every thread in the process
z
Deliver the signal to certain threads in the process
z
Assign a specific thread to receive all signals for the process
Operating System Concepts
Thread Pools Create a number of threads in a pool where they await work Advantages: z
Usually slightly faster to service a request with an existing thread than create a new thread
z
Allows the number of threads in the application(s) to be bound to the size of the pool
Operating System Concepts
Java Thread States
Deadlocks
Operating System Concepts
Deadlock ??? A condition that occurs when two processes are each waiting for the other to complete before proceeding. The result is that both processes hang. Deadlocks occur most commonly in multitasking and client/server environments. Ideally, the programs that are deadlocked, or the operating system, should resolve the deadlock, but this doesn't always happen. A deadlock is also called a deadly embrace.
Operating System Concepts
Bridge Crossing Example
Traffic only in one direction.
Each section of a bridge can be viewed as a resource.
If a deadlock occurs, it can be resolved if one car backs up (preempt resources and rollback).
Several cars may have to be backed up if a deadlock occurs.
Starvation is possible. z
In computer science, starvation is a multitasking-related problem, where a process is perpetually denied necessary resources. Without those resources, the program can never finish its task.
Main Memory
Operating System Concepts
Objectives To provide a detailed description of various ways of
organizing memory hardware To discuss various memory-management techniques,
including paging and segmentation To provide a detailed description of the Intel Pentium, which
supports both pure segmentation and segmentation with paging
Operating System Concepts
Background Program must be brought (from disk) into memory and placed
within a process for it to be run Main memory and registers are only storage CPU can access
directly Register access in one CPU clock (or less) Main memory can take many cycles Cache sits between main memory and CPU registers Protection of memory required to ensure correct operation
Operating System Concepts
Base and Limit Registers A pair of base and limit registers define the logical address space
Operating System Concepts
Binding of Instructions and Data to Memory Address binding of instructions and data to memory addresses
can happen at three different stages z
Compile time: If memory location known a priori, absolute code can be generated; must recompile code if starting location changes
z
Load time: Must generate relocatable code if memory location is not known at compile time
z
Execution time: Binding delayed until run time if the process can be moved during its execution from one memory segment to another. Need hardware support for address maps (e.g., base and limit registers)
Operating System Concepts
Multi-step Processing of a User Program
Operating System Concepts
Logical vs. Physical Address Space The concept of a logical address space that is bound to a
separate physical address space is central to proper memory management z
Logical address – generated by the CPU; also referred to as virtual address
z
Physical address – address seen by the memory unit
Logical and physical addresses are the same in compile-time
and load-time address-binding schemes; logical (virtual) and physical addresses differ in execution-time address-binding scheme
Operating System Concepts
Contiguous Allocation Main memory usually into two partitions: z
Resident operating system, usually held in low memory with interrupt vector
z
User processes then held in high memory
Relocation registers used to protect user processes from each
other, and from changing operating-system code and data z
Base register contains value of smallest physical address
z
Limit register contains range of logical addresses – each logical address must be less than the limit register
z
MMU maps logical address dynamically
Operating System Concepts
Contiguous Allocation (Cont.) Multiple-partition allocation z
Hole – block of available memory; holes of various size are scattered throughout memory
z
When a process arrives, it is allocated memory from a hole large enough to accommodate it
z
Operating system maintains information about: a) allocated partitions b) free partitions (hole) OS
OS
OS
OS
process 5
process 5
process 5
process 5
process 9
process 9
process 8 process 2
process 10 process 2
process 2
process 2
File-System Interface
Operating System Concepts
File-System Interface File Concept Access Methods Directory Structure File-System Mounting File Sharing Protection
Operating System Concepts
File Concept Contiguous logical address space Types: z
Data numeric character binary
z
Program
Operating System Concepts
File Structure None - sequence of words, bytes Simple record structure z
Lines
z
Fixed length
z
Variable length
Complex Structures z
Formatted document
z
Relocatable load file
Can simulate last two with first method by inserting appropriate
control characters
Who decides: z
Operating system
z
Program
Operating System Concepts
File Attributes Name – only information kept in human-readable form Identifier – unique tag (number) identifies file within file system Type – needed for systems that support different types Location – pointer to file location on device Size – current file size Protection – controls who can do reading, writing, executing Time, date, and user identification – data for protection, security,
and usage monitoring Information about files are kept in the directory structure, which is
maintained on the disk
Operating System Concepts
File Types – Name, Extension
Operating System Concepts
Example of Index and Relative Files
Operating System Concepts
Directory Structure A collection of nodes containing information about all files
Directory
Files
F1
F2
F3
F4 Fn
Both the directory structure and the files reside on disk, Backups of these two structures are kept on tapes
Operating System Concepts
A Typical File-system Organization
Operating System Concepts
Single-Level Directory A single directory for all users
Naming problem Grouping problem
Operating System Concepts
Two-Level Directory Separate directory for each user
Path name Can have the same file name for different user Efficient searching No grouping capability
Operating System Concepts
Tree-Structured Directories
Operating System Concepts
Tree-Structured Directories (Cont) Absolute or relative path name Creating a new file is done in current directory Delete a file
rm Creating a new subdirectory is done in current directory
mkdir Example: if in current directory /mail mkdir count
mail prog
copy prt exp count
Deleting “mail” ⇒ deleting the entire subtree rooted by “mail”
Operating System Concepts
Acyclic-Graph Directories Have shared subdirectories and files
Operating System Concepts
Protection File owner/creator should be able to control: z
what can be done
z
by whom
Types of access z
Read
z
Write
z
Execute
z
Append
z
Delete
z
List
Mass-Storage Systems
Operating System Concepts
Overview of Mass Storage Structure
Magnetic disks provide bulk of secondary storage of modern computers z
Drives rotate at 60 to 200 times per second
z
Transfer rate is rate at which data flow between drive and computer
z
Positioning time (random-access time) is time to move disk arm to desired cylinder (seek time) and time for desired sector to rotate under the disk head (rotational latency)
z
Head crash results from disk head making contact with the disk surface
That’s bad
Disks can be removable
Drive attached to computer via I/O bus z
Busses vary, including EIDE, ATA, SATA, USB, Fibre Channel, SCSI
z
Host controller in computer uses bus to talk to disk controller built into drive or storage array
Operating System Concepts
Moving-head Disk Machanism
Operating System Concepts
Disk Structure Disk drives are addressed as large 1-dimensional arrays of logical
blocks, where the logical block is the smallest unit of transfer. The 1-dimensional array of logical blocks is mapped into the
sectors of the disk sequentially. z
Sector 0 is the first sector of the first track on the outermost cylinder.
z
Mapping proceeds in order through that track, then the rest of the tracks in that cylinder, and then through the rest of the cylinders from outermost to innermost.
I/O Systems
Operating System Concepts
I/O Systems I/O Hardware Application I/O Interface Kernel I/O Subsystem Transforming I/O Requests to Hardware Operations Streams Performance
Operating System Concepts
Objectives Explore the structure of an operating system’s I/O subsystem Discuss the principles of I/O hardware and its complexity Provide details of the performance aspects of I/O hardware and
software
Operating System Concepts
I/O Hardware Incredible variety of I/O devices Common concepts z
Port
z
Bus (daisy chain or shared direct access)
z
Controller (host adapter)
I/O instructions control devices Devices have addresses, used by z
Direct I/O instructions
z
Memory-mapped I/O
Operating System Concepts
Polling Determines state of device z
command-ready
z
busy
z
Error
Busy-wait cycle to wait for I/O from device
Operating System Concepts
Interrupts CPU Interrupt-request line triggered by I/O device Interrupt handler receives interrupts Maskable to ignore or delay some interrupts Interrupt vector to dispatch interrupt to correct handler z
Based on priority
z
Some nonmaskable
Interrupt mechanism also used for exceptions
Operating System Concepts
Interrupt-Driven I/O Cycle
Operating System Concepts
A Kernel I/O Structure
SCSI : small computer system interface
Operating System Concepts
Block and Character Devices Block devices include disk drives z
Commands include read, write, seek
z
Raw I/O or file-system access
z
Memory-mapped file access possible
Character devices include keyboards, mice, serial ports z
Commands include get, put
z
Libraries layered on top allow line editing
Operating System Concepts
Kernel I/O Subsystem Scheduling z
Some I/O request ordering via per-device queue
z
Some OSs try fairness
Buffering - store data in memory while transferring between
devices z
To cope with device speed mismatch
z
To cope with device transfer size mismatch
z
To maintain “copy semantics”
Operating System Concepts
Kernel I/O Subsystem Caching - fast memory holding copy of data z
Always just a copy
z
Key to performance
Spooling - hold output for a device z
If device can serve only one request at a time
z
i.e., Printing
Device reservation - provides exclusive access to a device z
System calls for allocation and deallocation
z
Watch out for deadlock
Operating System Concepts
I/O Protection User process may accidentally or purposefully attempt to disrupt
normal operation via illegal I/O instructions z
All I/O instructions defined to be privileged
z
I/O must be performed via system calls Memory-mapped
and I/O port memory locations must be
protected too z
Note : a system call, or software interrupt is the mechanism used by an application program to request service from the operating system. System calls often use a special machine code instruction which causes the processor to change mode (e.g. to "supervisor mode" or "protected mode"). This allows the OS to perform restricted actions such as accessing hardware devices or the memory management unit.
Operating System Concepts
Kernel Data Structures Kernel keeps state info for I/O components, including open file
tables, network connections, character device state Many, many complex data structures to track buffers, memory
allocation, “dirty” blocks Some use object-oriented methods and message passing to
implement I/O
Operating System Concepts
I/O Requests to Hardware Operations Consider reading a file from disk for a process: z
Determine device holding file
z
Translate name to device representation
z
Physically read data from disk into buffer
z
Make data available to requesting process
z
Return control to process
Operating System Concepts
Life Cycle of An I/O Request
Operating System Concepts
Performance I/O a major factor in system performance: z
Demands CPU to execute device driver, kernel I/O code
z
Context switches due to interrupts
z
Data copying
z
Network traffic especially stressful
Security
Operating System Concepts
The Security Problem Security must consider external environment of the system, and
protect the system resources Intruders (crackers) attempt to breach security Threat is potential security violation Attack is attempt to breach security Attack can be accidental or malicious Easier to protect against accidental than malicious misuse
Operating System Concepts
A Boot-sector Computer Virus
Operating System Concepts
Cryptography as a Security Tool Broadest security tool available z
Source and destination of messages cannot be trusted without cryptography
z
Means to constrain potential senders (sources) and / or receivers (destinations) of messages
Based on secrets (keys)
Operating System Concepts
Secure Communication over Insecure Medium
Operating System Concepts
Digital Certificates Proof of who or what owns a public key Public key digitally signed a trusted party Trusted party receives proof of identification from entity and
certifies that public key belongs to entity Certificate authority are trusted party – their public keys included
with web browser distributions z
They vouch for other authorities via digitally signing their keys, and so on
Operating System Concepts
Encryption Example - SSL Insertion of cryptography at one layer of the ISO network model
(the transport layer)
SSL – Secure Socket Layer (also called TLS) Cryptographic protocol that limits two computers to only exchange
messages with each other z
Very complicated, with many variations
Used between web servers and browsers for secure
communication (credit card numbers)
The server is verified with a certificate assuring client is talking to
correct server
Asymmetric cryptography used to establish a secure session key
(symmetric encryption) for bulk of communication during session
Communication between each computer theb uses symmetric key
cryptography
Distributed System Structures
Operating System Concepts
Motivation Distributed system is collection of loosely coupled processors
interconnected by a communications network
Processors variously called nodes, computers, machines, hosts z
Site is location of the processor
Reasons for distributed systems z
Resource sharing sharing
and printing files at remote sites
processing using
information in a distributed database
remote specialized hardware devices
z
Computation speedup – load sharing
z
Reliability – detect and recover from site failure, function transfer, reintegrate failed site
z
Communication – message passing
Operating System Concepts
A Distributed System
Operating System Concepts
Types of Distributed Operating Systems Network Operating Systems Distributed Operating Systems
Operating System Concepts
Network-Operating Systems Users are aware of multiplicity of machines. Access to
resources of various machines is done explicitly by: z
Remote logging into the appropriate remote machine (telnet, ssh)
z
Remote Desktop (Microsoft Windows)
z
Transferring data from remote machines to local machines, via the File Transfer Protocol (FTP) mechanism
Operating System Concepts
Distributed-Operating Systems Users not aware of multiplicity of machines z
Access to remote resources similar to access to local resources
Data Migration – transfer data by transferring entire file, or
transferring only those portions of the file necessary for the immediate task Computation Migration – transfer the computation, rather than the
data, across the system
Operating System Concepts
Distributed-Operating Systems (Cont.) Process Migration – execute an entire process, or parts of it, at
different sites z
Load balancing – distribute processes across network to even the workload
z
Computation speedup – subprocesses can run concurrently on different sites
z
Hardware preference – process execution may require specialized processor
z
Software preference – required software may be available at only a particular site
z
Data access – run process remotely, rather than transfer all data locally
Operating System Concepts
The Future…
In the future, computers will continue to become physically smaller and more portable.
Operating systems have to deal with issues like disconnected operation and mobility.
Media rich information within the grasp of common people - information with psuedo-real time components like voice and video.
Operating systems will have to adjust to deliver acceptable performance for these new forms of data.
Operating System Concepts
Finally
Operating systems are so large no one person understands whole system. Outlives any of its original builders.
The major problem facing computer science today is how to build large, reliable software systems.
Operating systems are one of very few examples of existing large software systems, and by studying operating systems we may learn lessons applicable to the construction of larger systems.