GNU General Public License v3.0

技术解读

以下内容由 GitRead 中文社区 编辑团队基于项目 README 与官方资料整理, 结合中文开发者的常见使用场景补充技术选型建议。具体以项目官方文档为准。

项目背景与痛点

“lowlevelprogramming-university” 项目意在成为低级编程技术的综合学习资源,涵盖了从底层架构到具体实现的方方面面。对于力求掌握底层技术(如底层内存管理、汇编语言等)的开发者而言,该项目提供了系统的学习材料与实践机会。

在这个项目中,作者力求提供详细的示例代码和研究指南,使之成为踏入底层编程世界的敲门砖。无论是想要了解如何编写高效汇编程序,还是想掌握深层次的内存管理技术,这个项目都能够提供必要的指导。

项目背后的核心痛点在于传统编程教育多聚焦于高级抽象及其应用,而真正深入理解操作系统底层和底层硬件之间的细微差距,通常需要海量的自学与研究。这恰恰是“lowlevelprogramming-university”项目企图填补的缺口:专注于底层技术理解与实践,形成落地的开发能力。

核心技术揭秘

项目核心在于构建一个全面的底层编程技术学习框架,涵盖的内容从数据结构的底层实现到操作系统内部架构。该项目的设计不仅体现在内容组织上,也体现在所选用的技术栈和实现细节上。为了确保其内容可读性与平台的广泛兼容性,项目采用广泛的内联代码示例,包括 C 语言、汇编以及多种计算平台下的演示项目。

以下是项目的核心架构:

graph TD A[用户需求定义] --> B[领域知识整合] C[C 语言环境] -.-> D[汇编语言] E[项目实例] --> F[学习材料] G[实现细节描述] -.-> H[代码示例] B --> C B --> F D --> F C --> E D --> E E --> F G --> F H --> F

此架构展示了知识整合与编码实现两方面的连接与互动。学习材料不仅包括了理论讨论,还辅以大量的代码实现示例,为用户提供直观且深入的理解路径。通过在这一连贯的结构下工作,项目得以全面覆盖从概念到具体实现的全过程。

功能亮点与差异

该项目的最大特色在于其全面性和实用性。不同于其他开源项目更多的是提供孤立的代码片段或不完整的概念解析,“lowlevelprogramming-university”力图通过一系列相互关联的学习资源,构建一个完整的知识体系。这不仅有助于快速定位学习目标,还使开发者能更高效地深研各种底层编程技术。

项目还提供了多种难度层次的学习路径,用户可以从初学者资料逐渐进阶到较为晦涩的专题研究。这种方式让不同水平的开发者可以找到合适的学习路径,进而解决了传统学习资料往往很难全方面适应学习需求的问题。

应用场景与落地建议

在实际生产环境中,理解底层技术的关键在于实战经验与理论知识的有机结合。建议开发者结合项目中的示例代码,逐步编写和调试涉及底层的不同类型项目,比如内存管理相关的应用或是适用于嵌入式硬件的核心库。

此项目适合对底层技术有强烈好奇心的工程师,无论是希望优化自身代码性能的系统程序员,还是某一特定领域的研究人员。在学习时,应特别注重代码调试过程,通过实际案例分析底层设计策略,并在自己的项目实践中复现这些策略。

综合评价

优点:

  • 全面、系统地覆盖了底层编程技术的关键领域和知识点
  • 代码示例丰富,便于理解抽象概念并辅助实际应用
  • 提供易于上手的学习路径,包含不同层次的难度设置

缺点:

  • 尽管编写具体实例丰富,但有时可能缺乏与实践环境的直接对接,需要读者自行为其代码示例创建运行环境
  • 部分复杂概念的讲解可能需要结合更广泛的参考资料才能获得全面理解,针对特定用户还是需要做进一步的研究与扩展

尽管存在一些局限,作为探索底层编程领域的开源项目,“lowlevelprogramming-university”无疑提供了宝贵资源。开发者和研究者不妨将之作为拓展知识广度与深度的重要渠道。

README

I’m getting so much spam that I’ve changed this repo to read-only for a while.

NOTICE1: Please do not copy the contents of this page to your blog. You can share this page but please share with the original link. That is how we compliment the authors of good documents and open source projects.

NOTICE2: Please notice that low-level programming is out of trend and currently there are not many companies hiring low-level developer. It is getting harder for me to find a job. If you haven’t started a professional career yet, I would like to recommend you consider other fields either carefully.

NOTICE3: If you want a quick start, go to “How to start?”.

Low-Level Programming University

What is it?

I’m inspired by google-interview-university. I’d like to share my experience and show a roadmap to becoming a low-level programmer because I have found that these skills are not as common as they once were. In addition, many students and beginners ask me how they could become low-level programmers and Linux kernel engineers.

This page cannot include every link/book/course. For example, this page introduces Arduino but there is not detailed information about Arduino and embedded systems. You should go further yourself. You have the keyword “Arduino” with which you can start. So your next step is probably googling Arduino, buying a kit, and doing something for yourself, not collecting links or free books. Please remember this page is just a roadmap for beginners.

Low-level programming is a part of computer science. Absolutely it would be much better to get education in computer science first.

What is the Low-Level?

I classify low-level programming as programming that is very close to the machine, using a lower level programming language like C or assembly. This is in contrast to higher-level programming, typical of user-space applications, using high level languages (e.g. Python, Java).

Yes, systems programming is a very close concept to low-level programming. This page includes the hardware design and firmware development that is not included in systems programming.

Finally, this page includes topics ranging from hardware components to the Linux kernel. That is a huge range of layers. A one page document can never cover the details of all the layers, so the aim of this document is to serve as a starting point for low-level programming.

Theory

There are two background theories to low-level programming:

  • Computer Architecture
  • Operating Systems

I think the best way to learn theory is by taking a course. Reading books is not bad but takes too much time and effort. You can find many good classes on online universities, for instance, Coursera.org and edx.org. Theory is theory. I don’t think you need to get an A+ in the class, just understand the big picture. You’ll get better and better with experience.

Let me introduce several books that I’ve read. They are commonly used as textbooks in universities. If there is no class with these books in your university, it’s worth spending some time reading them.

  • Computer Architecture
    • Computer Architecture, Fifth Edition: A Quantitative Approach
    • Computer Systems: A Programmer’s Perspective
    • Computer Organization and Design, Fourth Edition: The Hardware/Software Interface
  • Operating Systems
    • The Magic Garden Explained: The Internals of UNIX System V Release 4 an Open Systems Design
    • The Design of the UNIX Operating System
    • Operating Systems: Internals and Design Principles by William Stallings
  • Recommended Courses
  • General Programming Skill
  • Hardware Design
    • Build Your Own 8086 Microprocessor Kit
      • If you don’t build your HW board, you don’t understand what physical memory mapped device is.
      • Modern APs includes so many IPs. So you don’t have a chance to understand how CPU core and peripheral devices are connected.
      • When you build your own 8086 kit, you have a chance to locate each peripheral devices on the physical memory. And you can set how the main HW components (BUS, IRQ, Clock, Power and etc) works with your own eyes.
      • I built the 8086 kit in my University. It was one of the most valuable courses I’ve ever taken. Try to build your own HW kit. It would be better if the HW is older ans simpler because you should do more for yourself.
      • Google “8086 kit”. You would be able to find some web-sites you can buy a HW scheme, parts and manuals.

There is an infinite list of good books. I don’t want to say that you should read many books. Just read one book carefully. Whenever you learn a theory, implement simulation code of it. Implementing one thing is better than knowing one hundred theories.

Languages

Assembly

Choose one between x86 or ARM. No need to know both. It doesn’t matter to know assembly language. The essential thing is understanding the internals of a CPU and computer. So you don’t need to practice the assembly of the latest CPU. Select 8086 or Cortex-M.

C language

There is no shortcut. Just read the entire book and solve all the exercises.

If you want to be expert of C programming, visit https://leetcode.com/. Good luck!

Rust language

I am sure that the next language for the systems programming would be Rust. I will make a list what I did to learn Rust.

Linus Torvalds said “Unless something odd happens, it [Rust] will make it into 6.1.”

  • The Rust Programming Language
    • Great introduction, but lack of examples and exercises.
  • Rust by Example
    • While reading “The Rust Programming Language”, you can find examples and exercises here.
    • But there are not many exercises you can do something for yourself. Only some examples includes “do-this” exercises and they are very simple.
  • Programming Rust, 2nd
    • Deeper introduction, but still lack of examples and exercises.
  • Exercism
    • Good exercises to practice indivisual features of RUST.
    • I am not sure Mentors are working actively but it would be enough to compare your solution with others.
      • After submitting your solution, you can see other’s solutions with “Community solutions” tab (since Exercism V3).
      • Many easy level exercises are for functional feature such as map/filter/any and etc.
  • Easy rust
  • Let’s get rusty
    • There are many Youtubers uploading Rust course but I enjoyed this course most.
    • He has been uploading the latest news for Rust. It’s worth subscribing.
  • Rust for Linux
    • See the example sources and check how Rust got into the Linux kernel
  • (Work In Progress) Linux Device Drivers in Rust
    • Writing examples in the book “Linux device drivers” with the Rust language.

Applications

Hardware and Firmware

If you want to be an embedded systems engineer, it would be best to start from a simple hardware kit, rather than starting with the latest ARM chipset.

  • Arduino Start Kit
    • There are many series of Arduinos but “Arduino Start Kit” has the most simple processor(ATmega328P) and guide book
    • ATmega328P has an 8-bit core which is a good place to start digital circuit design and firmware development.
    • You don’t need to know how to draw schematics and layouts and assemble the chips.
    • But you do need to know how to read schematics and understand how the chips are connected.
    • Firmware developers should be able to read the schematics and figure out how to send data to the target device.
    • Follow the guide book!
  • 8086 manual
    • If you’re a beginner to x86 architecture, 8086 is also very good guide for processor architecture and x86 assembly
  • 80386 manual

At this point, you should be good to start the latest ARM or x86 processor.

For example, the Raspberry Pi board has a Cortex-A53 Processor that supports a 64-bit instruction set. This allows you to experience a modern processor architecture with rPi. Yes, you can buy it… but… what are you going to do with it? If you have no target project, you would be likely to throw the board into a drawer and forget it like other gadgets you may have bought before.

So, I recommend one project for you.

I’ve made a toy kernel that supports 64-bit long mode, paging and very simple context switching. Making a toy kernel is good way to understand modern computer architecture and hardware control.

In fact, you have already the latest processor and the latest hardware devices. Your laptop! Your desktop! You already have all that you need in order to start! You don’t need to buy anything. The qemu emulator can emulate the latest ARM processors and Intel processors. So everything you need is already on hand. There are many toy kernels and documents you can refer to. Just install qemu emulator and make a tiny kernel that just boots, turns on paging, and prints some messages.

Other toy kernels:

Linux kernel and device driver

You don’t need to make a complete operating system. Join the Linux community and participate in development.

Some resources for Linux kernel and device driver development from beginner to advanced.

References

Check when you need something

Other applications

Yes, you might not be interested in Linux or firmware. If so, you can find other applications:

  • Windows systems programming & device drivers
  • Security
  • Reverse engineering

I don’t have any knowledge about those applications. Please send me any information for beginners.

Kernels and drivers are not all of low-level programming. One more important application of low-level programming is the software-defined storage or distributed filesystem. Detailed descriptions of them is beyond the scope of this document but there is an excellent course where you can try a simple distributed filesystem.

Future of low-level programming

I do not know the future, but I keep my eye on Rust.

If I could have one week free and alone, I would learn Rust. That is because Rust is the latest language with which I can develop Linux device drivers.

IoT is new trend, so it’s worth to check what OSs are for IoT. ARM, Samsung and some companies has their own realtime OS but sadly many of them are closed source. But Linux Foundation also has a solution: Zephyr

Typical cloud servers have many layers; for instance, host OS, KVM driver, qemu process, guest OS and service application. A container has been developed to provide light virtualization. In the near future, a new concept of OS, a so-called library OS or Unikernel, would replace the typical stack of SW for virtualization.

Big data and cloud computing require bigger and bigger storage. Some disks directly attached to server machines cannot satisfy the required capacity, stability and performance. Therefore there has been research to make huge storage systems with many storage machines connected by a high speed network. It used to be focused on making one huge storage volume. But currently they are providing many volumes dedicated for many virtual machines.

How to start?

I received an email asking how to start. There are many information about books, courses and projects in this page. It is my mistake to forget to write how to start. Unfortunately, there is no King’s Road to King’s Landing. I will just write what I did in order. If you have already done something, please skip it. AGAIN, this is just an example that you could do in order, just in case if you do not know how to start or what to do.

  • Reading OS theory books: at least “The Design of the UNIX Operating System by Maurice J. Bach”
  • Learn assembly and C
  • Do something practical with C
    • C Project Based Tutorials?: Find one or two interesting projects and make your own project.
    • leetcode.com: If you cannot find an interesting project, it would be also good to focus on data structure and algorithm.
  • Do a hardware project
    • Raspberrypi or Arduino does not matter. You need experience to control a hardware directly with only C. ONLY C!
    • I recommend to buy a ATmega128 kit and make a firmware to turn on/off LEDs, detect switch input and display message on the text LCD. Motor control program is also a very good project: for instance, the line tracer.
    • DO NOT use any library. You should make everything on your own, except program downloader.
  • Basic of the Linux kernel
  • Go to the professional field

Translations

Please send me the pull request if you’d like to translate this page. I’ll list it here.

Who am I?

I’m inspired by google-interview-university. I’d like to share my experience and show a roadmap to becoming a low-level programmer because I have found that these skills are not as common as they once were. In addition, many students and beginners ask me how they could become low-level programmers and Linux kernel engineers.

FYI, I have over 10 years of experience as a low-level programmer:

  • 80x86 Assembly programming
  • Hardware device with ATmel chip and firmware
  • C language system programming for Unix
  • Device driver in Linux
  • Linux kernel: page allocation
  • Linux kernel: block device driver and md module

评论

暂无评论