Table of contents
Storage system-hierarchical storage structure
Main memory addressing calculation
First come first served (FCFS):
Shortest Seek Time First (SSTF)
Scanning Algorithm (Elevator Scheduling Algorithm) (SCAN)
Cyclic scanning algorithm (C-SCAN)
Data Control Transmission Method
overview
computer structure
CPU composition
ALU: Arithmetic and Logical Operations
for example:
von Neumann structure
Von Neumann:
(0) Von Neumann: " stored program control " principle. ---- How modern computers work .
(1) The work of the computer is controlled by a program . The program is a sequence of instructions , and the instruction is an operation command that can be understood and executed by the computer ;
(2) The program (instruction) and data are expressed in binary code and stored in the memory ( memory , external memory );
The principle of " stored program control " is as follows:
Storage system-hierarchical storage structure
main memory: memory, such as DRAM
The main-auxiliary two-level storage structure better coordinates the contradiction among capacity, speed and price.
cache cache
In order to solve the speed matching technology between CPU and main memory DRAM.
The access speed is faster than the main memory;
Practice questions:
Main memory addressing calculation
Number of storage units = maximum address number - minimum address number + 1
disk management
Practice questions:
(10*10+100+2)*100
Exercise: Disk-Optimized Storage
Practice questions:
(15+5)*10+1 = 201
15*10+5+1 = 156
Disk Management Algorithm
-
First come first served (FCFS):
fair.
If the tracks requested to be accessed are relatively concentrated, the performance of the algorithm is not bad.
If a large number of processes compete to use the disk, and the tracks requested to access are scattered, FCFS has poor performance and long seek times.
-
Shortest Seek Time First (SSTF)
The preferred track is the track closest to the current head.
The shortest seek time can be guaranteed each time, but the shortest total seek time cannot be guaranteed.
(The idea of greedy algorithm is to choose the best in front of you, but not necessarily the best overall)
Starvation may occur, and the head may move back and forth in a small area.
-
Scanning Algorithm (Elevator Scheduling Algorithm) (SCAN)
1. First access from inside to outside, and the next object is that the track to be accessed is not only outside the current track, but also the closest.
2. The magnetic arm is changed to move from outside to inside until there is no more magnetic track to be accessed.
3. The track to be accessed next is the closest one within the current position until there is no further track to be accessed.
The performance is better, the seek time is shorter, and there will be no starvation phenomenon.
The response frequency of the SCAN algorithm to the track at each position is uneven
-
Cyclic scanning algorithm (C-SCAN)
1. First access from the inside to the outside. When the head moves to the outermost track and accesses, the head returns to the innermost track to be accessed, that is, the smallest track number followed by the largest track number constitutes a cycle, and the cycle scan continues.
2. The magnetic arm is changed to move from outside to inside until there is no more magnetic track to be accessed.
3. The track to be accessed next is the closest one within the current position until there is no further track to be accessed.
When SCAN changes the direction of the head, it does not process the disk access request but directly moves to the track of the most edge disk access request at the other end.
for example:
Suppose track request queues are 55, 58, 39, 18, 90, 160, 150, 38, 184, starting from 100
FCFS scheduling sequence: 55 58 39 18 90 160 150 38 184
SSTF scheduling sequence: 90 58 55 39 38 18 150 160 184
SCAN scheduling sequence: 150 160 184 90 58 55 39 38 18
C-SCAN scheduling sequence: 150 160 184 18 38 39 55 58 90
Data Control Transmission Method
I/O mode
The method of program query: the CPU continuously queries whether the I/O is ready, and then calls it when it is ready. If it is not ready, the CPU will continue to wait for the I/O preparation. This process will seriously affect the utilization of the CPU. CPU utilization is very low.
Program interrupted:
Some states of the program involved in the breakpoint will be recorded and placed in a stack. This recording process is called saving the scene, or called protecting the scene . After a breakpoint occurs, there will be certain software and hardware responsible for judging the priority of the interrupt and responding to the interrupt. How to respond? It will check the interrupt vector table , and find the corresponding interrupt service program through the response entry. After the interrupt service program responds, that is, the freeze is resolved, it will return to the progress of the course and return to the terminal. During this process, the return will return to the breakpoint Restore the saved scenes one by one.
The process of receiving interrupt request-interrupt arbitration-interrupt response-interrupt processing-interrupt return.
DMA mode: mobile U disk, hard disk
Mouse and keyboard: program interruption mode.
Channel mode, I/O processor: These two methods can be understood as pure hardware methods.