编程语言与软件工程2017cs.cmu.edu
实现 Malloc:学生与系统编程
Implementing Malloc: Students and Systems Programming
进阶 · 约 35 分钟读完前置知识:C 语言、内存分配基础、操作系统基础
导读
这篇论文讨论在系统编程课程中让学生亲手实现 malloc 内存分配器的教学实验,围绕 CMU 的 malloc lab 总结课程设计与学生体验。核心做法是让学生处理空闲块管理、合并与分配效率等真实系统编程问题,并通过自动评分/性能竞争强化实践训练。
HN 关注点:是因为 malloc lab 是许多 CS 学生难忘的“硬核”作业,讨论很快转向各校课程难度、排行榜竞争和教学效果。
HN 评论精选
这几条评论里:补充 1 亲历 3
亲历亲历者回忆 malloc lab 有趣但极其耗时,并为提分做过取巧优化。
在 CMU 做这个 lab 是我比较难忘的经历之一。非常有趣,但因为我把作业拖到最后、三天几乎没睡,就没那么有趣了。我为了迎合自动评分器提分做了一些糟糕的临场 hack,比如伪冒泡排序:每次合并两个相邻空闲块时,我会比较链表中的相邻节点,如果无序就交换。对某些测试向量,这略微提高了分配效率——刚好够把我成绩提高几分。 :)
mafuyu查看英文原文
Doing this lab was one of my more memorable experiences at CMU. It was tons of fun, but barely getting any sleep for 3 days because I put the assignment off was less fun. I put in some horrible last minute hacks to optimize for the autograder and raise my grade, like doing a pseudo-bubble sort. Every time I coalesced two adjacent free blocks, I would compare the adjacent nodes in the linked list and swap them if they weren't sorted. That raised my allocation efficiency a tiny bit for certain test vectors- just high enough to bump my grade up a couple points. :)
补充对比 Purdue 版本更简单、无性能要求,并希望看到 CMU 新版材料。
有人能贴一下 CMU 重新设计的 malloc lab 的 PDF 或类似材料吗?Purdue 的 malloc lab 简单得多:你会拿到算法、应使用的数据结构和函数签名。它必须线程安全,但没有性能要求。因此它大概是一个 10-20 小时的实验。
kevindong查看英文原文
Can someone post a PDF (or something similar) of CMU's redesigned malloc lab? Purdue's malloc lab [0] was much simpler: you get the algorithm, the data structures you're supposed to use, and the method signatures. It has to be thread safe. But there were no performance requirements. Consequently, it's something like a 10-20 hour lab. [0]: https://www.cs.purdue.edu/homes/grr/cs252/lab1-malloc-new-header/index.html
亲历GT 将其设为必修期末作业,并给予很高评价。
Georgia Tech 每个 CS 学生都要做这个,作为计算机组成课程的最后作业。这是我本科迄今最难忘、最有教育意义的经历之一。
bitadder查看英文原文
Every CS student at Georgia Tech does this as their final Computer Organization assignment. One of the most memorable and instructive experiences of my undergrad, thus far.
亲历排行榜竞争带来额外动力,是游戏化教学的成功例子。
这是我在 CMU 做过的最好的作业之一。花 20 小时写代码让 malloc 通过测试并不是最有趣的部分;额外花 40 小时在排行榜上打败别人才是 :) 游戏化的最佳体现。Bomb lab 也是我的另一个最爱,还有哪里能让你阅读并理解汇编语言编程呢。
amirathi查看英文原文
This is one of the best assignments I worked on at CMU. Putting in 20 hours of coding to actually get the passing malloc was not the most fun part. It was spending additional 40 hours to beat others at the leaderboard :) Gamification at it's best. Bomb lab was my other favourite, where else do you get to read and make sense of assembly language programming.
历次讨论
- 2017Hacker News 讨论帖283 分 · 56 评
同领域还值得读
Google 的软件工程(2017)
Software Engineering at Google (2017)
介绍了 Google 的软件工程实践,包括其单一代码库(monorepo)、几乎全部开发在主干进行而非分支、代码审查、构建系统 Blaze、协议缓冲区等工具与流程,并讨论了频繁重…
编程语言与软件工程2017 · 1,127 分 · 465 评 · 引用 15入门 · 约 45 分钟编辑精选Peter Naur:编程作为理论构建 (1985)
Peter Naur – Programming as Theory Building (1985)
Peter Naur 1985 年的经典论文《Programming as Theory Building》提出:编程的本质不是写代码或文档,而是在程序员头脑中构建对程序及其运行…
编程语言与软件工程2016 · 629 分 · 74 评入门 · 约 45 分钟编辑精选SciPy 1.0:Python 科学计算的基础算法
SciPy 1.0: fundamental algorithms for scientific computing in Python
这篇发表于 Nature Methods 的论文介绍了 SciPy 1.0——Python 科学计算生态的基石库,涵盖其核心算法模块(优化、积分、插值、线性代数等)、软件架构与社…
编程语言与软件工程2020 · 387 分 · 98 评入门 · 约 45 分钟编辑精选Lisp 的历史(1979)
History of Lisp (1979)
这是 Lisp 发明者 John McCarthy 于 1979 年为 HOPL(编程语言史)会议撰写的回顾文章,讲述 Lisp 的起源、设计动机与早期演进,文中也涉及 if 表…
编程语言与软件工程2018 · 352 分 · 44 评入门 · 约 45 分钟编辑精选使用 NumPy 进行数组编程
Array Programming with NumPy
这篇 Nature 文章介绍 NumPy 的数组编程模型及其在科学计算中的核心作用:以 ndarray 为中心,通过向量化操作让 Python 高效处理多维数组。
编程语言与软件工程2020 · 318 分 · 134 评入门 · 约 40 分钟编辑精选