(Click the public account above to quickly follow)
Author: Blog of the Ordinary Road
my.oschina.net/zhoukuo/blog/335788
If you have good articles to submit, please click → here for details
1. Webbench
Webbench is a very simple website stress testing tool used under Linux. It uses fork() to simulate multiple clients accessing the specified URL simultaneously, testing the performance of the website under pressure, and can simulate up to 30,000 concurrent connections to test the website’s load capacity. Webbench is written in C, and the code is extremely concise, totaling less than 600 lines. Download link: http://home.tiscali.cz/~cz210552/webbench.html
2. Tinyhttpd
Tinyhttpd is a lightweight HTTP server developed in C, with only 502 lines of code (including comments), accompanied by a simple client. Reading this code helps understand the essence of an HTTP server. Download link: http://sourceforge.net/projects/tinyhttpd/
3. cJSON
cJSON is a JSON encoder/decoder in C, very lightweight, with only over 500 lines of C code, and performs very well.
cJSON has a few weaknesses; although its functionality is not very powerful, its small size and speed are commendable. The code is well-maintained, and its structure is simple and easy to understand, making it a great C language project for learning. Project homepage: http://sourceforge.net/projects/cjson/
4. CMockery
CMockery is a lightweight framework for C unit testing released by Google. It is compact, has no dependencies on other open-source packages, and has low invasiveness to the code being tested. The source code of CMockery is less than 3K lines, and reading the source code of will_return and mock makes it clear.
Main features:
-
Free and open-source, with technical support from Google;
-
Lightweight framework, making testing faster and simpler;
-
Avoids complex compiler features, ensuring good compatibility with older compilers;
-
Does not require the code under test to depend on the C99 standard, which is useful for many embedded system developments.
Download link: http://code.google.com/p/cmockery/downloads/list
5. Libev
Libev is an open-source event-driven library based on epoll, kqueue, and other OS-provided infrastructures. It is known for its efficiency, unifying IO events, timers, and signals under a single event handling framework. Based on the Reactor pattern, it is efficient and has concise code (over 8000 lines in version 4.15), making it a great resource for learning event-driven programming. Download link: http://software.schmorp.de/pkg/libev.html
6. Memcached
Memcached is a high-performance distributed memory object caching system for dynamic web applications to reduce database load. It reduces the number of times the database is read by caching data and objects in memory, thus speeding up dynamic database-driven websites. Memcached is based on a hashmap that stores key/value pairs. The code size of Memcached-1.4.7 is acceptable, with only about 10K lines. Download link: http://memcached.org/
7. Lua
Lua is great; it was invented by Brazilians, which annoys me, but not enough to blush, just a bit envious.
What makes me blush is Lua’s source code, which is 100% ANSI C, without any mix. It can be easily compiled on any platform that supports ANSI C compilers. I have tried it, and there is absolutely no nonsense. The code size of Lua is small enough; version 5.1.4 has only about 15,000 lines, and removing blank lines and comments probably brings it down to about 10,000 lines. Download link: http://www.lua.org/
8. SQLite
SQLite is an open-source embedded relational database that implements a self-contained, zero-configuration, transactional SQL database engine. Its features include high portability, ease of use, compact structure, efficiency, and reliability. It is small enough, with approximately 30,000 lines of C code, totaling 250K. Download link: http://www.sqlite.org/.
9. UNIX v6
The source code of the UNIX V6 kernel, including device drivers, is about 10,000 lines, a quantity that beginners can fully understand. There is a saying that the maximum amount of code a person can understand is about 10,000 lines, and the UNIX V6 kernel source code is right within that range. At this point, are you also thinking, “If it’s only 10,000 lines, maybe I can learn it too?”
On the other hand, recent operating systems, such as the latest version of the Linux kernel, are said to exceed 10 million lines of code. Even for those who are not beginners, it is basically impossible to fully understand all the code. Download link: http://minnie.tuhs.org/cgi-bin/utree.pl?file=V6
10. NETBSD
NetBSD is a free, highly portable UNIX-like operating system, the most portable operating system available today, capable of running on many platforms, from 64-bit alpha servers to handheld devices and embedded systems. The slogan of the NetBSD project is: “Of course it runs NetBSD.” It has a simple design, standardized code, and numerous advanced features, making it highly regarded in both industry and academia. Due to its simple design and advanced features, it performs excellently in both production and research, and it also has complete source code supported by users. Many programs can be easily obtained through the NetBSD Packages Collection.
Download link: http://www.netbsd.org/
If you find this article helpful, please share it with more people.
Follow “Algorithm Enthusiasts” to improve your programming skills.
