2016.07.04 2016.07.05
The operating system is essentially a program, a large software engineering (the case of a commercial OS). And the nature of the program---on the one hand is called "Data structure + algorithm", on the other hand is encapsulation + abstraction. Operating system as one appears, on the other hand is the control hardware boot boot, and as the first software running on the computer, on the other hand, the operating system is responsible for managing the computer's resources (memory management, file management, i\o), to assist users to run the program on the computer to run, Even multiple programs are running synchronously (process management). So you can see that the operating system in essence and those b\s mode of enterprise Management site Nature no difference, are management. But the operating system is to manage the computer resources (on the basis of the underlying abstraction of the computer), and the program, as a boss-level program Management program (here you have to understand the program to run the necessary foundation, memory, register, CPU, etc...) Understand these basics to know how the operating system manages applications as a boss program).
So you can see that the purpose of the computer is to run the program. The operating system is a program running on the computer, the purpose is to help the computer in human operation to better run the program.
Memory management in this chapter is an embodiment of the operating system as a boss program. The operating system manages the memory because the computer needs memory to run the program, so the operating system acts as the big boss of the program to manage and allocate and reclaim memory for the application (younger boys).
First, memory management involves the concept of caching. Set the cache to off when we do a memory check.
UnsignedintMemtest (unsignedintStart, unsignedintend) { Charflg486 =0; unsignedintEFLG, CR0, I; /*Verify that the CPU is 386 or more than 486*/EFLG=io_load_eflags (); EFLG|= Eflags_ac_bit;/*ac-bit = 1*/io_store_eflags (EFLG); EFLG=io_load_eflags (); if((EFLG & eflags_ac_bit)! =0) {/*if it is 386, even if you set the value of AC=1,AC, it will return to 0.*/flg486=1; } EFLG&= ~eflags_ac_bit;/*ac-bit = 0*/io_store_eflags (EFLG); if(flg486! =0) {CR0=load_cr0 (); CR0|= cr0_cache_disable;/*Disable Caching*/store_cr0 (CR0); } I=memtest_sub (start, end); if(flg486! =0) {CR0=load_cr0 (); CR0&= ~cr0_cache_disable;/*Allow caching*/store_cr0 (CR0); } returni;}
(not to be continued)
Self-made operating system (ix) memory management