Question about coroutines

I just stumbled on this link
Which basically says that fibers where hot in 1996 and that all operating systems experienced with them for years and then finally recommanded not to use them because they sucked.

I would like to know if Kotlin coroutine (not fibers ? stackless coroutine ?) are fine and aren’t concerned by what this article says.

I don’t have the time or the expertise to understand everything the article says and how it applies/doesn’t apply to the kotlin coroutines (and structured coroutine calls ?).

Could someone knowledgeable enlighten us ?

Best regards,

@Lakedaemon Hi Olivier, I had a quick look at that paper. It explains the issue with operating system fibers (memory usage is high (because each fiber needs its own stack), or stack space is severely constrained). Kotlin coroutines are what the paper calls “stackless” so don’t suffer from these issues. The “drawback” is that the suspend keyword is needed to make a function coroutine aware (where the fibers would work without any code modification). Making all code coroutine aware would be expensive and should be done explicitly (rather than automatically) - it also would have Java compatibility issues.

1 Like

I see. Coroutines might be a bad idea for operating systems but it might still be a very good one for kotlin apps. :slight_smile:

@Lakedaemon you can deep into Kotlin coroutine, see