Outline of Zhejiang University Professional course review

Source: Internet
Author: User
Tags field table
Overview of computer Composition

1. The hierarchy of computer systems. The core layer is hardware-> system-> outer application software.
2. Classification of software systems: system software and application software.
System software: compilation, OS, assembly, application software: Edit, Cad...
3. Computer hardware composition: Alu (data path datapath), memory, controller, input and output
The data tunnel and controller are called CPU or processor.
4. machine instruction format and its classification
Categories: arithmetic operation commands, access memory commands (transfer), transfer commands, shift commands, input and output commands
Format: No address
Three addresses
MIPs command: Three addresses and two addresses
5. Program Design with assembly instructions
G = H + A [I] # register allocation
Add $ T1, $ S4, $ S4 # I-> $ S4, I * 2-> $ T1
Add $ T1, $ T1, $ T1 # I * 4-> $ T1
Add $ T1, $ T1, $ S3 # $ S3 is the first address of array A, and $ T1 is the address of a [I]
LW $ T0, 0 ($ T1) # $ T0 = A [I] value
Add $ S1, $ S2, $ t0 # G = $ S1 = H + A [I]
For details, see the English document P114.
Loop program exercise: Transfer Instruction Application p126
Loop: g = G + A [I];
I = I + J;
If (I! = H) goto loop;
(BNE $ S3, $ S2, loop usage)
While (save [I] = k) p127
I = I + J;
(J loop usage)
Case/switch statement p129
Switch (k) {// where K is 0, 1, 2, 3
Case 0: F = I + J; break;
Case 1: F = G + H; break;
Case 2: F = g-h; break;
Case 3: F = I-j; break;
}
Use beq, Jr, J, and other commands to compile the switch statement. Use the Assembly command to design and compile the switch statement. A jump table is required.
K * 4 + first address (jump table)
Retrieve the jump table address from the table
6. Addressing Mode
LW $ T1, 0 ($ T2) # base address addressing
Add $ T1, $ T2, $ T3 # register addressing
Addi $ T1, $ T2, 100b # Now
Beq $ T1, $ T2, L1 # PC relative addressing
J mm # J addressing, equivalent to direct storage addressing
JR $ T # register addressing
Focuses on addressing methods, Common commands for loops, when loops, and on-off statement assembler programming methods

7. array and instruction + programming design (understand programming methods) p174

CPU and command Design Based on MIPS architecture is not required

8. Expression and complement of the number of machines, representation and operation of the original code and standard floating point numbers

Focuses on the serial addition, parallel addition design, and carry time calculation, parallel carry chain and serial carry circuit design method, complement code, floating point representation (ie754 Standard)
Design Principle and principle of source code multiplier (divider) Complement and logical block diagram design
Complement multiplication, one-digit Booth's p259, p257, addition and subtraction Alternating Method
IEEE 754 standard:
E = E-127 E: True E: Machine Representation)

1 8 23
E is represented by a shift code, with one symbol bit
(-1) s × (1 + significant) × 2e
| M | = 0.1xx ......

9. Master the structure of the computer data path with multiple clock cycles, and master the Command Execution Process (the State Conversion Diagram of command execution can be drawn)
Understand the bit program design method and basic working principle

10. architecture of the storage system, multi-level storage system cache-Principle Design of direct address ing, group-connected address ing, full-link address ing, and address ing

The virtual address, real address, page table, and page table register must be clearly defined, and the page table capacity can be calculated = number of page forms × (sign bit + Real page number length)
Page number = virtual address-in-page address P545-549, P569-570
Concepts of page disconnection, hit, failure, write-through, and write-back
Focus on understanding the working principle of resisting transformation structure, transformation logic design and the given virtual address, primary storage capacity, page size, computing capability, number of page elements, real page number length, number of real addresses and the number of pages found
The field table is not required.

11. I/O system

Disk System, average rotation time, average seek time
Record format, address representation: Number one (page number), channel number, sector number
Serial Interface and parallel interface (by bit/width transmission)
Interrupt classification, interrupt processing process, interrupt request, interrupt response, interrupt processing, interrupt return, interrupt shielding, on/off-line interruption concept, multiple interruptions
English version P647-649
By control mode:
Program Control query interface
Program Control interrupt mode, software queuing for interrupt source, vector interrupt for interrupt source
Direct DMA memory interface Access Control
Channel Interface addressing: Separate addressing (Unified addressing of storage)
Key points: detailed processes such as vector interrupt, interrupt response, execution of Interrupt implicit commands, interrupt processing, and interrupt return
English version: Chapter 2
Wang aiying: p332, P338 338-343
Interrupt implicit commands
Question type: Glossary, calculation questions, drawing and programming if needed (total score not less than 30 points)

Tip:
Computer Organization & design the hardware/software interface (2th edition) Mechanical Industry Press, which is the English version in the text and is the teaching book of this school.
The English version should be used for review, supplemented by other Chinese reference books. For more information, see previous years.

Operating system principle review (40 points, multiple choice questions and subjective questions)

Linux can be used as an instance for analysis

Process management, storage management, and file management

Part 1: 1 Operating System Concept

Resource Management (CPU, memory, I/O Derice) Resource management
Control of programme execution (schedule, dispatch, etc.) Program Control
User Interface (System Call, Shell, Gui) User Interface
Multiple choice questions
2 OS Development
Simple Batch System
The system runs jobs one by one, but the operator can submit jobs in batches.
Multi-pregramme Batch System
There are multiple jobs in the system and Job Scheduling is required.
Time-sharing system (Windows, UNIX, Linux etc .)
Various users can share computer resources
Faimess)
Main objectives of the system design: ① shorten the response time );
② Increase throughput (throughout );
Multiple choice questions
Real-Time System
Meet the real-time requirements of applications (some systems cancel virtual storage to increase the speed)
Distributed System, Embeded System
(Two Sides develop, one is big, one is small)
3 typical OS architecture
Monolithic (overall structure, single block structure): DoS
Layerd (layered)
Micro-kernel (micro-kernel structure) (I) Advantages: 1: good scalability
2: Kernel sub-
3: Not easy to crash

(Ii) Disadvantages: 1: Possible slow speed
2: difficult Design
Module structure to overcome the disadvantages of linux single block structure
4. Modern Operating System
Micro-kernel
Multi-threading
Multi-processor support
Distributed OS support
Object-oriented desigh
Virtual Machine (such as Linux virtual machine)
Real-time characteristics (Solaris is better)
These features become more and more obvious,

5. Hardware Support for the operating system
Inside CPU: Register, MMU, Cache
Interrupt
DMA
Cache

Part 2 Process Management

Process
Process-a programme in execution (it does not mean that a CPU usage is being executed)
For example, text section, data section, stack, current actirity.
Processes are dynamic. It has a life. Active
Process is the basic unit of resource ownership in OS (unit of Responce ownership)
Virtual Address Space, with other resources (I/O devices. Files)
Management of process control blocks (PCB): Various queues
For example, linnx uses chain queue
Process status
For example: running, ready, wait, stopped, swapped, zombie
(Paused) (calling in part or all) (frozen, the process is finished,
PCB still exists and the process has not died) status migration Diagram
Thread)
A program is the basic unit of scheduling)
Threads in a process share process resources, but have private stacks and thread control blocks (TCB, storing register values, priority and other thread status information)
① User-level thread (ult: user-level thread)
The user manages the service by himself, but the operating system provides a library for help. This process is not related to the operation, and the OS does not know that the operating system is not required. You can write it by yourself.
The operating system schedules a process. However, if a thread is blocked, the whole process is blocked and multi-processor cannot be used.
Eg: POSIX thread (pthread)
② Core-level thread
Applications Use APIs to call Core Thread management routines (kernel thread facility) for management.
Mode switching is required
Basic Unit for OS Scheduling (different line programs can run on multiple processes, and one blocking will not cause the whole process to be blocked)
Eg: Windows Thread
Concurrency Control: mutex and Synchronization
Critical resource)
Resources that can only be accessed by one process at a time
Critical Section)
Code segment for accessing critical resources (CS)
Only one process is in the critical zone at a time. To ensure that only one process is accessing critical resources
Mutual exclusicn)
At a time point, at most one process is at critical
Synchronization
Coordinates the processes that need to access critical resources. Otherwise, race condition may occur)
For example, P0 and P1 exercise
Maximum? Minimum? 2-100
Two processes = P0, p1
Shared variable int talty: = 0
P0p1

Critical Section
① Two prerequisites:
A. There should be no assumptions about the relative speed (not the speed) of the processor and various processes;
B. The residence time of a process in the critical section is limited.
② Three must:
Mutual Exclusion)
Free route entry: If no process is in the critical section, immediately access the process applying for entry into the critical section.
Bounded waiting: Processes applying to enter the critical section will not wait endlessly (that is, there will be no hunger)

1. software methods

Example 1: Exercise after class
Shared Variables
Boolean flag [2]; // initial flase
Int turn; // initialize 0
Process pi
Do {
Flag [I] = true;
While (turn = I)
{While (flag [J]);
Turn = I;
}
<Critical section>
Flag [I] = false;
<Remainder section>
} While (1)
Is this algorithm correct?
Mutual Exclusion cannot be guaranteed
② Dekker algorithm: the algorithm is not intuitive and can only solve two process problems
Peterson algorithm: intuitive, only two processes can be solved
Backery algorithm (bakery algorithm)

2. Use hardware support
Interruption shielding: The program cannot be executed due to high costs; the multi-processor cannot.
Special Machine commands
Test and set instruction
Exchange instruction
Advantages: Suitable for multi-processor environments, simple
Disadvantage: You must wait, which may result in starvation.

3. semaphores

① Data Structure
Count INTEGER:> = 0, indicating the number of available resources
<= 0. The absolute value indicates the number of pending start processes. The Initialization is non-negative.
② Operation (primitive)
Wait (s) (p): Waiting for resources
Siginal (s) (that is, V): releases resources.
③ Binary semaphores
You cannot determine whether a process has been suspended.
④ Producer consumer problem
Unlimited Buffer
Limited Buffer Zone wait operations cannot be changed
Change of producer and consumer: Read Only when full data is written. How can this problem be achieved?

Iv. Concurrency Control: deadlock

Deadlock (deadlock)
The system has a process set in which every process in the set is waiting for resources occupied by other processes in the set.
Four Conditions for deadlock
① Mutex (Mutual Exclusion)
② Hold and wait: keep waiting. Other resources are available when you apply for resources.
③ No preemption (non-deprivation)
④ Circular wait (Cyclic wait): if the number of resources is 1, a deadlock occurs.
Dead Lock prevention Deadlock Prevention
Indirect prevention: prevents mutual exclusion, hold and wait and no preemption from meeting
Direct prevention: prevents the occurrence of circular waut
A feasible method: sequential application method (number of all resource categories, process Application in order)
For example, for dining by philosophers, the number of chopsticks is smaller than the number of chopsticks.
Dead Lock avoidance Deadlock Avoidance
When applying for resources, the process determines whether it should meet
The number of resources required by each process must be known in advance.
Bankers Algorithm: if the new State is safe, it will satisfy it.
Safe state: Starting from this state, some execution sequence (security sequence) exists, which can complete the execution of all processes. The insecure state may not necessarily lead to a deadlock.
Dead Lock detection Deadlock Detection
The number of resources occupied by each process and the number of requested resources are known to determine whether a deadlock has occurred. The method is to mark each process (mark)

5. Process Scheduling (CPU scheduling)

1. Scheduling rules

User perspective:
① Response Time
② Turnaround time
System Perspective:
① CPU utilization
② Fairness
③ Throughput

2. scheduling mode

① Non-preemptive non-deprivation
Once a process is scheduled, it is executed until the end or cannot be executed (for example, the process is waiting for initiating an I/O operation)
② Preemptive
3. Scheduling Algorithm (for more information about the deprivation of non-deprivation)
① FCFS: service is started first until the end (non-deprivation)
② RR: Round Robin (except it, all others are based on priority)
③ SPNs: Shortest process next
If no time is provided, the execution time is predicted, for example, the exponential average method.
④ SRN: Shortest remaining next
⑤ HRRT: highest response rate preferred
⑥ Feedback: Feedback Scheduling
7. fair-share scheduling Fair Scheduling (in UNIX systems)
A. in a multi-user system, users are grouped and each group enjoys the CPU preemptive fairly.
B. For groups with many processes, each process has a relatively low CPU time.

Part 3 Storage Management

1. Basic Knowledge

① Various basic concepts
② MMU
CPU package

CPU MMU

Change logical address to physical address

2. Continuous Storage Allocation: Partition)

It is divided into several partitions by memory. Each partition has one process to support multiple programs.
......

3. Paging)

Hardware Support: TLB, MMU...
One page table for each process
OS maintains a free-frame list
Address Conversion Diagram
Page table management:
① Grading method
② Hash page table method
③ Inverted page table (only one in a system can save space, but the speed is slow)
PowerPC and so on.

4. Segmentation

It is similar to the dynamic partition in the continuous storage allocation, but there is a difference that the segments and segments can be discontinuous.
Address Conversion Diagram

5. segment page

For example, 80386 address conversion Graph

Part 4 virtual storage
Virtual Address Space of the process

1. Page fetch Policy)

A). Demand paging (On-Demand page adjustment): Common Use
B). Prepare (prefetch): optimization of demand paging. When a page is missing, load the page and Its Adjacent pages together.
(Because of locality)

2. Page replacement policy

① Optimal: Optimization Method
② FIFO: the first load is swapped out. * queue implementation is required.
③ LRU: unused pages are swapped out (based on locality, effective)
④ Clock policy: clock algorithm. LRU is not easy to implement. It is used for approximate simulation.
Belady's anomaly
⑤ Modified clock algorithm

3. Jitter

The process page missing rate is too high and can be solved using the following methods:
① Optimization Algorithm
② Provide higher-speed switching devices
③ Increase memory
④ Reduce the number of processes
Windows NT has a Working Set Method

4. Exchange

An important means to implement virtual storage
Memory expansion allows the system to run programs larger than the memory
Swap space
Switch device management
Swap Cache

Part 5 file system and I/O Management

1. File System

File category
File disk space allocation
File control block FCB
Directory file: information about the files stored in the directory (name, FCB index information)
Tree Structure File System
File Access permission:
Three types of users in UNIX files: user, group, and other
UID and gid of the process

2. Manage the free disk space of the file system

Bit Vector Method
Link Method
Group Link Method: Used in UNIX
Index Method

UNIX file system, Linux File System Linux:

UNIX: I-node (index node)

3. I/O Management
I/O device category
Buffer
I/O buffering ):
① Solve the matching of CPU and I/O speed
② Solve data transmission size matching
③ Improve I/O access
④ Directly managed by OS
Difference between buffer and Cache

Disk scheduling
......

Friendly tip: the operating system reference books listed in the new prospectus are commonly referred to as dinosaur books, and there is also a William Stallings reference, if the time is not enough, you can refer to the Chinese version of this book (published by the Electronics Industry Publishing House in the fourth version). It seems that there is no Chinese version on the market. In fact, it seems easy to understand and be patient!
Pai_^

Data structure review

Part 1 data structure review outline

Review objectives

1) understand the concept and application of the basic data structure. 2) for example, stack, queue, linked list, tree, heap, and graph.
3) master basic sorting, hashing, and searching algorithms.

Basic exam type

The probability of a question (such as a tree feature) being given is not high.
An example of an English document may be provided for filling in blank questions.
Q & A (including data structure design and algorithm structure)
The representation method, Minimum Spanning Tree, and shortest path
Programming questions (including algorithm design)
Clear thinking

Basic elements of Data Structure

Linked List
One-way linked list, two-way linked list, cyclic single-way linked list, generalized table
Queue and stack: cyclic condition judgment and array Representation
Tree
I. Two * Tree Representation of the tree
II. II. Features of the tree (layers, nodes, etc)
Iii. Expression of the 2 * tree
Iv. Traveling of the 2 * tree (for example, the first and middle orders are known, and the V. calculates the back order)
Vi. Clue 2 * tree (such as known middle-order clues, VII. traversal ),
VIII. Heap --- expressed in array, ix. Basic operations (insert and delete)
X. 2 * Search Tree)
XI. Forest (tree expression of forest)
Question level type:
▲Object definition and operation implementation of three basic types (linear table, tree, and graph) --- belong to the conceptual level
▲Application problems (such as Shortest Path) --- belong to the method level
▲Searching and sorting --- belongs to the algorithm level
Search: ① static search (sequential, binary)
② Dynamic search (Search Tree and hash)
Search Tree: Balance Tree, B + tree, B-tree)
Sorting: ① Select sorting... heap sorting
② Exchange sorting... fast sorting
③ Insert sorting... shell sorting
Figure
1) graph definition and expression (four basic expressions)
2) graph operations: Depth traversal, breadth traversal, connected components, spanning tree, etc.
3) Minimum Spanning Tree (two algorithms)
4) Shortest Path
Dijster algorithm and Dynamic Programming Method
5) AOV and AOE Networks
Typical examples: topological sorting and Key Path search
Sort
I. insert
Ii. Fast
Iii. Merge
Iv. Heap
V. Topology
Vi. Base
Search
Hashing (construction, conflict resolution)
Optimal 2 * search tree (concept)
AVL Tree (how to maintain the tree in four cases) ---> B + tree
Basic Algorithm Design Methods
Backtracking
Divide and conquer (typical example: Merge and sort)
Greedy method (for example, selecting sorting)
Dynamic Programming

Part 2 review content

I. Linked List

1. One-way linked list local reverse
Q0 Q1

 

Q0 q1 q2
While (Q1! = NULL ){
Q2 = Q1-> next;
Q1-> next = q0;
Q0 = Q1;
Q1 = Q2 ;}
Initial: q0 = NULL
Q1 = L-> next
Generalized linked list

Ii. Stack and queue

Cyclic queue (determining full and empty conditions)

Iii. Tree

Tree 2 * tree expression
Ii. Features of the tree
A) layer I 2 * Maximum number of nodes in the tree 1
B) the maximum number of nodes in a tree with K depth is 2.
C) Nature 3 (combination of the angle of the up side and the angle of the down side
D) 2I, 2I + 1 ......
Array represents the 2 * tree
2. tree traversal
Traversal Algorithm
Construct a tree based on the derivation (or prefix) of the forward/middle (backward/middle)
Clue 2 * tree (a node is added for convenient traversal)
Middle-order clues (use this to implement traversal)
Give a tree of clues
Heap
Algorithm for inserting and deleting elements

Iv. Figure

1. Graph Representation

Array representation: Matrix Representation (directed/undirected)
Representation of the adjacent table (inverse adjacent table) (directed/undirected)
Cross Linked List (directed)
Multiple linked lists (undirected)

2. Graph operations

Deep Search and wide search
Minimum Spanning Tree
A) Kruskal Algorithm
B) prim algorithm
Shortest Path
AOV and AOE
Topology Sorting and key paths

5. Sorting

Insert sorting, basic insert sorting method, and Hill sorting
Exchange sorting: basic exchange sorting (bubble, fast sorting)
Merge Sorting: loop and Recursion
Select sorting: heap sorting
Fast sorting (algorithm IDEA)
Two ideas: ① One-way scanning; ② Two-way scanning
Heap sorting
Adjust (starting from n/2, ensure that the left side is the heap, the right side is the heap, and the top side is the heap)

6. Search

1. hashing

Basic Ideas
Constructor
Conflict Resolution (open address, linear detection, and linked list)
Linked List (about its operations to achieve conflict resolution)
Exp. insert_linkhashing (...)
2. AVL Tree

First, identify the various balancing rotation methods (find out who destroyed the balancing factor and who destroyed it)
Implement rotation for maintenance (simply, after rotation, the binary tree can be sorted)

Friendly tip: Generally, you can refer to the strict version of books and exercises. In addition, it is best to take a look at the English Courseware used in the class. There may be algorithms to fill in blank questions from the middle. Pai_^

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.