os concepts
TRANSCRIPT
Operating System ConceptsSystem StructureSystem Structure
System structured as a series of levels - each level performs a related subset of functionsEach level relies on the next lower level for more primitive functionsLayers Concepts
Hardware abstraction layerMicrokernelDevice drivers
Operating System Concepts
Computer System StructureComputer System Structure
Computer system can be divided into four componentsHardware – provides basic computing resources
CPU, memory, I/O devicesOperating 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
UsersPeople, machines, other computers
Operating System ConceptsFour Components of a Computer SystemFour Components of a Computer System
Operating System ConceptsOperating System ??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 coordinationThis coordination is handled by system software known as the operating system
Operating System ConceptsOperating System ??Operating System ??
What is an operating system?Hard to define precisely, because operating systems arose historically as people needed to solve problems associated with using computers.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 ConceptsOperating System ObjectivesOperating System Objectives
Operating systems are among the most critical pieces of softwareever developed
ConvenienceMakes the computer more convenient to use
EfficiencyAllows computer system resources to be used in an efficient manner
Ability to evolvePermit effective development, testing, and introduction of new system functions without interfering with service
Operating System ConceptsOperating System ServicesOperating System Services
Program developmentEditors, debuggers, frameworks
Program executionInitialization, scheduling
Access to I/O devicesUniform interface, hides details
Controlled access to filesAuthorization, sharing, caching
System accessProtection, authorization, resolve conflicts
Error detection and responseHardware errors: memory error or device failureSoftware errors: arithmetic errors, access forbidden memory locations, allocation errors
Operating System ConceptsOS as a Resource ManagerOS as a Resource Manager
OS executes same way as ordinary computer software - it is set of computer programsThe key difference is in the intent
Directs use of resourcesRelinquishes control of the processor to execute other programs
Kernel or nucleusPortion of operating system that is in main memoryContains most-frequently used functions
Operating System ConceptsEvolution of Operating SystemsEvolution of Operating Systems
Operating systems have evolved becauseNew types of hardware and hardware upgradesDevelopment of new services and needsFixes to OS faults
Serial Processing
Simple Batch Processing
Multi-programmed Batch Systems
Time-Sharing Systems
Distributed Processing Systems
Operating System Concepts
OS for batch jobsOS for batch jobs
Program execution required significant preparation of equipmentProgram execution (job)OS was a system to simplify program setup and simplify transition between jobsPhysical separation of users and equipment led to computer operatorsUsers left jobs with the operator and came back the next day (batch jobs)Users had no interaction with computer during program execution. Maybe okay for some applications, but not for all.
Operating System Concepts
OS for Interactive ProcessingOS for Interactive Processing
Allowed programs to carry on dialogue with user via remote terminals (workstations)Real-time processingUsers demand timely responseMachines too expensive to serve only one userCommon for several users to want interactive services at the same time
Operating System Concepts
OS for timeOS for time--sharingsharing
To accommodate multiple real-time users, the OS rotates its various jobs in and out of execution via time-sharingEach job gets a predetermined “time slice”At end of time slice current job is set aside and a new one startsBy rapidly shuffling jobs, illusion of several jobs executing simultaneously is createdWithout time slicing, a computer spends most of its time waitingfor peripheral devices or usersA collection of tasks can be completed in less time with time-sharing than when completed sequentially
Operating System Concepts
Different Operating Systems on the Same Machine ?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:
PCs -- DOS, Windows, or Linux
Operating System ConceptsDistributed Processing SystemsDistributed Processing Systems
Distributed operating systemsprovides the illusion of a single main memory and single secondary memory spaceused for distributed file system
Operating System ConceptsModern OS ArchitectureModern OS Architecture
Operating System ConceptsComputer StartupComputer Startup
bootstrap program is loaded at power-up or rebootTypically stored in ROM or EPROM, generally known as firmwareInitializates all aspects of systemLoads operating system kernel and starts execution
Operating System ConceptsComputer System OrganizationComputer System Organization
Computer-system operationOne or more CPUs, device controllers connect through common bus providing access to shared memoryConcurrent execution of CPUs and devices competing for memory cycles
Operating System ConceptsComputerComputer--System OperationSystem 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 buffersI/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 ConceptsStorage StructureStorage 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
Disk surface is logically divided into tracks, which are subdivided into sectors.The disk controller determines the logical interaction between the device and the computer.
Operating System ConceptsStorage HierarchyStorage Hierarchy
Storage systems organized in hierarchy.SpeedCostVolatility
Caching – copying information into faster storage system; main memory can be viewed as a last cache for secondary storage.
Operating System ConceptsStorageStorage--Device HierarchyDevice Hierarchy
Operating System ConceptsCachingCaching
Important principle, performed at many levels in a computer (in hardware, operating system, software)Information in use copied from slower to faster storage temporarilyFaster 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 cachedCache management important design problemCache size and replacement policy
Operating System Concepts
Migration of Integer A from Disk to RegisterMigration 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 cacheDistributed environment situation even more complex
Several copies of a datum can existVarious solutions covered in Chapter 17
Operating System Concepts
Memory Layout for Multiprogrammed SystemMemory Layout for Multiprogrammed System
OperatingOperating--System StructuresSystem Structures
Operating System ConceptsThe OS KernelThe OS Kernel
The internal part of the OS is often called the kernelKernel Components
File ManagerDevice DriversMemory ManagerSchedulerDispatcher
Operating System ConceptsUser Operating System Interface User Operating System Interface -- CLICLI
CLI allows direct command entrySometimes implemented in kernel, sometimes by systems programSometimes multiple flavors implemented – shellsPrimarily 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 ConceptsUser Operating System Interface User Operating System Interface -- GUIGUI
User-friendly desktop metaphor interfaceUsually mouse, keyboard, and monitorIcons represent files, programs, actions, etcVarious mouse buttons over objects in the interface cause various actions (provide information, options, execute function,open directory (known as a folder)Invented at Xerox PARC
Many systems now include both CLI and GUI interfacesMicrosoft Windows is GUI with CLI “command” shellApple Mac OS X as “Aqua” GUI interface with UNIX kernel underneath and shells availableSolaris is CLI with optional GUI interfaces (Java Desktop, KDE)
Operating System ConceptsSystem CallsSystem Calls
Programming interface to the services provided by the OSTypically 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 useThree 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 ConceptsAPI API –– System Call System Call –– OS RelationshipOS Relationship
Write()
Write()Implementation
of Write()
Operating System ConceptsStandard C Library ExampleStandard C Library Example
C program invoking printf() library call, which calls write() system call
Operating System ConceptsSimple Structure Simple Structure
MS-DOS – written to provide the most functionality in the least space
Not divided into modulesAlthough MS-DOS has some structure, its interfaces and levels of functionality are not well separated
Operating System ConceptsMSMS--DOS Layer StructureDOS Layer Structure
Operating System ConceptsLayered Operating SystemLayered Operating System
Operating System ConceptsMicrokernel System Structure Microkernel System Structure
Moves as much from the kernel into “user” spaceCommunication takes place between user modules using message passingBenefits:
Easier to extend a microkernelEasier to port the operating system to new architecturesMore reliable (less code is running in kernel mode)More secure
Detriments:Performance overhead of user space to kernel space communication
Operating System ConceptsSolaris Modular ApproachSolaris Modular Approach
Operating System ConceptsVirtual MachinesVirtual 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 hardwareA virtual machine provides an interface identical to the underlying bare hardwareThe operating system creates the illusion of multiple processes, each executing on its own processor with its own (virtual) memory
Operating System ConceptsVirtual Machines (Cont.)Virtual Machines (Cont.)
The resources of the physical computer are shared to create the virtual machines
CPU scheduling can create the appearance that users have their own processorSpooling and a file system can provide virtual card readers and virtual line printersA normal user time-sharing terminal serves as the virtual machine operator’s console
Operating System ConceptsVirtual MachinesVirtual Machines
Non-virtual Machine Virtual Machine
(a) Non-virtual machine (b) virtual machine
Operating System ConceptsVirtual Machines (Cont.)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 ofresources.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 ConceptsVMware ArchitectureVMware Architecture
Operating System ConceptsThe Java Virtual MachineThe Java Virtual Machine
Operating System Concepts
OperatingOperating--System OperationsSystem Operations
Process ManagementMemory ManagementStorage ManagementProtection and SecurityDistributed Systems
Processes Processes ……
Operating System ConceptsProcess ConceptProcess Concept
An operating system executes a variety of programs:Batch system – jobsTime-shared systems – user programs or tasks
Textbook uses the terms job and process almost interchangeablyProcess – a program in execution; process execution must progress in sequential fashionA process includes:
program counter stackdata section
Operating System ConceptsProcess in MemoryProcess in Memory
Operating System ConceptsProcess StateProcess State
As a process executes, it changes statenew: The process is being createdrunning: Instructions are being executedwaiting: The process is waiting for some event to occurready: The process is waiting to be assigned to a processorterminated: The process has finished execution
Operating System ConceptsDiagram of Process StateDiagram of Process State
Operating System ConceptsProcess Control Block (PCB)Process Control Block (PCB)
Information associated with each processProcess stateProgram counterCPU registersCPU scheduling informationMemory-management informationAccounting informationI/O status information
Operating System ConceptsProcess Control Block (PCB)Process Control Block (PCB)
Operating System ConceptsCPU Switch From Process to ProcessCPU Switch From Process to Process
Operating System ConceptsProcess CreationProcess Creation
Parent process create children processes, which, in turn create other processes, forming a tree of processesResource sharing
Parent and children share all resourcesChildren share subset of parent’s resourcesParent and child share no resources
ExecutionParent and children execute concurrentlyParent waits until children terminate
Operating System ConceptsProcess Creation (Cont.)Process Creation (Cont.)
Address spaceChild duplicate of parentChild has a program loaded into it
UNIX examplesfork system call creates new processexec system call used after a fork to replace the process’memory space with a new program
Operating System ConceptsProcess CreationProcess Creation
Operating System ConceptsProcess TerminationProcess Termination
Process executes last statement and asks the operating system todelete it (exit)
Output data from child to parent (via wait)Process’ resources are deallocated by operating system
Parent may terminate execution of children processes (abort)Child has exceeded allocated resourcesTask assigned to child is no longer requiredIf parent is exiting
Some operating system do not allow child to continue if its parent terminates
– All children terminated - cascading termination
Operating System ConceptsInterInter--process Communication (IPC)process Communication (IPC)
Mechanism for processes to communicate and to synchronize their actionsMessage system – processes communicate with each other without resorting to shared variablesIPC facility provides two operations:
send(message) – message size fixed or variable receive(message)
If P and Q wish to communicate, they need to:establish a communication link between themexchange messages via send/receive
Implementation of communication linkphysical (e.g., shared memory, hardware bus)logical (e.g., logical properties)
Operating System ConceptsCommunications Models Communications Models
Operating System ConceptsDirect CommunicationDirect Communication
Processes must name each other explicitly:send (P, message) – send a message to process Preceive(Q, message) – receive a message from process Q
Properties of communication linkLinks are established automaticallyA link is associated with exactly one pair of communicating processesBetween each pair there exists exactly one linkThe link may be unidirectional, but is usually bi-directional
Operating System ConceptsClientClient--Server CommunicationServer Communication
SocketsRemote Procedure CallsRemote Method Invocation (Java)
Operating System ConceptsSocketsSockets
A socket is defined as an endpoint for communicationConcatenation of IP address and portThe socket 161.25.19.8:1625 refers to port 1625 on host 161.25.19.8Communication consists between a pair of sockets
Operating System ConceptsSocket CommunicationSocket Communication
Operating System ConceptsRemote Procedure CallsRemote 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 ConceptsRemote Method InvocationRemote 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.
ThreadsThreads
Operating System ConceptsSingle and Multithreaded ProcessesSingle and Multithreaded Processes
Operating System ConceptsUser ThreadsUser Threads
Thread management done by user-level threads library
Three primary thread libraries:POSIX PthreadsWin32 threadsJava threads
Operating System ConceptsKernel ThreadsKernel Threads
Supported by the Kernel
ExamplesWindows XP/2000SolarisLinuxTru64 UNIXMac OS X
Operating System ConceptsMultithreading ModelsMultithreading Models
Many-to-One
One-to-One
Many-to-Many
Operating System ConceptsManyMany--toto--OneOne
Many user-level threads mapped to single kernel threadExamples:
Solaris Green ThreadsGNU Portable Threads
Operating System ConceptsManyMany--toto--One ModelOne Model
Operating System ConceptsOneOne--toto--OneOne
Each user-level thread maps to kernel threadExamples
Windows NT/XP/2000LinuxSolaris 9 and later
Operating System ConceptsOneOne--toto--one Modelone Model
Operating System ConceptsManyMany--toto--Many ModelMany Model
Allows many user level threads to be mapped to many kernel threadsAllows the operating system to create a sufficient number of kernel threadsSolaris prior to version 9Windows NT/2000 with the ThreadFiber package
Operating System ConceptsManyMany--toto--Many ModelMany Model
Operating System ConceptsTwoTwo--level Modellevel Model
Similar to M:M, except that it allows a user thread to be bound to kernel threadExamples
IRIXHP-UXTru64 UNIXSolaris 8 and earlier
Operating System ConceptsTwoTwo--level Modellevel Model
Operating System ConceptsThreading IssuesThreading Issues
Semantics of fork() and exec() system callsThread cancellationSignal handlingThread poolsThread specific dataScheduler activations
Operating System ConceptsThread CancellationThread Cancellation
Terminating a thread before it has finishedTwo general approaches:
Asynchronous cancellation terminates the target thread immediatelyDeferred cancellation allows the target thread to periodically check if it should be cancelled
Operating System ConceptsSignal HandlingSignal Handling
Signals are used in UNIX systems to notify a process that a particular event has occurredA signal handler is used to process signals1. Signal is generated by particular event2. Signal is delivered to a process3. Signal is handled
Options:Deliver the signal to the thread to which the signal appliesDeliver the signal to every thread in the processDeliver the signal to certain threads in the processAssign a specific thread to receive all signals for the process
Operating System ConceptsThread PoolsThread Pools
Create a number of threads in a pool where they await workAdvantages:
Usually slightly faster to service a request with an existing thread than create a new threadAllows the number of threads in the application(s) to be bound to the size of the pool
Operating System ConceptsJava Thread States Java Thread States
DeadlocksDeadlocks
Operating System ConceptsDeadlock ???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 ConceptsBridge Crossing ExampleBridge 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.
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 MemoryMain Memory
Operating System ConceptsObjectivesObjectives
To provide a detailed description of various ways of organizing memory hardwareTo discuss various memory-management techniques, including paging and segmentationTo provide a detailed description of the Intel Pentium, which supports both pure segmentation and segmentation with paging
Operating System ConceptsBackgroundBackground
Program must be brought (from disk) into memory and placed within a process for it to be runMain memory and registers are only storage CPU can access directlyRegister access in one CPU clock (or less)Main memory can take many cyclesCache sits between main memory and CPU registersProtection of memory required to ensure correct operation
Operating System ConceptsBase and Limit RegistersBase and Limit Registers
A pair of base and limit registers define the logical address space
Operating System Concepts
Binding of Instructions and Data to MemoryBinding of Instructions and Data to Memory
Address binding of instructions and data to memory addresses can happen at three different stages
Compile time: If memory location known a priori, absolute code can be generated; must recompile code if starting location changesLoad time: Must generate relocatable code if memory location is not known at compile timeExecution 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 ConceptsMultiMulti--step Processing of a User Program step Processing of a User Program
Operating System ConceptsLogical vs. Physical Address SpaceLogical 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
Logical address – generated by the CPU; also referred to as virtual addressPhysical 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 ConceptsContiguous AllocationContiguous Allocation
Main memory usually into two partitions:Resident operating system, usually held in low memory with interrupt vectorUser processes then held in high memory
Relocation registers used to protect user processes from each other, and from changing operating-system code and data
Base register contains value of smallest physical addressLimit register contains range of logical addresses – each logical address must be less than the limit register MMU maps logical address dynamically
Operating System ConceptsContiguous Allocation (Cont.)Contiguous Allocation (Cont.)
Multiple-partition allocationHole – block of available memory; holes of various size are scattered throughout memoryWhen a process arrives, it is allocated memory from a hole large enough to accommodate itOperating system maintains information about:a) allocated partitions b) free partitions (hole)
OS
process 5
process 8
process 2
OS
process 5
process 2
OS
process 5
process 2
process 9
OS
process 5
process 9
process 2
process 10
FileFile--System InterfaceSystem Interface
Operating System ConceptsFileFile--System InterfaceSystem Interface
File ConceptAccess MethodsDirectory StructureFile-System MountingFile SharingProtection
Operating System ConceptsFile ConceptFile Concept
Contiguous logical address space
Types: Data
numericcharacterbinary
Program
Operating System ConceptsFile StructureFile Structure
None - sequence of words, bytesSimple record structure
Lines Fixed lengthVariable length
Complex StructuresFormatted documentRelocatable load file
Can simulate last two with first method by inserting appropriatecontrol charactersWho decides:
Operating systemProgram
Operating System ConceptsFile AttributesFile Attributes
Name – only information kept in human-readable formIdentifier – unique tag (number) identifies file within file systemType – needed for systems that support different typesLocation – pointer to file location on deviceSize – current file sizeProtection – controls who can do reading, writing, executingTime, date, and user identification – data for protection, security, and usage monitoringInformation about files are kept in the directory structure, which is maintained on the disk
Operating System ConceptsFile Types File Types –– Name, ExtensionName, Extension
Operating System ConceptsExample of Index and Relative FilesExample of Index and Relative Files
Operating System ConceptsDirectory StructureDirectory Structure
A collection of nodes containing information about all files
F 1 F 2F 3
F 4
F n
Directory
Files
Both the directory structure and the files reside on disk,Backups of these two structures are kept on tapes
Operating System ConceptsA Typical FileA Typical File--system Organizationsystem Organization
Operating System ConceptsSingleSingle--Level DirectoryLevel Directory
A single directory for all users
Naming problem
Grouping problem
Operating System ConceptsTwoTwo--Level DirectoryLevel Directory
Separate directory for each user
Path nameCan have the same file name for different userEfficient searchingNo grouping capability
Operating System ConceptsTreeTree--Structured DirectoriesStructured Directories
Operating System ConceptsTreeTree--Structured Directories (Cont)Structured Directories (Cont)
Absolute or relative path nameCreating a new file is done in current directoryDelete a file
rm <file-name>Creating a new subdirectory is done in current directory
mkdir <dir-name>Example: if in current directory /mail
mkdir count
exp countprog copy prt
Deleting “mail” ⇒ deleting the entire subtree rooted by “mail”
Operating System ConceptsAcyclicAcyclic--Graph DirectoriesGraph Directories
Have shared subdirectories and files
Operating System ConceptsProtectionProtection
File owner/creator should be able to control:what can be doneby whom
Types of accessReadWriteExecuteAppendDeleteList
MassMass--Storage SystemsStorage Systems
Operating System ConceptsOverview of Mass Storage StructureOverview of Mass Storage Structure
Magnetic disks provide bulk of secondary storage of modern computersDrives rotate at 60 to 200 times per secondTransfer rate is rate at which data flow between drive and computerPositioning 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)Head crash results from disk head making contact with the disk surface
That’s badDisks can be removableDrive attached to computer via I/O bus
Busses vary, including EIDE, ATA, SATA, USB, Fibre Channel, SCSIHost controller in computer uses bus to talk to disk controller built into drive or storage array
Operating System ConceptsMovingMoving--head Disk head Disk MachanismMachanism
Operating System ConceptsDisk StructureDisk 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.
Sector 0 is the first sector of the first track on the outermostcylinder.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 SystemsI/O Systems
Operating System ConceptsI/O SystemsI/O Systems
I/O HardwareApplication I/O InterfaceKernel I/O SubsystemTransforming I/O Requests to Hardware OperationsStreamsPerformance
Operating System ConceptsObjectivesObjectives
Explore the structure of an operating system’s I/O subsystemDiscuss the principles of I/O hardware and its complexityProvide details of the performance aspects of I/O hardware and software
Operating System ConceptsI/O HardwareI/O Hardware
Incredible variety of I/O devicesCommon concepts
PortBus (daisy chain or shared direct access)Controller (host adapter)
I/O instructions control devicesDevices have addresses, used by
Direct I/O instructionsMemory-mapped I/O
Operating System ConceptsPollingPolling
Determines state of device command-readybusyError
Busy-wait cycle to wait for I/O from device
Operating System ConceptsInterruptsInterrupts
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 handlerBased on prioritySome nonmaskable
Interrupt mechanism also used for exceptions
Operating System ConceptsInterruptInterrupt--Driven I/O CycleDriven I/O Cycle
Operating System ConceptsA Kernel I/O StructureA Kernel I/O Structure
SCSI : small computer system interface
Operating System ConceptsBlock and Character DevicesBlock and Character Devices
Block devices include disk drivesCommands include read, write, seek Raw I/O or file-system accessMemory-mapped file access possible
Character devices include keyboards, mice, serial portsCommands include get, putLibraries layered on top allow line editing
Operating System ConceptsKernel I/O SubsystemKernel I/O Subsystem
SchedulingSome I/O request ordering via per-device queueSome OSs try fairness
Buffering - store data in memory while transferring between devices
To cope with device speed mismatchTo cope with device transfer size mismatchTo maintain “copy semantics”
Operating System ConceptsKernel I/O SubsystemKernel I/O Subsystem
Caching - fast memory holding copy of dataAlways just a copyKey to performance
Spooling - hold output for a deviceIf device can serve only one request at a time i.e., Printing
Device reservation - provides exclusive access to a deviceSystem calls for allocation and deallocationWatch out for deadlock
Operating System ConceptsI/O ProtectionI/O Protection
User process may accidentally or purposefully attempt to disruptnormal operation via illegal I/O instructions
All I/O instructions defined to be privilegedI/O must be performed via system calls
Memory-mapped and I/O port memory locations must be protected too
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 theOS to perform restricted actions such as accessing hardware devices or the memory management unit.
Operating System ConceptsKernel Data StructuresKernel 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 ConceptsI/O Requests to Hardware OperationsI/O Requests to Hardware Operations
Consider reading a file from disk for a process:
Determine device holding file Translate name to device representationPhysically read data from disk into bufferMake data available to requesting processReturn control to process
Operating System ConceptsLife Cycle of An I/O RequestLife Cycle of An I/O Request
Operating System ConceptsPerformancePerformance
I/O a major factor in system performance:
Demands CPU to execute device driver, kernel I/O codeContext switches due to interruptsData copyingNetwork traffic especially stressful
SecuritySecurity
Operating System ConceptsThe Security ProblemThe Security Problem
Security must consider external environment of the system, and protect the system resourcesIntruders (crackers) attempt to breach securityThreat is potential security violationAttack is attempt to breach securityAttack can be accidental or maliciousEasier to protect against accidental than malicious misuse
Operating System ConceptsA BootA Boot--sector Computer Virussector Computer Virus
Operating System ConceptsCryptography as a Security ToolCryptography as a Security Tool
Broadest security tool availableSource and destination of messages cannot be trusted without cryptographyMeans to constrain potential senders (sources) and / or receivers (destinations) of messages
Based on secrets (keys)
Operating System ConceptsSecure Communication over Insecure MediumSecure Communication over Insecure Medium
Operating System ConceptsDigital CertificatesDigital Certificates
Proof of who or what owns a public keyPublic key digitally signed a trusted partyTrusted party receives proof of identification from entity and certifies that public key belongs to entityCertificate authority are trusted party – their public keys included with web browser distributions
They vouch for other authorities via digitally signing their keys, and so on
Operating System ConceptsEncryption Example Encryption Example -- SSLSSL
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
Very complicated, with many variationsUsed between web servers and browsers for secure communication (credit card numbers)The server is verified with a certificate assuring client is talking to correct serverAsymmetric cryptography used to establish a secure session key(symmetric encryption) for bulk of communication during sessionCommunication between each computer theb uses symmetric key cryptography
Distributed System StructuresDistributed System Structures
Operating System ConceptsMotivationMotivation
Distributed system is collection of loosely coupled processors interconnected by a communications networkProcessors variously called nodes, computers, machines, hosts
Site is location of the processorReasons for distributed systems
Resource sharingsharing and printing files at remote sitesprocessing information in a distributed databaseusing remote specialized hardware devices
Computation speedup – load sharingReliability – detect and recover from site failure, function transfer, reintegrate failed siteCommunication – message passing
Operating System ConceptsA Distributed SystemA Distributed System
Operating System ConceptsTypes of Distributed Operating SystemsTypes of Distributed Operating Systems
Network Operating SystemsDistributed Operating Systems
Operating System ConceptsNetworkNetwork--Operating SystemsOperating Systems
Users are aware of multiplicity of machines. Access to resources of various machines is done explicitly by:
Remote logging into the appropriate remote machine (telnet, ssh)Remote Desktop (Microsoft Windows)Transferring data from remote machines to local machines, via the File Transfer Protocol (FTP) mechanism
Operating System ConceptsDistributedDistributed--Operating SystemsOperating Systems
Users not aware of multiplicity of machinesAccess to remote resources similar to access to local
resourcesData Migration – transfer data by transferring entire file, or transferring only those portions of the file necessary for the immediate taskComputation Migration – transfer the computation, rather than the data, across the system
Operating System ConceptsDistributedDistributed--Operating Systems (Cont.)Operating Systems (Cont.)
Process Migration – execute an entire process, or parts of it, at different sites
Load balancing – distribute processes across network to even the workloadComputation speedup – subprocesses can run concurrently on different sitesHardware preference – process execution may require specialized processorSoftware preference – required software may be available at only a particular siteData access – run process remotely, rather than transfer all data locally
Operating System ConceptsThe FutureThe 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 ConceptsFinallyFinally
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.