8 ms·
I would like to know something here. Since there is only 1 stack for a pThread and the stack state is swapped on a context switch for a co-routine within a pThr
by vvnraman 15y ago
I would like to know something here. Since there is only 1 stack for a pThread and the stack state is swapped on a context switch for a co-routine within a pThread, wouldn't this be quite expensive if there are a lot of variables on stack for that co-routine? Or is the swapping being carried out in a different manner, eg. caching, pre-allocated stacks, etc..
- halayli 15y agoIf you don't have large variables allocated on the stack, the copy is quite fast. This is easily avoidable by allocating on the heap.