Learning operating system (a) (B Video Station)

Operating system start-up and operating systems of three interfaces

1. How to Start OS's?

2. The three interface OS, namely what is achieved through?

3. interrupts, system calls and exceptions are What does it mean?

4. What is the difference of three interface OS?

5. How specific event is generated it?

2019.4.18

6. How to program system call it?

7. What is the user mode, kernel mode what?

8. The system calls and function calls the difference?

9. These three interfaces across operating systems, what additional costs have?

Introduction to Operating Systems

10. Cpu five components?

11. Concurrent with the parallel difference?

12. The relationship between the operating system and software?

13. The OS has four characteristics?

14. What is the RAM and ROM?

15. The evolution of the operating system.

16. The UNIX operating system is what kind of operating system?

2019.5.18
17. The authority kernel mode and user mode software What is the difference?

Execution of the program

18. a C program through what steps can be executed?

2019.5.22
19. The difference between the operation of the compiler and assembler?

20. The role of assembler?

CPU

21. The the CPU of which several parts, MMU what is the use?

22. The the CPU registers what?

OS memory management aspects of the

Segments
23. operating system memory allocation and consolidation of several algorithms?

24. The compilation process to help address space into the operating system did what work?

25. What is staging? Segmentation and paging is a hardware level or software level?

Paging

26. The difference in the segmentation and paging memory size?

2019.5.24

27. The page frame and the size of each page and the size of each frame is the same, but the total number of pages and the frame number, i.e. the number of different page number and the page frame number, the page number is larger than the number of the page frame number, a logical address because space is larger than the physical address space.

28. The page table maintained by whom? Page table what effect?

29. The difference between the frame and the page?

30. What is the nature of the data structure of the page table? An operating system is only one page form?

31. The page table is a page table entry consisting of a section, page table entry contains what?

32. What is the TLB, TLB what's the use?

33. What is the cover art?

34. In order for the program to run at large on a computer with limited memory and what measures can be taken?

35. In the written procedures, taking into account the principle of locality pay attention to the program, two ways for writing the title What is the difference?
Here Insert Picture Description
36. The multi-level page table what is the use?

37. In the page table entry, there are several special identifier, gain access to the page table entry, specifically which of several?

answer

1.
After the power is turned on, the BIOS self-test (initial check on the computer), bootLoader invoked by the BIOS (Basic I / O System) calls to the operating system into memory from disk.
BootLoader is used to load the OS, typically placed in the first master boot sector of the hard disk.

2.
interface is the interface, three interfaces

  • And peripheral interfaces through interrupt and I / O implementation.   interruption
  • 1 --- interface system program calls System Call
  • 2 interface program --- abnormal   Exception

3.
This OS are three interfaces:
interrupt the OS and peripheral interfaces , that is, the OS and all peripheral connections.
System call is normal docking interface program with the OS , in order to ensure security, the application can not just use the resources, the way to unification with the request to the OS to perform, that is, a system call.
Abnormality is abnormality programs or other abnormal state of the docking interface of the OS , the request is sent to the OS exception error manner.
Interrupts are peripheral events .
Exceptions are the internal Cpu event .

4.
(1) the source of a different
one peripheral
one application
one exception error
(2) time type of
processing time There are two types: synchronous and asynchronous
synchronous and asynchronous depend, is not without any expectations, which may occur at any time .
Interruption: Asynchronous, because they do not know when the peripherals will be given instructions, such as the keyboard
Exception: synchronous, because you must go to certain procedures, will be followed by error
System Call: synchronous or asynchronous, such as a message. Then the news has been waiting to come back, it is synchronous, if to do otherwise after the message, the message came back again deal with the case, that is asynchronous.
(3) respond to
different responses ways:
interrupt is transparent, OS regardless of the basic
response System Call are: continuous or wait for
a response Exception is: kill the program, or re-execute a command.

The
event is divided into internal and external events, namely exceptions and interrupts,
exceptions and interrupt generation hardware and software is divided into two levels:
different peripherals will correspond to different numbers, the computer will have a table here

First of all hardware interrupts and exceptions which do the job is the same:

  • Set interrupt flag: the external events interrupt flag is set to generate an interrupt event ID (interrupt number)

Interrupt the software to do the job, that is, the work done by OS:

  • Save the interrupted program state: Save site
  • Interrupt service routine processing
  • The address of the interrupt number to jump to go execute, complete the relevant circumstances, and clears the interrupt flag.
  • After completion of the above situation, the abnormal state before the recovery procedure.

Abnormal OS do the job:

  • Save site
  • Kill abnormal program (ie, exit the program) or abnormal re-run command (the service is not in place, repaired after abnormal program execution)
  • Recovery site

6. The program does not directly System Call, this will be very dangerous, so all operating systems define the program call system call interface:
Windows system defines: Win32 API
for all versions of the definition of Unix, LINUX and macOS X of the: POSIX API
JAVA virtual machine (JVM) defines a JAVA API.

When the system call by the procedure call interface will achieve the transition from user mode to kernel mode, such that the steering control from operating system application program,

7. The user mode and kernel mode application refers to a condition in the CPU privilege, when in the kernel mode, have the right to control the entire computer system,

8. There are two:
(1) in which different spaces: when the application function call, it is carried out within the same stack space.
And when the system call: an operating system (kernel) with the application, each containing a stack.
(2) the cost difference: larger system call overhead, because it involves the conversion of a kernel mode with user mode, as well as system calls related to the conversion of the stack, so the former is greater expenses.

9.

  • Time spending : direct than the program calls (such as function calls) greater.
  • Storage overhead : interrupts and exceptions when necessary to establish the interrupt number / abnormal number / system call number (indicate what device generates an interrupt, where an abnormality has occurred, where call system call), as well as among their number corresponds to the address table.
  • There is a unique operating system kernel, the need to establish a separate stack.
  • Authentication parameters (spending on security): os mistrust application parameters need to be checked.
  • User mode to kernel mode memory copy overhead, etc.

10.

  • register
  • counter
  • Controller
  • MMU
  • Cache

11. Concurrency is a feeling, a macro, micro and macro parallel means, that single-core processor inside the multi-process can be complicated, but not parallel.
Parallel refer to the same time simultaneously, the same time a single processor can only run a process complicated by referring to the same period of time simultaneously.
Here Insert Picture Description

12. The
Here Insert Picture Description
operating system is divided into three portions

  • Command line, command line interface
  • GUI, Graphical Interface
  • Internal kernel Kernel, OS

Core ranges are as follows, in fact, it is the kernel of the operating system core functions:Here Insert Picture Description

13.

  • Concurrency : calculator can exist simultaneously run multiple programs (note not to run multiple programs simultaneously)
  • Share : application macro to feel simultaneously accessing resources, the micro is actually exclusive access.
  • Virtual : The multi-channel programming, allows users to feel the entire computer to his personal service
  • Asynchronous : The program is stop and go, it is not easy. To move forward speed is not known, but as long as the same input, the result is the same.

14. The silent, learning for so long and maybe do not know:
RAM: Random Access Memory is the main memory
ROM: Read-only memory read only memory, because the hard drive is external memory, so Rom and hard drives are not equivalent,
data investigation:

电脑中的ROM是在主板上的电池旁边的一块写着BIOS的芯片。ROM只读内存,它固化了指令和数据在芯片里,断电后数据不会消失。
Ram你就大概理解为内存条就成,Rom现在好像不用了,计算机启动的BOIS芯片貌似就是用的Rom

15. The
evolution of the operating system

  • Single-user system
  • Batch System: OS threw a number of jobs, let it go to completion, the batch system is not interactive.
  • Multiprogramming system: multiprogramming inserted in a computer running a serial micro, macro are concurrent.
  • Time-sharing system: or people share a computer
  • PC: a user of a system
  • Distributed Systems: a plurality of user systems: having high reliability and safety

16. The
time-sharing operating system.

17.
CPU处于内核态时可以执行任何一条指令,可以完全控制整个计算机,在用户态时 CPU 无法执行一些特殊的机器指令,也无法访问IO

18.
首先是编译过程,会把程序转换为汇编语言,但是汇编语言仍然不是机器语言,再经过汇编过程,转换为机器语言,然后一个大文件往往由很多个小文件组成,需要把他们用link操作连接起来,这样就能生成一个exe文件,位于硬盘上,最后要使用exe的时候,会通过一个loader将该文件载入内存,通过程序重定位,最终运行程序。
总结如下:
编译————汇编————链接————载入(程序重定位)

19.
编译是将语言变为,汇编语言,汇编语言是一种介于编程语言与机器语言的中间语言,机器语言是010101的二进制编码,而编程语言则是完全面向用户使用的语言。

20.
把汇编语言转换为机器语言。

21.
寄存器,计数器,缓存和MMU。(忘了还有一个控制器)
MMU,内存管理单元:用于将程序给的逻辑地址转换为实际的物理地址。如果MMU找不到,会到内存中的map里面去找。

22. 基址寄存器和界限寄存器,用来设置逻辑地址空间的相关信息,一个记录空间的起始位置,一个记录逻辑地址空间的长度。

23.
最基本的有三种:
首次适配算法:从0地址开始找,直到找到满足条件的区间
优点:简单,快 缺点:碎片多
最优适配算法:什么是最适合?也就是区间差值是最少的
优点:减少大块的内存被分割的情况,比较简单
缺点:重分配慢,仍然有碎片,容易产生很多微小的碎片
最差适配算法:选取最大的块,进行拆分分配。
优点:适合全是中等尺寸块的分配,分配很快(提前建立了一个块体积排列表)
缺点:重分配慢,仍然有外部碎片,后面很可能有无法分配出大块的内存空间。

24.
编译能够让程序中的逻辑地址空间转换为实际内存中的物理地址空间,操作系统是记载下了这个映射过程。

25.
分段是将一个程序分为堆、栈等部分,分别进行储存,而分页是将物理内存进行小规模的划分,属于硬件层面。Here Insert Picture Description

26.
分段中每段的大小是不固定的,而分页中每页的大小是固定的。

28.
由操作系统维护页表,可以通过页号找到对应的帧号。

29.

  • 总空间大小不同,一般页的总空间较大。
  • 不是所有的页都能对应页框。
  • 页是连续的逻辑上的地址空间,而页框是物理内存上不连续的。

30.
页表其实就是一个大数组,每一个运行的程序都有一个动态变化的页表
具体过程如下:
Here Insert Picture Description
PTBR是页表的基址寄存器。

具体转换过程如下:
Here Insert Picture Description

31.
Here Insert Picture Description

resident bit:用于表示当前帧是否存在,若不存在则为0。

32.
TLB:Translation Lookaside Buffer,旁路转换缓冲,即页表缓冲,又称快表缓冲。
TLB的作用:由于“页表”存储在主存储器中,查询页表所付出的代价很大,防止对内存中的页表进行二次访问(一次是寻找帧号,第二次是使用数据)。
TLB就是一块缓存,它利用了程序局部性原理,把CPU附近访问的页表项放在缓存里。
如果TLB命中,可以很快获得目标的帧地址,否则的话,到CPU中寻找页表项,把它加载到TLB中。

33.
如图,由于B和C,D、E和F不能同时存在于内存中,所以最大内存取流程的最大内存即可,对于原来的程序可以直接进行覆盖。
Here Insert Picture Description
还有其他的覆盖方式,只要分区的程序不可能再流程上同时执行,就可以进行分区覆盖:
Here Insert Picture Description

34.
目前有以下技术:

  • 覆盖
  • 交换
  • 虚存

可以使用覆盖和交换技术,二者的区别如下:
Here Insert Picture Description
覆盖操作是程序内部进行的,它往往需要耗费程序员的代码工作;
交换操作的操作对象是进程,要把整个进程的空间进行换入和换出,加大了处理器的开销。
更好的办法:虚存。
虚存实际上是覆盖操作和交换操作的升级与结合,因为它是基于分页操作的。
Here Insert Picture Description

35.
int在32位里面是4个字节,1024*4正好是4K,程序里面默认地址顺序是先行后列的。Here Insert Picture Description

36.
多级页表,说白了,就是利用时间去换取空间。
第一,多级页表通过分级的方法,用链表的方式将所有页表项连接起来

  • 原来的一级页表需要连续空间,而多级页表可以使用非连续空间。

Second, multi-level page table is the page table to the original split into multiple segments beyond the first paragraph, that can be, resident bit of the page table entry is set, and if it is 0, indicating there is no corresponding physical space , there is no physical address, so that there is no page table entry two subsequent data and the like.

  • Multi-level list, resident bit for the page table entry 0, thus saving memory space.

Third, Disadvantages:

  • Retrievals increase, the time spent increases.

37.
Here Insert Picture Description

Guess you like

Origin blog.csdn.net/alexhu2010q/article/details/89361713