600 likes | 1.09k Vues
Chapter 2: Operating System Overview CS 472 Operating Systems Indiana University – Purdue University Fort Wayne Mark Temte Operating system overview An example of computing without an operating system Session scheduling and set-up time Front panel lights and toggle switches
E N D
Chapter 2: Operating System Overview CS 472 Operating Systems Indiana University – Purdue University Fort Wayne Mark Temte
Operating system overview • An example of computing without an operating system • Session scheduling and set-up time • Front panel lights and toggle switches • Bootstrap loader on paper tape • Compiler on cards • Source deck • Paper tape object file • Data deck • Execution
Operating system objectives • Convenience • Makes the computer more convenient to use • Efficiency • Allows computer system resources to be used in an efficient manner • Ability to evolve • Permit effective development, testing, and introduction of new system functions without interfering with service
Operating system kernel • The kernel is a portion of operating system that is always in main memory • It contains most frequently used functions • Also called the nucleus
Convenience • Services provided by the operating system • Program development • Editors and debuggers • Program execution • Access to I/O devices • Controlled access to files • System access • Login and passwords • Error detection and response • Accounting
Error detection and response • Internal and external hardware errors • Memory error • Device failure • Software errors • Arithmetic overflow • Access forbidden memory locations • Operating system cannot grant a request made by an application
Accounting • Collect usage statistics • Monitor performance • This information can be used . . . • to anticipate future enhancements • for billing purposes
Efficiency • The OS promotes efficiency by managing resources • Processor(s) • Memory • Devices • Files • The OS functions same way as ordinary computer software • It is program that is executed • The OS frequently relinquishes control of the processor and relies on the processor to regain control
Ability to evolve • A major OS should be able to evolve over time in response to . . . • Hardware upgrades and new types of hardware such as • Paging hardware for virtual memory • Multiple processors • New services such as • Overlapping windows • Client / server computing • Errors in the OS
Evolution of operating systems • Serial processing • Simple batch systems • Multiprogrammed batch systems • Time-sharing systems
Serial processing (discussed earlier) • No operating system • Manual scheduling of use • Computer operated from a console with display lights, toggle switches, input device, and printer • Setup included . . . • Loading the compiler • Loading the source program • Saving compiled program • Loading and linking object files
Simple batch systems • Developed in the 1950s by GM for the IBM 701 • Simple batch OS called a monitor • Monitor software controlled a sequence of jobs • A batch of sequential jobs was loaded into a card tray • The monitor called the first (next) job • Each job program branched back to monitor when finished • Only one user job could run at a time • Processor idle waiting for I/O • But idle time between jobs and within jobs eliminated
Job Control Language (JCL) • A special type of programming language • Provides commands to the monitor • Identifies new jobs • Specifies what compiler to use • Specifies which object files to load and link • Specifies what data to use • Etc.
Job Control Language (JCL) • Example of JCL cards (with / /) in a deck / / JOB / / FORT < source program cards > / / LOAD / / RUN < data cards > / / END Protection After an //END card or an error, the monitor flushes cards until the next //JOB card
Hardware support for simple batch • Memory protection • Does not allow the memory area containing the monitor to be altered by a job • Timer • Prevents a job from monopolizing the system • Privileged instructions • Certain machine level instructions can only be executed by the monitor • E.g. - I/O instructions (a program should not read cards of next job) • Note: a program “requests” that the monitor perform the instruction • Interrupts • Allow processor to do something else while waiting for I/O • Early computer models did not have this capability
Hardware support for simple batch • The need for memory protection and privileged instructions led to the concept of processor modes • A bit in the PSW register toggles the processor between user mode and kernel mode • Each user program executes in user mode • Certain privileged instructions may not be executed • Only the program area may be referenced • The monitor executes in kernel mode • Privileged instructions may be executed • Protected areas of memory may be accessed
Multiprogrammed batch systems • Several jobs resident in memory simultaneously • Gives processor something to do while one job is waiting for I/O
Multiprogrammed batch systems • In these systems . . . • Interrupt-driven DMA emerged • This was the start of multiprocessing • Concept of logical (vrs. physical) devices emerged
Time-sharing systems • Adds an interactive computing capability to a multiprogrammed batch system • Processor’s time is shared among multiple interactive users • Multiple users simultaneously access the system through terminals • Essential for transaction processing systems • Example: Compatible Time-Sharing System (CTSS) • First time-sharing system • Developed at MIT in 1961 for the IBM 709
Problems • Multiprogramming and time sharing led to the identification of new problems • Memory protection • File security • Contention for resources • E.g. - printers
Major achievements • Processes • Focus of chapters 3, 4, 5, and 6 • Memory management • Focus of chapters 7 and 8 • Information protection and security • Focus of chapters 12 and 16 • Scheduling and resource management • Focus of chapters 9, 10, and 11 • System structure
Major achievement – process • A process is . . . • A program in execution • An instance of a program running on a computer • An entity that can be assigned to and executed on a processor • Activity characterized by a current state and an associated set of system resources
A process consists of . . . • Activity • An executable program • Data • Variables • Work space (stack) • Buffers • Etc. • Execution context (process state) • All information the operating system needs to manage the process • Registers (PC, PSW, registers) • Pending I/O • Allocated memory • Priority and privilege
A context switch • A context switch is where . . . • The hardware context registers (hardware Process Control Block or hardware PCB) of the old process are saved in its context area in memory • The hardware PCB of the new process is restored from its context area of memory • This is similar to a subprogram call • But includes the PSW and stack pointer • Implemented in hardware • An interrupt, for example, results in a context switch • From the interrupted program to the interrupt handler
A context switch processor hardware process control block registers context context switch registers data process data structure activity memory
Problems leading to process concept • Multiprogrammed batch • Many jobs in memory simultaneously • Need to isolate one job from the others • Need to switch among jobs at I/O start and end • Time sharing • Need to switch rapidly due to a timer interrupt • Need for responsiveness • Real-time transaction processing • Many jobs share information and memory
Problems leading to process concept • See the paragraph before the bullets, text p. 67 • Four main causes of errors • Improper synchronization • Failed mutual exclusion • Deadlock • Nondeterminate program operation
Problems leading to process concept • Improper synchronization • Data is lost or duplicate data is received • A process initiating I/O must wait until the handler process detects completion • Mutual exclusion • Two process must not book the same seat on an airplane • Example from transaction processing
Problems leading to process concept • Deadlock • Common for two processes to hang up waiting for each other • For example, one process may want to copy disk to tape while another copies the tape to disk • Nondeterminate program operation • Outputs or success of an operation depends on the scheduling of unrelated programs • Hard to debug because the condition that produced the error is difficult to reproduce
Major achievement – memory management • Responsibilities of memory management • Process isolation • Transparent allocation and management of memory within a process across the memory hierarchy • Virtual memory • Real (main) memory • Cache memory • Support of modular programming • Dynamic creation, resizing, and deallocation of program modules • Protection and access control • Controlled sharing of memory among processes • Long-term storage in files
Major achievement – information protection and security • Availability • Concerned with protecting the system against interruption • Confidentiality • Assuring that users cannot read data for which access is unauthorized • Data integrity • Protection of data from unauthorized modification • Authenticity • Concerned with the proper verification of the identity of users and the validity of messages or data
Major achievement – scheduling and resource management • Fairness • Give equal and fair access to resources within the same class • Differential responsiveness • Discriminate among different classes of jobs • Efficiency • Maximize throughput, minimize response time, and accommodate as many users as possible
Major achievement – system structure • In a large OS, modularity is necessary but not sufficient • View the system as a series of layers • Each layer performs a related subset of functions • Each layer relies on lower levels to perform more primitive functions • Each layer provides services to higher levels • Think client / server computing • The text identifies 13 levels
Hardware levels (not part of OS) • Level 1 • Electronic circuits • Objects are registers, memory cells, and logic gates • Operations are clearing a register or reading a memory location • Level 2 • Processor’s instruction set • Operations such as add, subtract, load, and store • Level 3 • Adds the concept of a procedure or subroutine, plus call/return operations • Level 4 • Interrupts • Interrupt handling routines are part of the OS
Multiprogramming levels • Level 5 • Concept of the process is supported • Ability to suspend and resume processes (context switch) • Synchronization primitives implemented • Level 6 • Secondary storage devices • Transfer of blocks of data • Level 7 • Creates logical address space for processes • Organizes virtual address space into blocks
Support for external devices / networks • Level 8 • Communication of information and message passing • Level 9 • Supports long-term storage of named files • Level 10 • Provides access to external devices using standardized interfaces
Support for external devices / networks • Level 11 • Responsible for maintaining the association between the external and internal identifiers • Level 12 • Provides full-featured facility for the support of processes • Level 13 • Provides an interface to the operating system for the user • Called a shell or an Application Programming Interface (API)
Modern OS characteristics • Microkernel architecture • There is no monolithic OS kernel with most OS features • Kernel has only a few essential functions • Address spaces • Interprocess communication (IPC) • Basic scheduling • Other traditional OS features are distributed among user mode processes
Modern OS characteristics • Multithreading • A process is divided into threads that can run concurrently • Thread • Dispatchable unit of work • Includes registers and a stack • Executes sequentially and is interruptable • Process is a collection of one or more threads • A thread switch has less overhead than a process switch
Modern OS characteristics • Symmetric MultiProcessing (SMP) • There are multiple processors • These processors share same main memory and I/O facilities • All processors are equivalent and can perform the same functions • True parallel processing is possible • Processors may be added and removed • The number of processors is transparent to applications
Modern OS characteristics • Distributed operating system • This is an OS for a cluster of separate computers (multicomputer system) • Separate main memories, disks, and devices • Provides the illusion of a single main memory space, a single secondary memory space, and unified access to all devices
Example systems • Microsoft Windows • UNIX • Traditional • Modern • Linux
Microsoft Windows • Impressive OS • Single-user multitasking OS that evolved out of MS-DOS • Modular structure for flexibility • Any module can be removed, upgraded, or replaced without rewriting the entire system • Executes on a variety of hardware platforms • Pentium, Itanium, PowerPC, Alpha, etc. • Provided by the Hardware Abstraction Layer (HAL) • This isolates the operating system from platform-specific hardware differences • Supports applications written for other operating systems • This is provided by various environment subsystems