1、review操作系统基础“A” represent emphases or charge content“B” represent familiar with content“C” represent understand contentChapter 1: Introduction1. What is an Operating System? A A program that acts as an intermediary between a user of a computer and the computer hardware. Operating system goals: Execu
2、te user programs and make solving user problems easier. Make the computer system convenient to use. Use the computer hardware in an efficient manner.2. Operating System Definition A OS is a resource allocator Manages all resources Decides between conflicting requests for efficient and fair resource
3、use OS is a control program Controls execution of programs to prevent errors and improper use of the computer “Everything a vendor ships when you order an operating system” is good approximation “The one program running at all times on the computer” is the kernel. Everything else is either a system
4、program (ships with the operating system) or an application program3. Computer System Structure B Computer system can be divided into four components Hardware provides basic computing resources Operating system:Controls and coordinates use of hardware among various applications and users Application
5、 programs define the ways in which the system resources are used to solve the computing problems of the users Users:People, machines, other computers4. Computer System Organization B Computer-system operation One or more CPUs, device controllers connect through common bus providing access to shared
6、memory Concurrent execution of CPUs and devices competing for memory cycles5. Computer Startup A bootstrap program is loaded at power-up or reboot Typically stored in ROM or EPROM, generally known as firmware Initializates all aspects of system Loads operating system kernel and starts execution6. Co
7、mmon Functions of Interrupts A Interrupt transfers control to the interrupt service routine generally, through the interrupt vector, which contains the addresses of all the service routines. Interrupt architecture must save the address of the interrupted instruction. Incoming interrupts are disabled
8、 while another interrupt is being processed to prevent a lost interrupt. A trap is a software-generated interrupt caused either by an error or a user request. An operating system is interrupt driven.7. Interrupt Handling A The operating system preserves the state of the CPU by storing registers and
9、the program counter. Determines which type of interrupt has occurred: polling vectored interrupt system Separate segments of code determine what action should be taken for each type of interrupt8. Storage Hierarchy B Storage systems organized in hierarchy. Speed Cost Volatility Caching copying infor
10、mation into faster storage system; main memory can be viewed as a last cache for secondary storage.9. Direct Memory Access Structure B Used for high-speed I/O devices able to transmit information at close to memory speeds. Device controller transfers blocks of data from buffer storage directly to ma
11、in memory without CPU intervention. Only one interrupt is generated per block, rather than the one interrupt per byte.10. Operating System Structure(the difference between multiprogramming and timesharing methods)B Multiprogramming needed for efficiency Single user cannot keep CPU and I/O devices bu
12、sy at all times Multiprogramming organizes jobs (code and data) so CPU always has one to execute A subset of total jobs in system is kept in memory One job selected and run via job scheduling When it has to wait (for I/O for example), OS switches to another job Timesharing (multitasking) is logical
13、extension in which CPU switches jobs so frequently that users can interact with each job while it is running, creating interactive computing Response time should be 1 second Each user has at least one program executing in memory process If several jobs ready to run at the same time CPU scheduling If
14、 processes dont fit in memory, swapping moves them in and out to run Virtual memory allows execution of processes not completely in memory11. Operating-System Operations A Interrupt driven by hardware Software error or request creates exception or trap Division by zero, request for operating system
15、service Other process problems include infinite loop, processes modifying each other or the operating system 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
16、 code or kernel code Some instructions designated as privileged, only executable in kernel mode System call changes mode to kernel, return from call resets it to user12. Transition from User to Kernel Mode A Timer to prevent infinite loop / process hogging resources Set interrupt after specific peri
17、od Operating system decrements counter When counter zero generate an interrupt Set up before scheduling process to regain control or terminate program that exceeds allotted timeChapter 2: Operating-System Structures1. Operating System Services A One set of operating-system services provides function
18、s that are helpful to the user: User interface - Almost all operating systems have a user interface (UI) Varies between Command-Line Interface (CLI), Graphics User Interface (GUI), and Batch Functions that are helpful to the user and to processes: Program execution - Load a program into memory and r
19、un it File-system manipulation - Move, copy, and delete files, create directories, change permissions, etc. Communications Processes may exchange information, on the same computer or between computers over a network Communications may be via shared memory or through message passing (packets moved by
20、 the OS) Another set of OS functions exists for ensuring the efficient operation of the system itself via resource sharing Resource allocation - When multiple users or multiple jobs running concurrently, resources must be allocated to each of them Many types of resources - Some (such as CPU cycles,
21、main memory, and file storage) may have special allocation code, others (such as I/O devices) may have general request and release code. Accounting - To keep track of which users use how much and what kinds of computer resources Protection and security - The owners of information stored in a multius
22、er or networked computer system may want to control use of that information, concurrent processes should not interfere with each other2. User Operating System Interface - CLI A CLI allows direct command entry Sometimes implemented in kernel, sometimes by systems program Sometimes multiple flavors im
23、plemented shells3. User Operating System Interface - GUI A User-friendly desktop interface Icons represent files, programs, actions, etc. Various mouse buttons over objects in the interface cause various actions4. System Calls A Programming interface to the services provided by the OS: Process contr
24、ol, file management, device management, information services, communications 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 use5. System Call Implementation A Typically using softwar
25、e interrupt (trap) Register is set to a number associated with the system call System-call interface maintains a table indexed according to these numbers (cf. interrupt vector) The system call interface invokes intended system call in OS kernel and returns status of the system call and any return va
26、lues6. Operating System Design and Implementation A Important principle to separate Policy: What will be done? Mechanism: How to do it? Mechanisms determine how to do something, policies decide what will be done The separation of policy from mechanism is a very important principle, it allows maximum
27、 flexibility if policy decisions are to be changed later7. Virtual Machines B 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
28、 bare hardware8. Operating System Generation C Operating systems are designed to run on any of a class of machines; the system must be configured for each specific computer site SYSGEN program obtains information concerning the specific configuration of the hardware system Booting starting a compute
29、r by loading the kernel Bootstrap program code stored in ROM that is able to locate the kernel, load it into memory, and start its executionChapter 3: Processes1. Process Concept A An operating system executes a variety of programs: Batch system jobs Time-shared systems user programs or tasks Textbo
30、ok uses the terms job and process almost interchangeably Process a program in execution; process execution must progress in sequential fashion A process includes: program counter stack data section2. Process State A As a process executes, it changes state new: The process is being created running: I
31、nstructions are being executed waiting: The process is waiting for some event to occur ready: The process is waiting to be assigned to a processor terminated: The process has finished executionDiagram of Process State A3. Process Control Block (PCB) AInformation associated with each process Process state Program counter CPU registers CPU scheduling information Memory-management information Accounting information I/O status informationProcess Control Block (PCB)4. Process Scheduling Queues A Job qu
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1