libco source code analysis (0) overview and summary

introduction

Libco is a C/C++ coroutine library used on a large scale in the WeChat backend. It was open sourced in 2013. It is said that it is still running in the WeChat backend in 2013.

Insert picture description here

text

The learning process of libco is actually the process of answering a question in November last year. I remember that I was full of doubts about it after the senior raised this thing, but I was shocked by its function. After completing the learning of libco After that, I solved a problem that had troubled me for more than half a year, which is also gratifying.

My advice to friends who later learned libco is to review the knowledge of linking in the operating system first, and then look at assembly language programming. After both are OK, you can roll up your sleeves and work, don't be like me Halfway through learning, I ran to supplement other knowledge, which was too slow.

The entire code part is not difficult, but there is almost no documentation when I learn it, I rely on my own theoretical knowledge, and look at the source code step by step after I check it. This is also the original intention for me to write this series of articles, that is, to reduce the difficulty of learning for latecomers. Of course, the author's level is limited. Please ask Haihan for mistakes. After you find the mistakes, you can give your opinion in the comments.

At least when I wrote this series of articles, there was no blog on the Internet with a complete source code analysis of libco (at least I did not find it), so I still encountered some difficulties in the process of writing, so it seems that this series of articles should be regarded as Learn more detailed information about libco. If it is helpful to you, please don't be stingy with the likes and attention in your hands!
Insert picture description here

The series of articles is divided into nine articles, basically sorting out the whole process of libco, as follows:

  1. Libco source code analysis (1) Coroutine operation and basic structure
  2. Libco source code analysis (2) Create a coroutine, co_create
  3. libco source code analysis (3) coroutine execution, co_resume
  4. Libco source code analysis (4) Coroutine switch, coctx_make and coctx_swap
  5. Libco source code analysis (5) poll
  6. libco source code analysis (6) co_eventloop
  7. Libco source code analysis (7) read, write and condition variables
  8. Libco source code analysis (8) Exploration of hook mechanism
  9. libco source code analysis (9) closure implementation

Guess you like

Origin blog.csdn.net/weixin_43705457/article/details/106908145