? What is the operating system? What does the operating system do? How to do the operating system
1 chapter What is an operating system? From the perspective of resource management: Control and managing system software for multi-channel operations running in computer systems. It is the unique interface system software for users and computers: One-on: Control and Manage Various hardware and software resources in the computer system Run pair: expand hardware function, provide numerous services, convenient user understanding Operating system: 1. Is the first software computer hardware on the bare metal -> operating system -> system software -> Application software operating system function? 1, Memory Management: Memory Allocation Address Mapping Memory Protection Memory Extension 2, Processor Management: Job Scheduling Process Scheduling Process Control Process Communication 3, Device Management: Buffer Management: Cause CPU Processing Speed and Device Distribution Device Drive Device independence 4, file management: file storage space management file operation directory management read / write management and access control 5, user interface: command interface program interface graphical interface operating system features? 1. Concurrency: Two or more activities in the same given time interval /// distinguish between parallel: At any time, you will run the CPU? Serial 2, sharing: Computer system resources are subject to multiple tasks Shared simultaneous access: macro simultaneous access disk, using CPU mutual exclusive access: there is no fixed time relationship, the program execution is not expected
How does the type of operating system? 1, batch system: Job: User-defined work unit single-way batch system: Multi-Division Processing System: 2, Time System: Time: Several concurrent programs to CPU time sharing features: Interactive independence, timely, real-time system: real-time, timely, immediately to specific events, system can respond in a short period of time and complete the event processing work is typical 1, process control system 2, information search system 3, transaction system features: professional real-time reliable 4, personal machine system: single users
5, network operating system computer network = computer technology communication technology computer network characteristics: distributed autonomous interconnect visibility 6, distributed operating system features: distributed processing modular structure utilizes information communication implementation overall control: Transparent flexibility reliability high performance expandability
2 chapter 1, how to understand the concept of the process 2, the status of the process and its conversion 3, the process of synchronization and mutual exclusion 4, critical resources and critical regions
Character sequential sequence of program sequence: The one the Other Closure: And its own conditions are resentful: Multi-channel programming features 1. Multiple program sharing system resources 2, multiple programs concurrent execution program and execute Features 1, loss of closure 2, the program and calculation no longer corresponds to 3, the relationship process of mutual restriction: the program is compared to the process of execution process and program in the concurrent environment 1, the process is a dynamic program is static 2, The process has a concurrent program itself with a sequential program that implements the process implemented 3. The process has independent units that can run independently is the basic unit of system resource allocation. The basic unit of operation scheduling is 4, and there is no one. Corresponding relationships A program can be shared by multiple processes to perform multiple programs sequentially: Enter data calculation 5, process is asynchronous, will constrain each other, the program does not have this feature program and process is a completely different concept, There is also a close contact process in the two, dynamic 2, concurrency 3, scheduling: allocation resource, scheduling operation 4, asynchronous 5, structural: reflecting the state of the process, reflecting the process of allocation Composition Process Control Block (PCB): The system is proceeded by its process: also defines, the relationship between the procedure data collection process and the process block: 1. Each process has a unique PCB 2, OS according to PCB management process 3 Using the PCB to implement the dynamics and concurrent 4, the PCB is the only sign exists in the process.
The status of the process and its conversion: 1, the dynamicity of the process is the status of the process and its conversion. 2, the status information of the process exists in the PCB 3, and the state transition is implemented under certain conditions: 1, Running state --- is executing 2 on the CPU, ready-to-state - Everything is available, it is poor CPU 3, blocking state - waiting for the event, can not run instructions: 1, the state transition between processes is not reversible - - "Run 2, the state transition between the process is not all active as running -" Block 3, the process is the real running process synchronization with the mutual exclusion 1, the process of the process will mutually restrict (by the system) Resource Constraint: Buffer, supplier, user) All processes are independent of the asynchronous manner in asynchronous mode: It is a relationship between the relationship between the relationship between the relationship between the interpretation of the interaction between the processes. In execution time, the mutual exclusion of the process must be coordinated in order: concurrency execution of multiple processes due to competition the same resource (Example: Multi-user and printer) mutually exclusive process is logically completely Norrelated, their operation does not have a characteristic of time order
Critical Resources: One process allows only one process (Example, Printer, Table) critical area to access critical resources in each process. Guidelines from the critical regions: 1, single entry 2, occupy critical resources 3, withdraw from with you (using the end of the critical resources, release as soon as possible) 4, etc., let CPU resources) 3 semaphore: is a data The value of the structural semaphore with the application of the corresponding resource, the value of the signal amount and the value of the signal amount, the value of the signal amount is changed by the P, V operation, change the WAIT operation P (s): Do P: While (s <= 0) DO NO_OP S: = S-1 Apply a unit resource Signal operation v (s): Do V operation for the signal amount: S: = S 1 (s> 0 means no process waiting resource) If S <0 release The first PCB on the S queue, the process continues to release a unit resource synchronization mechanism to implement mutex, which is set to 1 description: 1, in the same process, P, V must become The first P can only make multiple processes to mutually exclusive use critical resources 2, and Mutex is used to achieve mutual exclusion, and its initial value is set to 1
With P, V operation, a simple synchronous S1-buffer is a vacant value of 1s2-buffer is a full value of 0 for synchronization description: 1. Determine the type 2 of each other and the signal amount 2, The initial value of the semaphore is set, and the same semaphore, the V operation is paired, but the management 1 of the processor in different processes, the type and function of the scheduling 3, the scheduling performance evaluation 3 , Common scheduling algorithm
Scheduling: It is the classification of the job or process scheduling to be dispatched: Advanced Scheduling (Job Scheduling) Intermediate Scheduling (Storage Scheduling) Less Scheduling (Process Scheduling) Job Scheduling and Process Scheduling: 1, Job Scheduling is Macro Scheduling Process Scheduling It is microscopic scheduling 2. The former is the process of the process for the process. The latter is really active for the process. 3. The former executions have frequent activities. The latter activities are frequent. The former may not be the resulting performance and evaluation: 1, The utilization rate of the CPU 2, throughput 3, turnover time 4, response time (from submitting the first request to generate the first response) 5, the waiting time for the waiting time for the ready queue is commonly used: 1, first Service Fatrics: More beneficial for long homework or processes pay more attention to occupying more CPU time, but the efficiency is low, and the time frame rotation is mainly used in the scheduled system schedule 3, priority method: non-seizuated and preemptive Method for determining process priority: Static mode: Creating a process is to determine if it is not easy to implement, and the process starving and dead dynamic mode: continuous changes in the progress of the process can achieve a negative feedback effect.
Five-chapter memory management memory allocation: Main tasks: Assign a certain memory space for each process: record memory, handle user application, implement policy allocation, recycle release spatial address mapping: Translate the relative address used in the program Memory physical address user program main processing phase 1. Original program Editing -> Compile (becoming target code 01 yard) -> Connection -> load -> Run relative address: Every target module after users compile 0 For the base address sequence Address: The address of each physical storage unit in memory is from a unified base address sequential addressing logical address space: memory range memory space consisting of logical addresses in the program: a series of storage units from memory The defined address range virtual memory introduction: 1 Outline 2, Dynamic Address Converter Diversical Features: 1. Virtual Expansion is not from physical but from logically expanded capacity 2, and some of them are not all-in-one load memory, but Only part of the person is installed 3. The part of the discrete assignment each job is loaded with the continuous memory space, but the seam pin 4, which is repeated during the operation of a process, all of the programs and data it needs It is divided into a limit to multiple times to transfer memory deficiency, indicating that the address of the address is 2, and the capacity of the deposit is
Memory Basic Tasks 1, Concept Pipement Management of Paging and Segmentation is a basic way to resolve memory fragments: logical address -> Page Table -> Physical Address Logic Space Points: 1, Page: Yes Logic The space is divided by the fixed size, determined by the hardware: the size of the memory block and the page table table table: The effect implementation from the page number to the physical block number address mapping page and the memory block generally selected several power logic 2 Address representation: (p, d) page number P top address D paged concept: logical space Page Physical Space Split Page and Blocks The same size Continuous block Dubssed Page number checkpoint table By hardware conversion simple paging system does not Provide false memory
Concept of segmentation: Segmentation: Segment is an address structure of a set of logical information: section number (s) segment interior site (D) memory allocation: 1, assign 2 in units 2, each occupied A memory area 3, which can be discrete to memory 2, the implementation of the implementation of the page: 1, address space paging, memory block, page and block size is 2, the job part is installed in memory 3, the job occupation Each block does not continuous 4, the hardware generates access addresses 5, if the pages are missing, for the shortage interrupt processing, in exchange for memory 6, use the quick table to speed up the address conversion feature: request paging = pagination request request paging provided The status bit in the virtual memory page entry indicates whether the page is in memory. If it is not yet, generate a missing page interrupt, there is a storage block table, record the use of the entire memory.
3, common page replacement algorithm page replacement: Turn a page from memory to disk, 1, advanced first out 2, best way 3, LRU has recently been long-lasting 2, 3 Compare 1234123 2: 124 3: 423
6 chapter file system 1, what is the file, file system file: The characteristics of the named data: Typically stored as a separate unit as a type of property file: MS = DOS UNIX system For normal files: Component files by representing procedures, data, or text: File Special Files consisting of Directory Items of the subordinate file: Specially refer to a variety of external equipment file systems: a complete set of manipulation and management files in the operating system Facilities, he realizes the sharing and protection of documents, so that users "by name access". File system features: 1. File management 2. Directory management 3, file storage space management 4, file sharing and protection 5, providing convenient interface to view file system: 1. User point 2, system view 2, file The storage structure involves how the file is placed on the storage device depends on the physical characteristics of the storage device, and the access method of the file is closely related to all files, but it is not necessarily a continuous basic file on the storage medium. Storage structure: Continuous file: Advantages: Sequential access is faster, simple to store system file shortcomings: Invented in file dynamically expanded to establish files, you must determine its length may have an external fragment series file: Advantages: overcome Disadvantages of continuous documents, disadvantage of disk utilization: Disadvantages that are not conducive to file random access connection words: overcome the shortcomings of the series file, the file read fast Disadvantages: Index Table will occupy a lot of memory space multiple indexes File: The advantages of index files have overcome their disadvantages for UNIX disadvantages: indirect index affects the speed of access
3, file directory and directory structure file control block: Control the file, the management data structure has a unique file control block file directory: It is the file control block of the file control block is full of directory items The file consisting of a directory item is called a directory file, and the referred to as the directory file directory implements the mapping between the file name and the storage disk block.
Directory Structure: Single-level directory structure: All files in a directory, resulting in renaming, and file sharing issues secondary directory structure: a primary file directory plus multiple user file directory tree directory structural non-cyclic diagram Directory Structure: Link : Allows a file or directory to register with a disk free management technology that is commonly used in multiple parent directories: 1. Idle space measures: All consecutive free dishes occupies one item in the idle space table 2 , Idle block link method: All idle dish blocks link in a queue 3, bit illustration 4, set link method: all idle disks are fixed by fixed quantity group, form links between groups and groups 4, file sharing And security file sharing: System allows multiple users (processes) to use one or certain file sharing methods: file link: give a subsidy name, increase the protection of shared channel files: refer to files from files or other The user's error operation causes the damage file to confidential: users who do not have to access the file protection mechanism without the file protection mechanism to achieve controlled sharing conservation mechanisms: 1. Naming: Users can only access themselves Established file 2, password 3, access control: According to user identity, the security measures for different file access rights file systems are specified: the backup and recovery backup of the file: do the files on the hard disk on other exotic media A copy is divided into: Full amount dump, incremental dump 7 Device management 1. Function monitoring device status: Remember all devices, controllers, and channel status for device allocation: according to device type (exclusive, sharing, Virtual) and the allocation algorithm used by the system, implementing device allocation. Finished by the device allocation program (or I / O scheduler).
Complete I / O operation: The system calls the device driver latter start device, perform I / O operation processing from the interrupt buffer management and address translation from the device: The system is managed to manage the logic device in the program into a physical device. , Realize the indefinity of the device 2, the purpose of buffering technology introduces buffer: buffer CPU and peripheral speed mismatched contradictions increase the parallelism between CPU and peripherals to reduce the number of interrupt buffers for CPU: 1, Single buffer: Data arrival rate is very different from the leaving rate 2, double buffer: the input and output rate of information 3, multi-buffer: the input and output of the data have a common buffer pool 3, and the device allocation technology has its factors : I / O device's inherent attributes (printer can only output) the allocation algorithm used by the system should prevent the independence of the deadlocks from generating devices: exclusive equipment printers, tape drive sharing devices: can be shared by several processes Such as: Hard Disk Virtual Equipment: Transform exclusive equipment into "sensory" can share device allocation technology: 1, exclusive assignment 2, shared device system scheduling each process access order 3, virtual equipment; use shared equipment to simulate exclusive equipment, Thus, by multiple processes, for example, the most famous technique of hard disk virtual printers: spooling technology spooling technology transforms exclusive devices to shared devices to implement virtual devices. From the process of resident memory responsible for I / O, the output well (i.e., the hard disk) is composed of the deposit input, the input storage output is taken, and the output is made 4, the I / O processing process 1, the user I / O call 2 , Rotate the core program file operation of the operating system = "The driver of the device 3, the device driver works 4, start the device's work 5, I / O, generate interrupt signal corresponding interrupt handler calling device driver Handling the following I / O request