CST 334 - Week 2 - Scheduling a what now?
We covered a whole lot this week! Though I want to focus in specifically on CPU scheduling, which was probably the most mind-boggling to me. We obviously covered the different scheduling policies and what they mean:
- First in, First Out: Run the jobs in the order they are received. Hopefully how a drive through operates. (Except for when they make you pull over OMG)
- Shortest Job First: Run the shortest job first, simple enough right?
- Shortest Time to Completion: The scheduler is comparing the remaining run time to the run time of the current job.
- Round Robin: Run each job with a given time slice and move on, cycling through them.
There's obviously a ton more in depth, and a ton to grep here -- but what was really interesting were all these different strategies.
As someone who spent most of his time writing Javascript, FIFO feels familiar to me. Javascript is a single-threaded language -- which means the entire Javascript event loop runs very similar to a FIFO in concept. This is why "blocking" operations are critical issues and things that could block the main thread are super important to be aware of -- because of the single threaded nature. That is where conceptually asynchronous functions come in, to help make web apps responsive despite the nature of the event loop.
Still, I think about how web developers often use things like setTimeOut, or requestIdleCallback to "yield" a thread. In that sense those functions kind of simulate a more Round Robin style scheduling where they are letting processes run and then doing a function call based on the time out set.
Anyhow -- I find it fascinating to apply some of these lower level concepts to the abstracted languages and engines I am used to dealing with.
Comments
Post a Comment