A “flyweight” C language coroutine library

Coroutine, as its name implies, is “co-operative routines”. Unlike threads with operating system concepts, coroutines are programming techniques that can achieve logical multitasking in user space by using the syntax and semantics of programming languages. In fact, the concept of coroutine is earlier than thread. According to Knuth, “Subroutine is a special case of coroutine”. […]

The principles of Go language coroutines and the relationship between coroutines and threads! (Very important)

The coroutine of Go language is something unique compared to other languages, and it is also very important. Many times we want to understand its underlying principles, but cannot find suitable knowledge points on the Internet. For example, if you ask GPT, he will answer you like this : Coroutines and threads are both technologies […]

How to implement Python coroutines

Coroutines are powerful concurrent programming tools in Python, allowing developers to write asynchronous code to improve program performance and efficiency. In this article, we will take a deep dive into how coroutines are implemented in Python, including generators, the asyncio library, and the async/await keywords. We will also provide detailed sample code to help you […]

[Server] fiber coroutine module

fiber coroutine module The following is a review of what I learned from the sylar server; Reference materials Sylar’s fiber coroutine module implements asymmetric coroutine based on ucontext_t Functions have only two behaviors: calling and returning. Once the function returns, the state it holds on the stack will be destroyed. Coroutines have two more actions […]

Different programming methods – coroutines (design principles and assembly implementation)

We mainly understand the principles of coroutines through the following 9 aspects: Table of Contents 1. Why use coroutines? 1.3. Applicable scenarios of coroutines 2. Primitive operations of coroutines 3. Switching of coroutines 3.1. Assembly implementation 4. The running process of the coroutine 5. The structure definition of the coroutine (we can actually design it […]

Core understanding of Kotlin coroutines

1. What is a coroutine? 1.1 Understanding of basic concepts We know that the implementation of threads in the JVM is determined by the operating system it runs on. The JVM only encapsulates the API in the upper layer, including common threaded startup methods and state management. For example: Java abstracts 6 types of threads. […]

Coroutines and Coroutine2 of the C++ Boost library

Tip: After the article is written, the table of contents can be automatically generated. For how to generate it, please refer to the help document on the right. Coroutine and C++ Boost library Coroutine2 Summary Why not boost.coroutine? Threads and coroutines Why not introduce coroutines in the C++20 standard C++ coroutine and golang’s goroutine 2. […]

Coroutine suggestions in Android

This chapter describes the positive impact of using coroutines in application development practices to make applications more scalable and testable. Note: These practices are broadly applicable to most applications. However, the examples are only parameters and should be adjusted to meet specific requirements when responding to overall needs. Inject scheduler Do not hardcode Dispatchers when […]