bootstrap
When a computer starts up, it needs to run an initialization program, also known as a boot program. This program is used to initialize the system, including CPU registers, device controllers, and memory. Then run the operating system. Typically, the boot program is located in ROM or EEPROM. The key to mounting an operating system is locating the operating system, that is, knowing where the operating system entry is. Memory, usually should be in the boot sector of the hard drive, right?
interrupt
The operating system starts executing, and after initialization is complete, it quietly waits for events to occur. The occurrence of an event is indicated by an interrupt. Both hardware and software can interrupt. When the CPU is interrupted, it suspends the current work, immediately starts the interrupt service procedure, after the execution is completed, returns to the interrupted work. When an interrupt occurs, in order to start the corresponding interrupt service program as soon as possible, there is a table of address Pointers of these service programs, which is called the Interrupt direction table.
\
Instruction execution cycle
A typical instruction execution cycle begins with the instruction being fetched from memory and stored in an instruction register. The instruction is then decoded and may cause the operand to be fetched from memory or stored in an internal register. After the instruction completes its execution of the operand, the result is stored back in memory.
\
Multiprocessor system
Scale brings down costs. Multiprocessor systems have three advantages:
1) Increase throughput
2) Share peripherals, storage and power to save money
3) Increased reliability. When a processor dies, the system slows down, not crashes.
\
It can be divided into asymmetric multiprocessing and symmetric multiprocessing. Asymmetric, one CPU master with many slave; Symmetric, all cpus are equal.
The current CPU trend is single-chip, multi-core, equivalent to multi-processor.
Blade server: A server has multiple motherboards, each board has a processor, these boards have their own operating system, independent boot, equivalent to an independent computer.
\
The cluster
Clusters are often used to build high availability, where one system fails and services continue.
1) Asymmetric cluster
Such as hot backup mode
2) Symmetric clusters
All machines run applications and monitor each other. Can make full use of hardware resources, more efficient.
3) Parallel clustering
Multiple hosts share data. Consistency control is key.
4) WAN cluster
Distributed cluster
Job scheduling
Time-sharing and multiprogramming require holding several jobs simultaneously in memory. Usually because main memory is too small to hold many jobs, jobs are initially stored in the job pool. A so-called job pool, placed on disk, consists of jobs waiting to be allocated memory. What jobs are called into memory for execution is called job scheduling.
At the same time, the system must choose whether to allocate cpus or schedule them.
In addition, there are related schedule, disk storage, memory management and so on.
\
Virtual memory
Virtual memory allows an executing job to not be completely in memory and is suitable for situations where the program is larger than physical memory. In addition, virtual memory abstracts memory into logical memory, separated from the real physical memory area, so that programmers don’t have to worry about memory space limitations.
Dual mode
User mode (User mode) And kernel mode (supervisor mode, administrative mode, system mode, privileged mode, kernel mentality?).
When the system boots, the machine is in kernel mode. Mount the operating system and start running in user mode. In the event of a trap (which can be triggered by a software error) or an interruption (hardware or software interruption), it switches from user mode to kernel mode.
Dual mode provides a means of protecting the operating system and user programs from bad user programs. The implementation principle is as follows: in user mode, the execution of only in kernel mode instructions (privileged instructions) is not allowed, will be considered illegal, in the form of trap notification to the operating system.
\
Dual mode requires hardware support. Add a mode bit in computer hardware, kernel mode 0, user mode 1, to distinguish.
The lack of hardware support for dual mode has some disadvantages. Like Intel cpus before Pentium, mS-DOS was prone to crashes. Damn, I remember win2000 before the operating system is very easy to crash.
\
The timer
Prevents user program execution from taking too long
Design intent
1) Fully optimize the utilization of hardware, such as MAINFRAME Unix, Server Linux, Windows Server?
2) Support for everything from complex games to business applications such as Windows for personal computers
3) Between the square inch, its own space Android
Therefore, different operating systems have different applicable objects and design intentions, and it is often meaningless to compare with each other.
\