2014-11-20
Translation: The Artistic Journey of a C Program

Why does a C program need to be compiled before it can be executed? Why does a C program need to go through the four steps of preprocessing, compiling, assembling, and linking to become an executable file? Let’s start with this simple C program.

Why Compile

This is not a simple question. We know that Python code does not need to be “compiled”, and you can run the result by entering a line of code, which is very user-friendly, isn’t it! This interactive runtime environment is called REPL (Read-Evaluate-Print-Loop), which reads the user’s input statement, executes the statement, outputs the value of the statement, and then returns to the waiting input state.

Read More

2014-11-19
Change and Constancy - A Two-Month Life Summary

On September 19, 2014, at 22:30, I was dragging a suitcase half my weight, walking alone under the mottled tree shadows in the west district of USTC. Just a few hours ago, I was studying the knapsack problem: how to bring back as many valuable things as possible under the constraint of backpack volume.

At that time, only a few people knew I was back: the boss and colleagues in the group, my parents, and Zhang Jingning. Just a few days ago, the LUG buddies were still discussing whether I would come back in October: because I messed up the mirrors server, I still owe everyone a meal!

This was the original beginning of the life summary written on October 20, “Escape from the Activity Room“. But I felt it was inappropriate, so I changed it to “Escape from Microsoft”. At the beginning of this month, I changed my Renren cover photo to the staff group photo of SFD on September 20, just to commemorate the beginning of this year’s new life.

Read More

2014-11-09
Inserting Backdoors into Open Source Compilers

When we mention Ken Thompson, the first thing that comes to mind is the UNIX operating system he invented. For this, he won the Turing Award in 1984. In his Turing Award speech, Ken Thompson raised a profound question: Does seeing the source code of software mean there are no backdoors? Could there be self-replicating backdoors in compilers?

KenThompson

This paper published in “ACM Communications” is only three pages long and omits many details. The principle is a bit like a C program that outputs its own code, but it’s much more difficult. Following in the footsteps of the sages, I inserted a self-replicating backdoor into an open-source C compiler—tcc. This compiler, with the backdoor, will automatically insert a backdoor when compiling the source code of the Linux login program sulogin.

Read More

2014-11-05
Why 3G Consumes More Power Than Wi-Fi

The day before yesterday, my classmate Zhang Qingyu told me that it’s best to use Wi-Fi and turn off the 3G network when Wi-Fi is available, which can save a lot of power. Does 3G really consume more power than Wi-Fi? I looked up the literature and found that it is indeed the case. When the data to be transmitted is less, the difference in power consumption can be as much as 10 times.

Blue line: 3G power consumption; Green line: wifi power consumption (Source: TailEnder) Blue line: 3G power consumption; Green line: wifi power consumption; Purple line: power consumption considering wifi scanning and establishing connection (Source: TailEnder)

The reasons are mainly two-fold:

  1. After the 3G network completes data transmission, it needs to maintain a high power state for a period of time;
  2. The transmission power of the 3G network is much greater than that of the Wi-Fi network.
Read More

2014-10-29
Why I Chose Computer Science Major

All active members of LUG will sooner or later be attracted to the circle of coders.
The origin and truth of this rumor are not considered for the time being. Whether it is the atmosphere of LUG that leads the buddies to the road of coders, or those who are determined to take the road of coders will be active in LUG for a long time, I can’t tell.

Why choose computer science major, in fact, is two propositions:

  1. Why choose computer as a future career?
  2. Why choose computer science major during undergraduate?
    I try to interpret these two propositions with my own experience. In my youth, I once regarded scientist as my dream. In the third year of high school, I thought about doing theoretical computer research. At the juncture of freshman to sophomore, I once hesitated between mathematics and computer science, and even considered studying physics. Because I couldn’t figure it out, I didn’t apply for a change of major in the second semester of my freshman year. A week after the start of the second semester of sophomore year, I felt that I couldn’t continue to be chaotic, so I submitted an application for a change of major. From the second week, I embarked on the road of no return to coders.
Read More

2014-10-20
Escape from the Activity Room

Escape from Microsoft

On the morning of September 17, 2014, in the conference room on the 12th floor of Microsoft Research Asia. The boss just returned to Beijing after a month-long international conference, and I nervously reported the unsatisfactory progress of the past month at the group meeting. In the previous few days, my heart was beating wildly, fearing that the boss would see through my nature of not working hard. Unexpectedly, the boss did not scold me after the report, but said that my model has made great progress compared to a month ago. However, we both clearly realized that our work could not catch up with the NSDI conference deadline on September 26.

Microsoft Building in the early morning of September 17 Microsoft Building in the early morning of September 17

Microsoft Building in the early morning of August 25 Microsoft Building in the early morning of August 25

Read More

2014-09-29
The Overlooked Treasure: IPX Protocol

The Trouble with DHCP

The story begins with the update of the network access management device at USTC.

Capture

The reason for the unified allocation of IP addresses in public internet access areas is that the IP address segments scattered and allocated by each building are not enough. A few years ago, the main force of the Internet was desktop computers and laptops, and it was impossible to keep them on all the time; but now everyone has smart terminals, possibly more than one, and will connect to the Wi-Fi wherever they go. Many places that were more than enough with the /24 address segment (256 IPs) have encountered situations where IP addresses cannot be allocated during peak periods. The size of USTC’s IP address pool is limited, and centralized allocation has solved the problem of insufficient addresses.

This was originally a happy event for everyone, but the new equipment brought new problems. The library query machine that uses network booting freezes after a period of time. The reason is that the IP addresses allocated during the startup phase of the parent system and the startup phase of the subsystem are different, and this difference is due to the bug of the BRAS network access management device.

Capture

Read More

2014-07-06
Releasing the 5% Disk Space Eaten by the File System

Those who use the ext file system to store data may have noticed that a 200 G partition can only use 190 G, and a 2000 GB partition can only use 1900 GB. Where did this 5% disk space go? Some people think this is the difference between the decimal system (1000) and the binary system (1024), but this is not the case.

1
2
3
$ df /mnt/sdb/
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sdb 1922860936 1839798972 0 100% /mnt/sdb

The available space of the above-mentioned 2 T disk is 0, which seems to be full. Try to create a directory and find that there is no space left.

1
2
$ mkdir hello
mkdir: cannot create directory `hello': No space left on device

But sudo mkdir hello can succeed! What’s going on? The answer lies in the “reserved space” of the ext file system.

Read More

2014-06-22
Graduation—A Tribute to My Lost Youth

This article was selected for the special issue “See You, 2014”

Looking at the “Network Fee Settlement” section marked “Exempt” on my school departure form, I was filled with mixed emotions. I might be one of the few students who never activated the “Network Pass.” Because in the computer room of the Youth Academy, I didn’t need the Network Pass, and later with the LUG server, I didn’t need it either. Now, sitting in my dorm room, I use a wireless signal amplifier to connect to ustcnet from the East Activity Center. Actually, I don’t really care about the 20 yuan monthly network fee. Not activating the Network Pass is more of a symbol, a connection to fragmented memories, a tribute to the quietly passing youth. Just my personal musings, don’t criticize.

10 Years Ago: Programming Began with Tan Haoqiang

When I first entered junior high, I heard about computer competitions. Somehow, my parents thought computer competitions were about playing games. I didn’t know to check online, so I believed it. A month after the course started, a classmate told me that computer competitions involved many problems like those in math competitions, which I should enjoy. My parents then verified with the class teacher and found out that computer competitions were about programming. At that time, my understanding of programming was like the uncle who fixes computers typing commands in a black box. When I taught a classmate to make a website in college, she also referred to the Windows command prompt as a black box, which made me chuckle. We all started from there.

The first time I attended a computer competition class, the computer room with 40 seats was packed with over 60 people, and I didn’t even have a seat. The teacher was explaining printf on the blackboard, and the students were dozing off. Seeing everyone with a green-covered second edition of “C Programming” by Tan Haoqiang, with “7 million copies sold” on the cover, I felt Tan Haoqiang was a computer god second only to Bill Gates. I heard that a senior even bought “Introduction to Algorithms,” although it was a bit expensive, he still “invited” a copy to worship. The reason for worshiping it was that it didn’t have directly copyable C code. Can a book without code be called a computer science book?

Read More

2014-06-01
Fault-Tolerant Software Architecture for a SDN Router

Traditional routers require a cold reboot if any component of the router software fails or needs to be upgraded. Network traffic is likely to be interrupted for minutes in the meantime. This work designs and implements a fault-tolerant software architecture composed of four components: clients including routing protocols and administrator, the router information base (MiniDB), a daemon to resolve rule conflicts among clients (SyncD) and the SDK for programmable switching chip. This architecture allows any component to fail or upgrade without interrupting the data plane, and the control plane will automatically recover within a predictable time after the component restarts.

Publication

Dissertation of Bachelor’s Degree, 2014. [PDF (Chinese)]

People

  • Bojie Li, 4th year undergraduate in USTC
  • Dr. Kun Tan, Senior Researcher in Microsoft Research Asia
Read More
RSS