20135209--Interim Summary

Source: Internet
Author: User

First, the contents of the textbook chapter I computer system roaming

Information = bit + context

The information in the computer is expressed in binary numbers, and because these bits are in different positions, are signed number or unsigned number, is big-endian or small-end method, due to the specific interpretation of different, resulting in different results.

After that, learning is how to read and write bits, and how the context corresponds.

Chapter II Representation and processing of information 1.gcc-m32 can generate 32-bit code 2 on a 64-bit machine. Two representations of byte order: The small end is "high-to-high, low-to-low", The big side is the opposite 3. Almost all machines use a complement; In general, most numbers are signed by default. However, in an expression, if one parameter is unsigned, the other one defaults to the unsigned number 4. Floating-point construction

IEEE floating-point standard-encodes a number with v= ( -1) ^sm2^e. Among them:

Symbol: s Determines whether the number is negative (S=1) or positive (s=0), and the sign bit with the value 0 is interpreted as a special case.

Mantissa: M is a binary decimal.

Order code: E is weighted against floating-point numbers and can be negative.

Chapter III Machine-level representation of the program

addressing methods and several operations, mov,push,pop,leal, and jump instructions, control transfer instructions and so on .

Register using the custom frame stack structure

Fourth Chapter processor Architecture

This chapter learns a relatively simple processor Y86, and the instruction set is a lot less than IA32.

Y86

A simple set of instructions that can be called a subset of the IA32 instruction set, including only four-byte integer operations, with fewer addressing methods. The instruction encoding length varies from 1--6 bytes. One importance of the instruction set is only that the byte encoding must have a unique interpretation.

With respect to the instruction structure, the first byte of each instruction indicates the type of instruction; This byte is divided into two parts, four bits per part: High Four bits is the code part (0--0XB), and fourth bit is the function part. Some abbreviations are added here: immediate count (i), register (R), memory (m). The register designator byte appended to the instruction is the data source (if the number is immediate, set this bit to 0xf), the destination register/base register. Some instructions need to append four bytes of constant number, using the small-end method (reverse) encoding

The PUSHL will reduce the stack pointer by 4 and write a register value to the memory. Therefore, the results of executing PUSHL%ESP and popl%esp are not fixed. Stage of processing operations--
    • Fetch: Reads the instruction byte from the register, the address is the value of the program counter. Calculates the next instruction address equal to the value in the PC plus the length of the removed instruction;
    • Decoding: Reads up to two operands from the register file, reads the registers indicated by the instruction Ra and the RB, but some of them are read register%ESP;
    • Execution: The ALU performs the specified action, the valid address of the reference, or the modified stack pointer, and the resulting value is called Vale;
    • Access: Writes data to the memory or reads data from the memory, the readout data is called Valm;
    • Write back: Write two results to a register file;
    • Update PC: Set the PC to the next instruction address.
Sixth chapter Memory Hierarchy

Principle of locality:

A well-written computer program often tends to refer to data items that are adjacent to other recently referenced data items, or to the data item itself that has recently been referenced.

Classification:

  • Time locality
  • Spatial locality

The simple principle of quantitative evaluation of locality in a program:

  • A program that repeatedly references the same variable has good time locality
  • For programs with reference patterns with a step size of K, the smaller the step size, the better the spatial locality
  • The loop has a good time and spatial locality for taking orders. The smaller the loop body, the more the loop iteration number, the better the locality.

Memory Hierarchy Central idea: each tier of storage devices is the next level of "cache."

1. Cache Hits

When a program needs a data object D in Layer k+1, first look for D in a block that is currently stored in the K layer, and if D is just cached in the K layer, it is called a cache hit.

The program reads D directly from level K, faster than reading d from the k+1 layer.

2. Cache Misses

That is, there is no cached data object D in Layer K.

The K-tier cache then extracts the block containing d from the k+1 cache. If the level K cache is full, it is possible to overwrite an existing block

Overwrite--Replacement/expulsion

Replacement policy:

  • Random substitution strategy-randomly sacrificing a block
  • The least recently used substitution strategy lru-sacrifices the last accessed time distance now to the furthest block.
3. Types of Cache Misses (1) mandatory misses/cold misses

That is, the K-tier cache is empty (called a cold cache), and access to any data object is not hit.

(2) Conflict not hit

Because of a placement policy, placing a block limit on the k+1 layer in a small subset of the K-layer block causes the cache to be not full, but the corresponding block is full and will not be hit.

(3) Capacity not hit

When the size of the working set exceeds the size of the cache, the cache undergoes a capacity miss, which means that the cache is too small to handle the working set.

Cache memory .

A cache is an array of cache groups whose structure can be described using tuples (s,e,b,m):

S:这个数组中有S=2^s个高速缓存组E:每个组包含E个高速缓存行B:每个行是由一个B=2^b字节的数据块组成的m:每个存储器地址有m位,形成M=2^m个不同的地址

In addition, there are markers and valid bits:

有效位:每个行有一个有效位,指明这个行是否包含有意义的信息标记位:t=m-(b+s)个,唯一的标识存储在这个高速缓存行中的块组索引位:s块偏移位:b

The cache structure divides m addresses into T-markers, S-group index bits, and B-block offsets.

Ii. common commands and tools: Man-k:

Commonly used to search, combined with pipe use. Examples are as follows:

grep k2 | grep 2

The search contains both K1 and K2, and is part of the system call.

The last number means the section in the Help manual, the man Manual has a total of 8 sections, the most commonly used is 123, meaning the following:

1.Linux2.系统调用3.c语言

But when you are using the man statement alone, you want to look at the explanations in one of these individual sections, the usage is this:

3 printf

That is, find the use of printf in the C language.

Grep-nr

This statement can be used to find keywords, full-text search, and can directly find content within a file. which

Tools: Vim

Vim is a very useful editor with a total of six basic modes, the most commonly used are normal mode, insert mode, and command line mode. You need to be familiar with the switching modes between the three modes:

i 或 a 插入→普通: Esc 或 Ctrl + [普通→命令行: :命令行→普通:Esc 或 Ctrl + [

Common entry, save, and exit directives:

进入:vim 文件名保存:命令行模式 :w退出:命令行模式 :q

Common actions:

删除:dd删除整行复制:yy复制整行粘贴:p

※ Practical function: Swap the line--DDP, quickly swap the line with the cursor below it.

Gcc

Common options

-c只编译不链接,生成目标文件.o-S只编译不汇编,生成汇编代码-E只进行预编译,不做其他处理-g在可执行程序中包含标准调试信息-o file将file文件指定为输出文件-v打印出编译器内部编译各过程的命令行信息和编译器的版本-I dir在头文件的搜索路径列表中添加dir目录

Gdb:

Compilation process

预处理:gcc –E hello.c –o hello.i;gcc –E调用cpp生成中间文件编 译:gcc –S hello.i –o hello.s;gcc –S调用ccl翻译成汇编文件汇 编:gcc –c hello.s –o hello.o;gcc -c 调用as翻译成可重定位目标文件链 接:gcc hello.o –o hello ;gcc -o 调用ld**创建可执行目标文件
Gdb

Note: Use GCC to compile with "-G" parameter before GDB can be debugged

The most basic commands of GDB are:

programm(启动GDB)l查看所载入的文件b设断点info b查看断点情况run 开始运行程序bt打印函数调用堆栈p查看变量值c 从当前断点继续运行到下一个断点n 单步运行(不进入)s 单步运行(进入)quit 退出GDB

Four types of breakpoints:

1.行断点b [行数或函数名] <条件表达式>2.函数断点b [函数名] <条件表达式>3.条件断点b [行数或函数名] <if表达式>4.临时断点tbreak [行数或函数名] <条件表达式>

Additional Debugging Tools:

Cgdb, there is a separate debug window, more convenient to view

DDD, Graphics page

General wording of Makefile:

A makefile file mainly contains a series of rules, each of which contains the following:

    • Target bodies that need to be created by the make tool, usually executables and target files, or actions to perform, such as ' clean ';

    • The files that are dependent on the target body to be created are usually the other files needed to compile the target file.

    • The command to run when creating each target body, which must start with tab tab

The format is:

test(目标文件): prog.o code.o(依赖文件列表)tab(至少一个tab的位置) gcc prog.o code.o -o test(命令) .......即:target: dependency_filescommand

There are two ways to define variables:

(1)递归展开方式VAR=var(2)简单方式VAR:=var

The format for using variables is:

$(VAR)
Third, the supplementary content:

Regular Expressions:

Role:
    • Verify that the match is
    • Find
    • Replace
Rules:
    • \ special symbol, which indicates the following character itself
    • [] matches any of these characters, but each match matches only one
    • [^] matches any character except one, and each match matches only one
    • {n} number of times decorated, repeat n times, as follows:

      ?= {0,1}+= {1, }*= {0, }{m,n}:至少为m,至多为n
      Matching method:
    • ^ Match from where the string starts
    • $ match from where the string ends
    • | Can match left or right

"References: textbooks, previous blogs, excellent notes from the students who were introduced by the teacher"

Six, Harvest

The new method of learning is a lot different than coping with a teacher's own learning, and feels that the knowledge learned is more and easier to use than before. Enhance the practicality of the content of the schoolwork, improve the practical ability;

Vii. Lack of

I feel that I can not persevere, sometimes read the writing Bo are very hasty, leading to poor quality, there are a lot of knowledge points are not thoroughly understand, long time to put aside not to ask the end will become a big problem, in the future learning should always alert themselves, many small knowledge points can not be careless.

In addition, usually read less time, waste time more, should be reasonable to arrange study time, to ensure efficiency.

20135209--Interim Summary

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.