OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 7:18 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 16 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: OS with single process and global event loop
PostPosted: Fri Jan 08, 2021 1:30 pm 
Offline
Member
Member
User avatar

Joined: Mon Jun 05, 2006 11:00 pm
Posts: 2293
Location: USA (and Australia)
If all you care about is throughput, then a global event loop would be pretty efficient. But, even languages such as Javascript eventually introduced threads ("Web Workers") for those long CPU heavy processes. You could do something similar, have your main event loop (which can support coroutines - yielding a coroutine throws it on the end of the event queue), and if you wanted to do something heavy such as video decoding, you could explicitly spawn a thread so this wouldn't hold up procesing.

You could even do something where you reset the system timer at the start of calling an event, and if uses up an entire time slice (say 100ms), you promote the event into a thread. But, there are caveats with this as you'd have to assume all code could potentially be executed in parallel.

_________________
My OS is Perception.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 16 posts ]  Go to page Previous  1, 2

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 30 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group