CSAPP Walk Through: Chapter 6

These series of notes are based on the book Computer Systems: A Programmer's Perspective. So before you read, please make sure you have a hard(soft) copy of the book. The homepage for the book is http://csapp.cs.cmu.edu/. I put these notes here for me to review the book conveniently, hope it helps you as well. The Memory Hierachy A memory system is a hierarchy of storage devices with different capacities, costs and access times. Cycles cost to access data in different kind of memory. CPU register: 0 cycles. Cache: 1 - 30 cycles. Main Memory: 50…

Read More

CSAPP Walk Through: Chapter 2

These series of notes are based on the book Computer Systems: A Programmer's Perspective. The homepage for the book is http://csapp.cs.cmu.edu/. I put these notes here for me to review the book conveniently, hope it helps you as well. Information Storage Bytes Byte is the smallest addressable unit of memory. Every byte of memory is identified by a unique number(address). All possible addresses form the virtual address space. Words Word size indicates the nominal size of integer and pointer data. For a machine with a $w$-bit word size, the virtual memory addresses can range…

Read More

CSAPP Walk Through

These series of notes are based on the book Computer Systems: A Programmer's Perspective. The homepage for the book is http://csapp.cs.cmu.edu/. I put these notes here for me to review the book conveniently, hope it helps you as well. Information = Bits + Context Files that consist exclusively of ASCII characters are known as text files. All other files are known as binary files. The machine representations of numbers are not the same as integers and real numbers as they a finite approximations that can behave in unexpected ways. Why is C so successful? C was closely tied…

Read More

Run Shadowsocks in a Router With OpenWRT to Unblock the Great Firewall of China

Nowadays, Shawdowsocks has become a lot more popular in China. We use it to break through the Chinese network block so that we can visit Google without blocking. If you are living in China and have the demand of visiting websites like Google, Twitter, YouTube and BBC, Shadowsocks is a great choice to build your proxy server. However, if you are not living in China but still have the difficulty playing online games as the ping is too high and the connection is unstable, you can still try Shadowsocks as it may bring you a more stable network environment as…

Read More

Never use mutable default parameters in Python

While writing a Python function, you may need to declare some default parameters, people new to Python may write code like this: def test(q=[]): q.append(1) return q This function seems to be well written, whereas when calling it without a given parameter q, you may run into trouble. >>> test() [1] >>> test() [1, 1] >>> test() [1, 1, 1] >>> test() [1, 1, 1, 1] This is weird at first, as required the function should return the list [1] after calling without a give parameter. However after carefully…

Read More

Understand how Git works in 5 diagrams

Git has been a perfect choice for Version Control System. With git we can promptly switch between different revisions from our project, logging every line changed from the code, and check the difference between any two revisions. In this article I'm gonna explain you how Git objects, the most important part in Git, works. Git Obejcts If you have Git repositories in your computer, you must have noticed that there is a folder named .git in your root of the repository. It's like this: ▸ hooks/ ▸ info/ ▸ logs/ ▸ objects/ ▸ refs/ config description FETCH_HEAD HEAD index packed-refs The most important folder…

Read More