* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download ICS 111 - University of Hawaii
		                    
		                    
								Survey							
                            
		                
		                
                            
                            
								Document related concepts							
                        
                        
                    
						
						
							Transcript						
					
					Chapter 1: Introduction • ICS 240: Operating Systems – William Albritton • Information and Computer Sciences Department at Leeward Community College – – 5/23/2017 Original slides by Silberschatz, Galvin, and Gagne ©2007 from Operating System Concepts with Java, 7th Edition with some modifications Also includes material by Dr. Susan Vrbsky from the Computer Science Department at the University of Alabama 1 What is an Operating System? • A program that acts as an intermediary between a user of a computer and the computer hardware. – Hardware includes • Processors, main memory, clocks, terminals, disks, network interfaces, I/O (Input & Output) devices – OS (operating system) is a layer of software on top of the hardware • 5/23/2017 OS can give the illusion of a machine different from the actual hardware 2 OS Goals • Three general goals of an OS 1. Execute user programs 2. Make computer system convenient to use 3. Use computer hardware in an efficient manner • Usually must find a tradeoff between efficiency & convenience, as they can conflict with one another 5/23/2017 3 OS Functions • Three specific functions of OS 1. OS controls and coordinates the use of the hardware • OS used to be called the control program 2. OS prevents errors and improper use of computer. 3. OS is a resource allocation manager. • 5/23/2017 Resources are: CPU time, memory space, file storage space, etc. 4 Computer System Structure • Computer systems can be divided into four components 1. Hardware • provides basic computing resources – CPU, memory, I/O devices 2. Operating system • 5/23/2017 Controls and coordinates use of hardware among various applications and users 5 Computer System Structure • Computer systems can be divided into four components (continued) 3. 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 4. Users • 5/23/2017 People, machines, other computers 6 Computer System’s Parts 5/23/2017 7 Operating System Definition • No universally accepted definition – “Everything a vendor ships when you order is an operating system” is good approximation • But varies wildly 5/23/2017 8 Operating System Definition • Common definition – An OS is “the one program running at all times on the computer” • Called the kernel • Everything else is either a system program (enables hardware & software to work together) or an application program (user program) 5/23/2017 9 The Kernel • The kernel is the fundamental portion of the OS needed to use the hardware – OS traditionally seen as the kernel, however, vendors now packaging kernel plus system programs (e.g. compilers, editors) as OS 5/23/2017 10 The Busy Kernel • Typical tasks performed by the kernel – – – – manages memory manages devices (e.g.. disks, printers) manages files (tree structured directory) implements processes (schedules, synchronizes, communication between) – provides protection – provides error detection – implements network access 5/23/2017 11 Computer Startup • The bootstrap program is the initial program that is run at power-up or reboot – Initializes all aspects of system – Loads operating system kernel and starts execution 5/23/2017 12 Computer System Organization • Computer-system operation – One or more CPUs, device controllers connect through common bus providing access to shared memory • CPU (central processing unit) performs calculations on data • Memory (memory storage unit) stores instructions & data while a computer program is running – Note that the CPU & memory work closely together in order to run a program 5/23/2017 13 Buses • Set of wires or connections for data transfer 1. Address bus – address of memory location (or I/O port) 2. Control bus – read (fetch) or write (store) commands 3. Data bus – 5/23/2017 data to be stored, or instructions to be used 14 Computer System Organization • Computer-system operation – CPU & devices compete for memory 5/23/2017 15 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. • A buffer is a intermediate place where data is temporarily stored while being moved from one location to another 5/23/2017 16 Computer-System Operation • CPU moves data from/to main memory to/from local buffers • I/O moves data from the device to local buffer of controller. – Device controller informs CPU that it has finished its operation by causing an interrupt. • An interrupt is a signal indicating that an event has occurred 5/23/2017 17 Common Functions of Interrupts • When the CPU receives an interrupt, – it must save the current state of the running program & execute the interrupt routine • An interrupt routine is a method • Once the CPU is finished running the interrupt routine, – the CPU must transfer back to the original program from the place where it left off • Note that the CPU can only execute one instruction from a program at a time 5/23/2017 18 Common Functions of Interrupts • An operating system is interrupt driven. – OS invoked when (different events may cause an interrupt) • • • • 5/23/2017 System Calls - user issues I/O request Hardware devices - I/O device Errors - division by 0 Console (operator interrupt) - operator can signal interrupt 19 Interrupt Timeline 5/23/2017 20 Structure of CPU • CPU – central processing unit • EU: execution unit • Data, pointer, & index registers (storage locations) – • • • 5/23/2017 ALU – arithmetic and logic unit CU – control unit (executes instructions) BIU: bus interface unit • • • A register is a high-speed storage location in the CPU (think of it as a hardware variable) Segment & IP registers (memory addressing) BCU: bus control unit (data transfer) Clock – synchronizes operations 21 Instruction Execution Cycle • CPU keeps looping through these steps 1. Fetch (read) instruction from memory & increment instruction pointer (IP) register • • 2. 3. 4. 5. 5/23/2017 Has address of next instruction to be executed Also called the “Program Counter” (PC) Decode the instruction Fetch (read) data from memory Execute the instruction Store (write) result in memory 22 Storage Structure • Main memory – Within the memory storage unit – Only large storage media that the CPU can access directly. – Another name for main memory is RAM • RAM (Random Access Memory) means that the data stored in memory can be accessed at random (in any order) – In other words, where the data is stored in memory does not influence the time required to return the data 5/23/2017 23 Storage Structure • To run a program, the program must have be loaded into main memory – – Ideally programs & data should be stored in main memory permanently Not practical because 1. Main memory too small & too expensive 2. Main memory is volatile (needs power, or data is lost) 5/23/2017 24 Storage Structure • Secondary storage – Extension of main memory that provides large nonvolatile storage capacity. • A typical example is 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. 5/23/2017 25 Storage Hierarchy • Storage systems organized in hierarchy. – Speed • Faster access to data at top of hierarchy – Cost • More expensive storage at top of hierarchy – Volatility • Power is required to store data at top of hierarchy, with cutoff at electronic disk 5/23/2017 26 Storage-Device Hierarchy 5/23/2017 27 Caching • Important principle, performed at many levels in a computer (in hardware, operating system, software) – Information being used is copied from slower storage to faster storage temporarily • This temporary storage place is called a “cache” – Pronounced like “cash” • For example, because data in memory is much slower to access than data in the CPU, the CPU has a cache to store recently used instructions and data – See Figure 2-2 on the Processor Architecture link 5/23/2017 28 Caching • Faster storage (cache) checked first to determine if data is there – If it is, data read directly from the cache – If not, read data from the slower storage & put a copy in the faster cache • For example, web browsers have a cache of the most recently viewed web pages • Caches have a limited size – Cache management important design problem 5/23/2017 29 Various Levels of Storage • Details on levels of storage hierarchy 5/23/2017 30 Acronyms • CMOS – Complementary metal–oxide–semiconductor • Type of integrated circuit • SRAM – Static random access memory • Does not have to be refreshed, but is volatile • DRAM – Dynamic random access memory • Charge does need refreshing (within 1 millisecond) & is volatile 5/23/2017 31 Data Migration • Migration of Integer A from Disk to Register – Data is stored in multiple places when it is being moved from storage to the CPU & back • Must be careful to use most recent value, no matter where it is stored in the storage hierarchy 5/23/2017 32 Data Migration • Multiprocessor environment must provide cache coherency in hardware such that all CPUs have the most recent data value in their cache • Distributed environment situation even more complex – Several copies of the data can exist on different computers 5/23/2017 33 Operating System Structure • Multiprogramming needed for efficiency – Single user cannot keep CPU and I/O devices busy at all times – Multiprogramming organizes jobs, so CPU always has one to execute • A job is a program in execution (a running program) – A subset of total jobs in system is kept in memory – Job scheduling is an algorithm (a plan) to select which job to run – When it has to wait (for I/O for example) in one job, OS switches to another job 5/23/2017 34 Operating System Structure • Timesharing (multitasking) – Logical extension of multiprogramming – 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 – A program loaded into memory & running is called a process – In other words, a process is a program in execution • For example, a server running a portal such as MyUH 5/23/2017 35 Memory for Multiprogramming 5/23/2017 36 Operating-System Operations • Similar to the interrupts created by hardware, software errors or requests create exceptions or traps – Division by zero, request for operating system service • Other process problems include infinite loop, processes modifying each other or the operating system 5/23/2017 37 Operating-System Operations • Dual-mode operation allows OS to protect itself and other system components – User mode and kernel mode – Mode bit provided by hardware • Provides ability to distinguish when system is running user code or kernel code • Some instructions designated as privileged, only executable in kernel mode • System call changes mode to kernel mode, return from call resets it to user mode – This prevents user programs from writing over the operating system with data 5/23/2017 38 User & Kernel Mode 5/23/2017 39 Process Management • A process is a program in execution. – It is a unit of work within the system. • A program is a passive entity, process is an active entity. • Process needs resources to accomplish its task – CPU, memory, I/O, files • Process termination requires reclaim of any reusable resources 5/23/2017 40 Process Management Activities • The operating system is responsible for the following activities in connection with process management 1. Creating and deleting both user and system processes 2. Suspending and resuming processes 3. Providing mechanisms for process synchronization, process communication, & deadlock handling 5/23/2017 41 Memory Management • Memory management determines what is in memory when – All data for a process must be placed in memory at some time in order for the CPU to access the data • Data stored on a disk must be placed in memory for a CPU to directly access it – All instructions for a process must also be placed in memory in order for a program to execute 5/23/2017 42 Memory Management • Memory management activities that the OS is responsible for 1. Keeping track of which parts of memory are currently being used and by whom 2. Deciding which processes (or parts thereof) and data to move into and out of memory 3. Allocating & deallocating memory space • 5/23/2017 For example, a local variable in a method is allocated to memory when that method is called, then the local variable is deallocated when the method returns 43 Storage Management • OS provides uniform, logical view of information storage – A file is a logical storage unit which is an abstraction of physical properties • For example, the user does not have to think about exactly how a file is stored on a magnetic disk, as these details are abstracted away by the OS – 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. 5/23/2017 44 Storage Management • File-System management – – – Files usually organized into directories (folders) Access control on most systems to determine who can access what OS activities include 1. Creating and deleting files and directories (folder) 2. Mapping files onto secondary storage 3. File & directory access control 5/23/2017 45 Disk Management • 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 Entire speed of computer operation hinges on disk subsystem and its algorithms OS activities 1. Free-space management 2. Storage allocation 3. Disk scheduling 5/23/2017 46 Protection and Security • Protection – Any mechanism for controlling access of processes or users to resources defined by the OS • Improves reliability by detecting errors • Protection against an unauthorized or incompetent user • Security – Defense of the system against internal and external attacks • Huge range, including denial-of-service, worms, viruses, identity theft, theft of service – Because of the increase in security threats, security is becoming more & more important to businesses as well as researchers 5/23/2017 47 Protection and Security • Systems generally first distinguish among users, to determine who can do what – Most OS keep a list of user names & associated user identifiers (user IDs) • Each user ID is unique, one per user • User ID is associated with all files and processes that user has been given access control • When the user logs into a system, the corresponding user ID is determined & the user is given access only to the user’s files & processes 5/23/2017 48 Computing Environments • Client-Server Computing – Many systems are now servers, responding to requests generated by clients • Clients ask for requests & servers provide services – For example, file-server, such as a web server, provides interface for clients to store and retrieve files 5/23/2017 49 Peer-to-Peer Computing • Another model of distributed system • P2P does not distinguish clients and servers – Instead all nodes are considered peers – 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 5/23/2017 50 Computing Environments • A current trend is to provide more access to computers – Office environment • Used to be terminals attached to mainframe, and then PCs connected to a network • Now portals allowing networked and remote systems access to same resources – Home environment • Used to be single system with no network connections, then modems • Now networked 5/23/2017 51 Web-Based Computing • Web has become ubiquitous – Ubiquitous is a fancy word that computer folks like to say which simply means being everywhere at once • More devices becoming networked to allow web access – Use of operating systems like Windows 95, which was only a web client, have evolved into Linux and Windows XP, which can be clients and servers 5/23/2017 52 History of OS • 0th generation – 100 BCE • Antikythera Mechanism by the Greeks – Complex system of gears for astronomical calculations – http://antikythera-mechanism.gr/ – 1400s • Incas had digital computers using ropes & pulleys – Knots in rope used as a binary code that could calculate such things as calendar dates & tax records – http://www.osdata.com/book.pdf 5/23/2017 53 History of OS • 0th generation – Charles Babbage (1792 - 1871) • • • • Designed the first digital computer Used wheels, cogs, gears Couldn't produce precision needed Ada Lovelace was world’s 1st programmer – None of these 0th generation computer systems had an OS 5/23/2017 54 History of OS • 1st generation of computer systems 1945 - 1955 – Hardware consisted of rooms with 20,000 or more vacuum tubes • Had to use a plugboard to program the computer – User acted as operator • Only could do basic calculations • All programming in machine language – Still no OS 5/23/2017 55 History of OS • 2nd generation systems 1955 - 1965 – Hardware was transistors – Batch jobs were used for programming • Many programs run one after another by reading punch cards into a magnetic tape which was carried to another computer for input • Output produced another magnetic tape that was carried to another computer for printed output – Hired operators instead of user to set up jobs • Therefore first OS needed and created (resident monitor) – No interaction between user and program – Compilers added and loaded from tape • FORTRAN (scientific computer language) • COBOL (business computer language) 5/23/2017 56 History of OS • 3rd generation systems 1965 - 1980 – Hardware was Integrated Circuits (IC) with a few transistors – Multiprogramming • More than one job loaded into memory – illusion of more than one job running - pseudo parallelism increases CPU utilization - not idle – OS is more complex • Which job to schedule next?, etc. – Time Sharing (multitasking) • Interactive - input from keyboard, as each user has a terminal – OS expanded to include: • Memory management, disk management, file management – Specific OS • OS/360 (business & science), Multics (UNIX forerunner) 5/23/2017 57 History of OS • 4th generation systems (1980 - present) – Hardware is LSI (Large Scale Integration) chips which now have billions of transistors – PCs (personal computer) dedicated to a single user • OS becomes more simple with single users – Examples of early PC operating systems • MS-DOS (Microsoft Disk Operating System), MAC OS, UNIX – Multiprocessors, distributed systems, network operating systems 5/23/2017 58 Future of OS • 5th generation systems (the future) – 5th generation computers are thought to involve AI (artificial intelligence) • Includes such abilities as as natural language recognition, the ability to reason, and intelligent image processing – An example is the Fifth Generation Computer Systems project (FGCS) which was funded by the Japanese Government (19821994) – http://www.icot.or.jp/ARCHIVE/HomePage-E.html 5/23/2017 59
 
									 
									 
									 
									 
									 
									 
									 
									 
									 
									 
									 
									 
									 
									 
									 
									 
									 
									 
									 
									 
									 
									 
									 
									 
									 
									 
									 
									 
									 
									 
									 
									 
									 
									 
									 
									 
									 
									 
									 
									 
									 
									 
									 
									 
									 
									 
									 
									 
									 
									 
									 
									 
									 
									 
									 
									 
									 
									 
									 
                                             
                                             
                                             
                                             
                                             
                                             
                                             
                                             
                                             
                                             
                                            