spark on yarn 优先级设置 systick优先级_堆栈

 

systick 中断的优先级往往设置为最低值,而不是最高值;如果设置为最低值不会发生上图标号[6]处的情况,设置为最低可能会被其他中断抢占,延长systick的响应时间,但是这个延迟不会累计,因为systick的周期是固定的。举个例子,比如tick是1s一次,假设中断被抢占后会延迟tick中断响应100ms,那么心跳的时钟节拍由1s 2s 3s 4s 5s 6s 变成了1s <抢占> 2.1s 3.1s 4.1s 5.1s 6.1s,之后再抢占一次就变成了 1s 2.1s <抢占> 3.2s 4.2s 5.2s 6.2s,之后再抢占一次就变成了 1s 2.1s 3.2s <抢占> 4.3s 5.3s 6.3s,心跳间隔永远是均匀的1s。

 

大小端:

spark on yarn 优先级设置 systick优先级_寄存器_02

 

 

寄存器:

R0-R12: can be used during common operations to store temporary values, pointers (locations to memory), etc. R0, for example, can be referred as accumulator during the arithmetic operations or for storing the result of a previously called function. R7 becomes useful while working with syscalls as it stores the syscall number and R11 helps us to keep track of boundaries on the stack serving as the frame pointer (will be covered later). Moreover, the function calling convention on ARM specifies that the first four arguments of a function are stored in the registers r0-r3.

R0-R12:可以在常见操作中用于存储临时值、指针(内存位置)等。例如,R0可以在算术运算期间作为累加器引用,也可以用于存储先前调用的函数的结果。R7在处理系统调用时非常有用,因为它存储系统调用号,R11帮助我们跟踪堆栈上的边界,作为帧指针(稍后将介绍)。此外,ARM上的函数调用约定指定函数的前四个参数存储在寄存器r0-r3中。

 

R13: SP (Stack Pointer). The Stack Pointer points to the top of the stack. The stack is an area of memory used for function-specific storage, which is reclaimed when the function returns. The stack pointer is therefore used for allocating space on the stack, by subtracting the value (in bytes) we want to allocate from the stack pointer. In other words, if we want to allocate a 32 bit value, we subtract 4 from the stack pointer.

R13: SP(堆栈指针)。堆栈指针指向堆栈的顶部。堆栈是用于特定于函数的存储的内存区域,该区域在函数返回时被回收。因此,堆栈指针用于在堆栈上分配空间,方法是从堆栈指针中减去我们想要分配的值(以字节为单位)。换句话说,如果我们想分配一个32位的值,我们从堆栈指针中减去4。

 

R14: LR (Link Register). When a function call is made, the Link Register gets updated with a memory address referencing the next instruction where the function was initiated from. Doing this allows the program return to the “parent” function that initiated the “child” function call after the “child” function is finished.

R14: LR(链路寄存器)。当函数调用时,链接寄存器会更新一个内存地址,该内存地址引用的是函数发起的下一条指令。这样做允许程序在“子”函数完成后返回到发起“子”函数调用的“父”函数。

 

R15: PC (Program Counter). The Program Counter is automatically incremented by the size of the instruction executed. This size is always 4 bytes in ARM state and 2 bytes in THUMB mode. When a branch instruction is being executed, the PC holds the destination address. During execution, PC stores the address of the current instruction plus 8 (two ARM instructions) in ARM state, and the current instruction plus 4 (two Thumb instructions) in Thumb(v1) state. This is different from x86 where PC always points to the next instruction to be executed.

R15: PC(程序计数器)。程序计数器会根据执行指令的大小自动递增。这个大小在ARM状态下总是4个字节,在THUMB模式下总是2个字节。当分支指令正在执行时,PC保存着目的地址。在执行过程中,PC在ARM状态下存储当前指令加8(两条ARM指令,因为流水线,预取址)的地址,在Thumb(v1)状态下存储当前指令加4(两条Thumb指令)的地址。这与x86不同,在x86中PC总是指向下一条要执行的指令。