HackerURLs

一次又一次被重新发现的经典。

同一个链接,相隔一年以上,一次又一次被人重新发现、再次冲上 Hacker News 首页。能经受住这种时间检验的,大多是值得一读再读的文章。每篇附中文标题,讨论最热的那些再加上中文导读和高赞评论翻译。

从名人堂开始
  • 4,700+篇经过时间检验的经典

Hall of fame

名人堂

在经典库里看全部精选

上首页次数最多、而且有中文导读的 30 篇。时间轴上每个黑点是一次上首页,空心点是一次没冲上去的投稿。

  1. 正在载入经典…

Archive

经典库

按第一次上首页的年份分布,点柱子筛选。

排序

    About

    这些经典是怎么挑出来的

    1. 01

      合并同一个链接

      读取 Hacker News 自 2006 年以来的全部链接投稿,把 http/https、www、跟踪参数等写法不同的同一篇文章合并成一条。

    2. 02

      只留经得起时间的

      同一链接至少两次拿到 50 分以上(约等于上首页),而且两次相隔一年以上;再由 AI 剔除状态页、产品首页和新闻事件。

    3. 03

      写导读、译评论

      上首页次数最多的 2,000 篇配上中文导读、"为什么经久不衰",并精选翻译 HN 高赞评论。导读由 AI 生成,可能有误。

    系统与基础设施github.com

    Asmttpd:用 amd64 汇编编写的 Linux Web 服务器

    Asmttpd: Web server for Linux written in amd64 assembly (2017)

    3次上首页
    4年跨度
    447累计得分
    256条评论

    2014 — 2018,它一次次回到首页

    黑点是上首页(≥ 50 分)的那次投稿,空心点是没冲上去的投稿,点越大分数越高。

    导读

    Asmttpd 是一个用 amd64 汇编编写的 Linux Web 服务器,支持静态文件服务和基本 HTTP 功能,整个可执行文件不到 6KB。项目多次登上 Hacker News 首页,主要作为学习汇编和系统编程的有趣案例。

    为什么经久不衰:它展示了用纯汇编实现真实可用软件的可能性,是理解系统底层、syscall 和 HTTP 协议的绝佳学习材料,多年后仍被反复讨论。

    关键词 汇编Web服务器Linux系统编程

    HN 评论精选

    作为练习很有趣,但代码本质是朴素的字符串操作,且 HTTP 实现不完整,没有实用价值。

    这基本上就是一个用 C 写的 Linux Web 服务器,只不过完全没有标准库优化。虽然是汇编,但本质上是对一组字符串库函数的薄封装,而这些函数只是 libc 中已有函数的朴素版本。大部分代码就是 strcpy/strcat/strchr/strstr;它没有变成一个巨大的栈溢出漏洞的唯一原因是它实际上没有实现大部分 HTTP 功能(比如:没有读取 Content-length,一切都基于一个按最大请求大小分配的静态缓冲区)。如果写汇编时还要反复扫描字符串末尾来拼接字符串,那写汇编的意义何在?我不否认这个项目作为练习的价值,它很酷!但它不是你会想真正使用的东西,也不是写出好 Web 服务器的有效路径。

    tptacek查看英文原文

    Isn't this basically a web server for Linux written in C, except with absolutely no standard library optimizations? Yes, it's assembly, but it's basically a thin script over a set of string library functions which are themselves just naive versions of what's already in libc. Most of this is just strcpy/strcat/strchr/strstr; the only reason it's not one giant stack overflow is that it doesn't actually implement most of HTTP (for instance: nothing reads Content-length, and everything works off a static buffer that is sized to be as large as the maximum request it will read). What's the point of writing assembly if you're going to repeatedly scan to the end of strings as you try to build them? I'm not taking away anything from the project as an exercise. It's neat! But like: it's not something you'd ever want to use, or a productive path to go down to make a good webserver.

    推荐另一个更成熟的汇编 Web 服务器 rwasa,并吐槽 Debian 以“没人写汇编”为由拒绝打包。

    没人提到 rwasa,我来提一下(一个用汇编写的 HTTPS Web 服务器):https://2ton.com.au/rwasa/。我曾向 Debian(在 IRC 频道上)提议为 rwasa 打包,但被告知“2017 年没人写汇编了”。不知道 2018 年这是否还成立。

    mabynogy查看英文原文

    Nobody mentioned rwasa so I do it (an HTTPs webserver written in asm): https://2ton.com.au/rwasa/ I proposed to debian (on an IRC channel for that) to make a package for rwasa but I've been told that "nobody does asm in 2017". I wonder if it's still true in 2018.

    读汇编程序很有乐趣,但遗憾作者沿用了 C 风格的零结尾字符串,没有发挥汇编自由设计的优势。

    距离我上次完整读一个 x86 汇编程序已经快 20 年了,所以看这个很有趣。让我有些失望(当然很不讲道理)的是,代码使用的是普通的以零结尾的 C 字符串,而不是更奇特的东西。汇编的乐趣之一就是你可以随手重新发明基本的语言特性——调用约定、数据布局、字符串,一切。

    pavlov查看英文原文

    It's been closer to 20 years since I last read a complete program in x86 assembly, so this is quite fun to look at. I'm somehow disappointed (quite unreasonably, of course) that the code uses plain old zero-terminated C strings instead of something more exotic. One of the fun things about assembly is that you get to reinvent basic language features on the fly -- calling conventions, data layout, strings, everything.

    作者分享自己类似的汇编 Web 服务器项目,对比之下认为 asmttpd 功能更全且体积依然很小。

    我几年前写过 httpdito,一个用 386 汇编写的 Linux Web 服务器,我很高兴把可执行文件做到了 2000 字节以内。前几天我还用它测试了一个 SPA,虽然它内置的 MIME 类型列表对某些场景来说有所欠缺。但它没有默认文档、不同类型的错误响应、TCP_CORK、sendfile() 使用、content-range 处理,甚至没有请求日志。所以 asmttpd 比 httpdito 功能丰富得多,而且仍然不到 6K。

    kragen查看英文原文

    I wrote httpdito, a web server for Linux in 386 assembly, a couple of years ago (mostly outdated discussion is at https://news.ycombinator.com/item?id=6908064; a README is at http://canonical.org/~kragen/sw/dev3/httpdito-readme) and I was happy to get the executable under 2000 bytes. I actually used it the other day to test a SPA, although for some things its built-in set of MIME-types leaves something to be desired. But it doesn't have default documents, different kinds of error responses, TCP_CORK, sendfile() usage, content-range handling, or even request logging. So asmttpd is way more full-featured than httpdito, and it's still under 6K. (...httpdito possibly doesn't have any bugs, either, though ☺)

    历次讨论

    同类还值得读

    1. TTY 揭秘(2008)

      The TTY demystified (2008)

      经典文章深入剖析了 Unix/Linux 中 TTY 子系统的工作原理,包括线路规程、终端驱动、信号与控制字符等机制。

      系统与基础设施上首页 11 次 · 2009–2025linusakesson.net编辑精选
    2. 为什么 GNU grep 这么快

      Why GNU grep is Fast

      FreeBSD 邮件列表上一篇广为流传的帖子,解释 GNU grep 为什么快:核心在于 Boyer-Moore 字符串搜索算法配合精心优化的内部循环和 I/O,让程序在搜索时“…

      系统与基础设施上首页 9 次 · 2010–2022lists.freebsd.org
    3. Xplain:为普通人讲解 X11

      Xplain – Explaining X11 for the rest of us

      《Xplain》是作者(HN 用户 Jasper_)写的一系列 X11 长文,用他在浏览器中重建的 X11 绘图模型做交互演示,讲解 X11 的绘图模型与窗口系统设计。

      系统与基础设施上首页 6 次 · 2013–2020magcius.github.io编辑精选
    4. 旋风教程:为 Linux 创建极小 ELF 可执行文件(1999)

      A Whirlwind Tutorial on Creating Really Teensy ELF Executables for Linux (1999)

      breadbox 写于 1999 年的经典教程,主题是如何为 Linux 手工构造并裁剪出体积极小的 ELF 可执行文件。

      系统与基础设施上首页 6 次 · 2007–2025muppetlabs.com
    5. PostgreSQL 内部原理

      The internals of PostgreSQL

      《The Internals of PostgreSQL》是一本免费在线书籍,系统讲解 PostgreSQL 的内部实现,包括查询处理、并发控制、WAL、缓冲区管理等核心机制。

      系统与基础设施上首页 5 次 · 2017–2025interdb.jp编辑精选

    打赏支持

    打赏二维码

    觉得有用,请作者喝杯咖啡。

    WeChat

    关注向阳乔木

    微信公众号「向阳乔木推荐看」

    微信公众号「向阳乔木推荐看」二维码

    微信扫一扫;在微信里打开本页时,长按二维码识别。