문제

Is there a way to implement system like OS that allocates time for each process\thread with fibers? I mean like when I run a process and do an infinite loop inside it, the OS can still function normal on one core. (It switch context automatically without the process's permission or order)

I don't have internal functions that the fibers use that I can check the time and switch-context.

도움이 되었습니까?

해결책

Well, sure there is, the OS does it. Although doing it yourself in your own process without using the OS services is a bit hard.

There was an old book, called Born to Code in C by Herbert Schildt, that had a rudimentary multi-threading mechanism implemented in C and running in the same process.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top