The reason why callbacks are needed is to make the use of library functions more flexible. Programming is divided into two categories: system programming and application programming. System programming is simply the writing of libraries, while application programming is the use of various libraries to write programs with certain functions, that is, applications. System programmers will leave some interfaces to the libraries they write, i.e., APIs (application programming interface), to be used by application programmers. So in the diagram of the abstraction layer, the library is located under the application. When the program is running, the application program will normally call the functions pre-prepared in the library through the API from time to time. However, some library functions require the application to pass a function to it first, so that it can call it at the right time to accomplish its goal. The function that is passed in and then called is called a callback function.