我以前一直是做一些面向过程化编程的语言开发,虽然能在各个领域工作干活,但到目前为止我认为我还是一个门外汉,为了做业务而做业务,很少考虑底层是如何实现的。因为我看过一些真正商业项目的代码。一个大型商业项目,从底层最基础的线程、内存、Socket 等等管理都是自己手敲的代码。
我很想知道,关于操作系统内存管理、线程管理、异常处理、IOCP、epoll 等等这些知识,作为最初写这些代码的作者他们是从哪里了解到的这些知识的?我要走一个什么样的学习路线,才能驾驭这些东西?
当然我并不是要重复造轮子,但我一定要知道这个轮子的内部结构是什么样子的,如果轮子需要改造或者优化适应不同场景,我必须是可以搞定的。那么如果是这样,我要有一个怎样的知识体系才行?
怪我咯2017-04-17 13:41:49
These things (operating system memory management, thread management, exception handling, IOCP, epoll, etc.) are covered by Chen Shuo in his muduo network library. For specific learning routes, you can read his "Linux Multi-threaded server-side programming".
If you really want to understand the implementation of these things, you should actually look at the implementation of the operating system. Generally, you need to look at the source code of Linux or read books like Linux kernel source code interpretation, as well as Minix or BSD/Mac. If you are interested, you can also refer to the source code. However, the operating system kernels mentioned earlier are all written in C rather than C++.
In the final analysis, many things actually rely on hardware implementation. To understand these, you need to read books on composition principles and architecture. However, generally speaking, for an application-level programmer, reading CSAPP once is enough.