Operating System Principles Chapter I Chapter II Review

Operating System Review

The first chapter Operating System Overview

basic concepts

  1. Throughput: workload per unit time of the system can handle.
  2. Process: program is executed dynamically
  3. Real-time operating systems: real-time computing. Calculating the correctness of the system depends not only on the logical result of calculation, this result is also dependent on the time of calculating a class.
  4. Features of the operating system: Most modern operating systems support multitasking, with concurrent, shared, virtual and asynchronous features.

Single-batch system

  1. Characteristics: automatic, sequence, of a single channel.
  2. Job exclusive CPU and memory.

Multi-batch system

  1. Characteristics: multi-channel property, disorder, scheduling, complexity.
  2. Advantages: improved CPU utilization, memory utilization, and improved I / O devices, to increase system throughput.
  3. Cons: average turnaround time is long (each task there is waiting time) (2) lack of ability to interact

Operating system functions

1. memory management functions

(1) Memory allocation: static allocation, dynamic allocation
(2) Memory Protection
(3) address mapping: the hardware required to complete the mating. As a result, the logical address is mapped to a physical address.
Logical addresses come from: the IR register -> decode -> operand fetch
(4) Memory Expansion: virtual storage technology.

2. The process management

Including process control, process synchronization, interprocess communication, process scheduling

3. Device Management Functions

Device Manager should have the following features:
(1) buffer management: manage various buffers.
(2) device allocation: dispensing devices required for the I O /
(3) Processing Equipment: for communication between the CPU and the controller device by the device driver.
(4) device independence and virtual devices

4. File Management

Mainly to solve: access functions by name, file storage.

5. to provide an interface for the user

Instruction execution

  1. A high-level language corresponding to a plurality of machine language
  2. Executing program is the essence of a section of instruction execution, the instruction execution nature may only change memory cell generation.
  3. The instruction fetch and execute the instructions is done by hardware.
  4. Any high-level language program is compiled into a set of instructions, wherein each instruction belong to the structure of the machine instruction set architecture.
  5. Hardware context: When interrupt return to resume execution of the interrupted program must be written back to the CPU registers.

The second chapter describes the process control

1. Concurrent program execution

1.1 program execution order

It has the following characteristics when program execution sequence: sequential, closed, reproducibility.

1.2 Concurrent program execution

Concurrent execution of the program has the following characteristics: intermittent, loss closure, irreproducibility

Cause irreproducibility generated: CPU executing instructions alternately, resulting in a different instruction execution sequence, different results.

2. Description of the process

2.1 Basic Concepts

  1. Process definition: the process is the process of running the program on a data set.

The text segment, user segment and systems segment during the process of a common set of Chen execution environment.

  1. Execution of the program is actually a sum of the execution environment.

  2. Process characteristics: 1) Concurrency: a plurality of processes stored in the same physical memory

    When the execution process of the process entity: 2) dynamic

    3) Independence: the introduction of the thread in the absence of an operating system, the process is the basic unit operate independently and resource scheduling.

    4) Asynchronous: the process with unpredictable speed forward, run in asynchronous mode.

    5) structural features: the process entity comprises user text segment, system data and user data segment segment.

  3. Comparison of the process and procedures:

    Differences: 1) the program is static, the process is dynamic.

    2) the program is permanent, the process is being present.

    3) there is an entity different processes and procedures. Program is a set of instructions, and the process comprising user text segment, the data segment physical system, the user data segment.

    Contact: The process is a program execution, always correspond to at least one specific program, but a program can have multiple processes.

  4. The operating system kernel is the first expansion of the computer hardware.

Process control block PCB 2.2

  1. Process block is a part of the process control entity, the operating system is the most important type of recording a data structure.
  2. \ (time \ _slice \) the number of fields for recording the time slice processes running on the CPU, the remaining clock tick.

3. Process Control

  1. Process three states: ready state, execution state, blocking state.

  2. Conversion between the three basic states interprocess process

4. The operating system kernel

How 4.1 operating system is loaded

  1. BIOS will first sector of the active partition of the current disk (boot sector) loads into memory
  2. Execute the boot program, found in the disk's file system in OS kernel loader (loader.bin), and loader.bin into memory, loader.bin jump to the first command, started loader.bin program.
  3. Loader program execution, the OS kernel program into memory from the external memory.
  4. Kernel mode jump from style to enable paging mechanism protected mode.

4.2 Interrupt

  1. What is an interrupt?

    Change the order of execution of an event-processor interrupt.

  2. Why the introduction of interruption?

    After the introduction of interruption, CPU can work in parallel with other devices, can effectively improve CPU utilization, improve system performance, supports asynchronous system.

  3. Interrupt type

    Divided: synchronous interrupt (internal interrupt or exception), asynchronous interrupt (external interrupt). Internal interrupts: CPU will be issued an instruction to terminate execution after interruption. Asynchronous Interrupt: randomly generated in accordance with other hardware devices CPU clock signal.

  4. Off interrupt instruction: enforced by the kernel or hardware-based software.

  5. For maskable interrupt, the interrupt is opened in response to the premise interrupted.

  6. Interrupt response time: For external interrupt, each of the CPU executing the instruction, it senses the arrival of an external interrupt signal, and if so, switch interrupt processing.

  7. Process has detected an interrupt signal, the interrupt transfer process:

    1) protect the first breakpoint, save the next instruction to be executed in the current address in memory, in order to interrupt this address can recover in time to return to the PC, such that the interrupted program execution continues from a power failure.

    2) the system shuts down interrupt, the interrupt handler turn, protect the scene of the work done in the interrupt handler, that is, save the hardware context-related information into memory.

    3) After the protective field, the interrupt vector to the interrupt vector table (Linux is the interrupt descriptor table) to find the information related to the interrupt processing subroutine entry address to find the entry address of the interrupt processing subroutine based on the information, and execute the interrupt processing subroutine to complete the processing of this particular interrupt processing.

    4) recovery site, open break, CPU power failure at the return to continue the interrupted program.

  8. Interrupt Vector: interrupt vector interrupt source is different arrival signal number. Nonmaskable interrupt vectors and abnormal interrupt vector is fixed, and the maskable interrupt vector may be achieved by programming the interrupt controller.

  9. Interrupt Descriptor Table (IDT): a system table, each interrupt or exception vector Betta contact, corresponding to each vector has a unique entry in the table stored therein associated with interrupt or exception processing routine entry address information. When the OS initialization, performed by the OS Idit assembly instructions loaded into memory.

    Interrupt handling subroutine entry address of the address information in memory = idtr the interrupt vector address + 8 *

4.3 Clock Management

  1. The operating system kernel can prevent a program by time or other mechanisms monopolize CPU resources.

  2. Computer system clock:

    RTC时钟:又叫CMOS时钟。

    OS时钟:产生于PC机主板上的定时/记数芯片。

  3. 可编程间隔定时器PIT:PIT按照一定的频率产生时钟中断,以告知内核又一个时间间隔过去了。

  4. 时钟滴答:OS时钟由可编程定时计数器输出脉冲触发中断而产生的,输出的脉冲中心叫做一个时钟滴答。

  5. 时钟中断间隔高:有些需要精确计时的应用无法正确运行

    时钟中断间隔低:OS占用CPU高,吞吐量变低

    因此,时钟中断间隔由系统性能决定。

4.4 系统调用

  1. 什么是系统调用?

    系统调用是核心程序与用户程序之间的接口,是操作系统内核中预先定义好的模块。

  2. 系统调用与一般函数调用的区别:

    1) 系统调用运行在系统态,一般函数运行在用户态。

    2)系统调用与一般函数调用的过程不同。当系统调用执行时,当前进程被中断,由系统寻找相应的系统调用子程序,并在核心态下执行,执行结果返回进程。

    3)系统调用要进行中断处理,比一般函数调用多了一些系统开销。

  3. 用户态执行:用户空间指的是用户进程所处的地址空间。一个用户进程不能访问其他进程的用户空间。只有核心程序所启动的进程才能访问其他用户空间。当一个进程在用户空间执行时,称该进程在用户态执行。

  4. 系统态执行:系统核心空间指的是含有一切系统核心代码的地址空间,当进程处于具有执行系统核心代码的权力状态时,称该进程在系统态执行。

  5. 系统调用的过程:

    1.保存系统调用号。

    2.执行中断指令,陷入内核态。

    3.根据系统调用号从系统调用表中找到系统调用实现历程的实现地址。

    4.执行系统调用实现历程。

    5.返回用户态。

  6. 系统调用的优点:

    1.使编程更容易,用户不用具体了解相应硬件设备。

    2.极大提高了系统安全性。

Guess you like

Origin www.cnblogs.com/zyf3855923/p/12077415.html