自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(16)
  • 收藏
  • 关注

原创 2018.7.4 la-rpc心跳与断线重连部分记录

心跳与断线重连主要解决客户端连接时出现的三种问题:(1)client初次连接失败,需要重连(2)server进程关闭,client检测tcp断开重连(3)server断电,client通过心跳检测重连(注:所有情况都默认是在单一server的情况下实现的,即暂时不考虑多服务器多channel的负载均衡实现)一、client初次连接失败,需要重连使用ConnectionListenerb.conne...

2018-07-05 14:49:07 1023

原创 记录一次非常典型的可见性引起的多线程BUG,用volatile解决

在la-rpc consumer最初使用时,RpcProxy新建一个client,并调用send,使用channel发送信息。if(RpcClient.client==null){ synchronized (RpcClient.class){ if(RpcClient.client==null) Rp...

2018-07-05 12:50:10 370

原创 shelllab笔记

shlab的目的是完成几个函数,实现一个简单的shell。需要实现的函数如下:• eval: Main routine that parses and interprets the command line. [70 lines]• builtin_cmd: Recognizes and interprets the built-in commands: quit, fg, bg, and job...

2018-06-11 17:31:52 1054

原创 attacklab笔记

做完attacklab记点什么,防止以后什么都不记得了。phase1-3用getbuf读取字符串,但不检测栈溢出,正常的gets()在返回前会call一个check函数,检查栈溢出。在lab里通过栈溢出顶掉返回地址,把返回地址变成栈的地址,inject代码到getbuf的栈里或到上层的栈里。在这个过程中明显感受到代码和栈和数据都是在一个地址空间里。phase4-5中增加了两种防止栈溢出的机制:1....

2018-05-14 21:22:35 1974

转载 寄存器的名称及作用

在此记录下寄存器的名称及作用,方便查看。不同体系下寄存器名称: |63..32|31..16|15-8|7-0|        |AH..AL..|          |AX......|    |EAX...........| |RAX...................|不同寄存器作用:rax 作为函数返回值使用rsp 栈指针寄存器,指向栈顶rdi...

2018-05-05 14:21:42 5414 1

原创 CS:APP:BombLab 4

这篇文章意为记录下Bomb4中比较微妙的地方。之前经过分析,phase_4需要两个int值,第一个值<=14,第二个为0。又发现<fun4>传回的rax应为0。现在着重分析<fun4>如下:0000000000400fce <func4>:400fce: 48 83 ec 08 sub $0x8,%rsp400fd2: 8...

2018-05-04 19:33:10 525

原创 GC机制总结

if 放入堆的对象>edan    进行MinorGC前判断    if edan+s<oldremain||    历次平均进入老年代大小<oldremain        MinorGC    else FullGColdremain:老年代最大连续空闲空间|    ...

2018-04-30 17:46:22 166

原创 180419爱奇艺笔试分糖果问题:用Dp解决回溯?

回溯解法如下:public class Main { static int count=0; public static void main(String[] args) { String s="aaa"; int index=1; StringBuilder sb=new StringBuilder(); sb.ap...

2018-04-20 10:58:49 290

原创 SICP 2.54 符号列表equal?

(define (equal? x y) (cond((and (pair? x) (pair? y)) (and(equal? (car x) (car y)))) ((and (not (pair? x)) (not (pair? y))) (eq? x y)) (else false)))(equal? '(a b c d)

2017-06-09 21:59:02 222

原创 SICP 1.45 n次方根

#lang scheme(define (compose f g)  (lambda(x)(f(g x))))(define (repeated term n )  (if(> n 1)     (compose (repeated term (- n 1)) term)     term ))(define (average-damp f)  (lambda(x) (averag

2017-04-17 09:50:50 246

原创 SICP 1.43

#lang scheme(define (compose f g)  (lambda(x)(f(g x))))(define (inc x)  (+ x 1))(define (square x)  (* x x))(define (repeated term n )  (if(> n 0)     (compose (repeated term (- n 1)) term)

2017-04-16 13:41:13 225

原创 SICP 1.41 lambda函数嵌套展开的思考

#lang scheme(define (double f)  (lambda(x)(f(f x))))(define (inc x)  (+ x 1))(((double (double double)) inc) 5)结果为21,说明Inc被调用了16次。在直觉上,double调用两次,(double double)调用4次,(double (double doub

2017-04-16 12:02:56 567

原创 SICP 1.28费马检查与Miller-Rabin检查的思考

费马小定理有两种形式:(p为不能整除a的素数)1.a^p≡a(mod p)2.a^(p-1)≡1(mod p)a费马检查使用第一种形式,Miller-Rabin检查使用第二种形式。能完全通过费马检查的数称为绝对假素数,即Carmichael数。而Carmichael数不能完全通过Miller-Rabin检查。这是因为费马小定理的逆定理不成立,即存在a^p≡a(mod p)成

2017-04-07 11:51:12 370

原创 SICP 1.12

(define (pt row col) (cond ((= row col) 1) ((= col 1) 1) (else (+ (pt (- row 1)(- col 1)) (pt (- row 1) col)))))

2017-03-30 19:31:17 289

原创 SICP 正则序与应用序

正则序:表达式过程展开,直到只包含基本运算符的表达式。遇到特殊过程,先按特殊过程求值。应用序:表达式中每个对象都进行代换,逐层进行。

2017-03-29 22:07:43 400

原创 SICP 1.11迭代计算方式实现

(define (three n) (three-iter 2 1 0 (- n 2)))(define (three-iter b m s count) (if(= count 0) b (three-iter (+ b (* m 2)(* s 3)) b m (- count 1))))默认n>=3。

2017-03-29 21:51:46 226

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除