Network Protocol
Introduction 计算机网络的架构分为很多层,其中主流的分类方法是四层的TCP/IP结构,本文将从这四层结构出发(又是自顶向下😆),介绍属于网络不同层的网络协议。 Layer 应用层 HTTP 运输层 TCP UDP 网络层 IP 链路层 Ethernet
MIT 6.S081 Lecture 14: File systems
Reading Read Chapter8 read code File System User-friendly names/pathnames Share files between users/process Persistence/durability Why intersting? Abstraction is useful Crash safety Disk layout Performance -> Storage devices are slow -> to be fast storage -> buffercache device -> concurrency API example xv6文件系统提供的API实现了文件系统基本的用户级操作 FS structure inode含有文件的信息,代表一个独立的文件 inode的大小是64Bytes FS Layer 文件系统的多层结构抽象了硬件,并为软件提供了接口 Storage devices 这里需要...
Bit operation
基本运算 1.& 运算符 与运算符,两位都为1时,结果为1,否则为0。 2.| 运算符 或运算符,两位都为0时,结果为0,否则为1。 3.^ 运算符 异或运算符,两位相同时为1,不同为0。 4.~ 运算符 取反运算符,按位取反。 5.<< 左移运算符 向左移动x位,数值大小变为原来的2x倍 取模,例如int型整数有32位,至多移32位,对于1<<35,1<<3结果是相同的。 6.>> 右移运算符 向右移动x位,数值大小缩小为原来的2x倍,由逻辑右移和算数右移两种,在C++中取决于数据类型 运算定律 交换律始终成立 结合律只对单一运算成立 & |是不可逆运算,造成信息丢失,仅仅构成交换幺半群 ^ 符合结合律,^0不变,也就是说,^ 运算在S = {0, 1}下构成一个幺半群,其单位元为0,且任意元素的可逆元素为自身,则构成了一个群,另外,由于位运算交换律始终成立,这个群又是一个阿贝尔群(交换群)。 证明如下 $ 我们说(S, *)是一个幺半群,该二元运算满足结合律,且具有单位元,即 $ $$ (1...
RISC-V
Introduction RISC-V是一种精简指令集架构的汇编语言 Feeling RISC-V的核心说明文档只有一页纸那么大,相比起x86臃肿的指令集架构,RISC-V的简单易学很适合作为汇编语言的入门,近年来指令集架构也有从CISC到RISC转变的倾向,但是大部分的机器仍然在x86下运行,整个世界的结构可以说是以x86为主流的。 Links RISC-V Green Card in CS61C 详尽文档 ISA updating…
MIT 6.S081 Lecture 12: Scheduling 2
Reading Read remainder of “Scheduling” read code Sleep and Wake up Deadlock 造成死锁的情况是,p1获取了锁,但是通过swtch切换了进程,另一个进程p2也想要获取锁,但p1并没有释放锁,于是p2进入了循环等待的过程中,而这种情况是无法停止下来的,这样获取锁和解除锁的顺序不同导致的问题就叫做死锁 Coodination Lost Wakeups
MIT 6.S081 Lecture 11: Scheduling 1
Reading Read “Scheduling” through Section 7.4 read code Thread thread - one serial execution 一个串行执行代码的单元,只占用一个cpu 一个线程区别于其他线程的地方是pc, regs, stack interleave thread multi core switch shared memory? -> Locks xv6 内核线程共享了内存 xv6 用户进程不共享内存 Linux 用户进程共享内存 其他的多任务解决方案 事件驱动编程 状态机 challenge switch - interleave 线程调度(scheduling) what to save / restore compute - bound 运算密集进程不肯让出cpu timer interrupts kernel handler yield - switch pre-emptive scheduling 抢占式调度 voluntary scheduling 自愿调...
MIT 6.S081 Lecture 8: Q&A labs
pagetable lab 似乎讲解的是2020的lab,与2021的lab不同
MIT 6.S081 Lab traps
Compulsory exercises Preparation reading To start the lab, switch to the trap branch 123git fetchgit checkout trapsmake clean RISC-V assembly (easy) Which registers contain arguments to functions? For example, which register holds 13 in main’s call to printf? a0-a1 a2-a7; a2 Where is the call to function f in the assembly code for main? Where is the call to g? (Hint: the compiler may inline functions.) f in printf 0x34 , g in f 0x14 At what address is the function printf located? ...
CTF
Introduction CTF(Capture The Flag)夺旗赛,是网络安全爱好者之间的竞技游戏。 Links CTF wiki CTFHub updating…
