Basically, every Thread has its own stack. According to the documentation, 64k is the least amount of stack space allowed per thread in the JVM while a simple coroutine in Kotlin occupies only a few dozen bytes of heap memory.
Try to run this example and see It on your own. Then, change it to "normal" Threads and see how your app crash ahah
Every thread has a stack, that's the definition of a thread (well, that plus registers, counters and a couple other things). What makes this lightweight?
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I never quite understood lightweight threads. What makes it light compared to a regular thread?
Basically, every Thread has its own stack. According to the documentation, 64k is the least amount of stack space allowed per thread in the JVM while a simple coroutine in Kotlin occupies only a few dozen bytes of heap memory.
Try to run this example and see It on your own. Then, change it to "normal" Threads and see how your app crash ahah
Every thread has a stack, that's the definition of a thread (well, that plus registers, counters and a couple other things). What makes this lightweight?