SoylentNews
SoylentNews is people
https://soylentnews.org/

Title    CPU Clocks and Clock Interrupts, and Their Effects on Schedulers
Date    Monday December 14 2015, @11:35PM
Author    CoolHand
Topic   
from the rock-out-with-your-clock-out dept.
https://soylentnews.org/article.pl?sid=15/12/14/1835242

Phoenix666 writes:

Instructions to sleep for a second almost never result in precisely one second’s sleep. Bob Schmidt walks us through the mechanics of why.

Suppose you are walking down the hallway of your office, and a Summer Intern (SI) intercepts you and asks, “If I put a line of code in my program that simply reads sleep(10) , how long will my program sleep? 1

You look at the harried SI and reply, “It depends,” and you continue on your way.

The SI rushes to catch up with you, and asks, “It depends on what?

And you answer, “That, too, depends,” as you continue walking.

At this point our young SI is frantic (and in immediate danger of going bald). “Stop talking in riddles, grey hair! I’m in real need of help here.

Your stroll has taken you to the entrance of the break room, so you grab your interlocutor, duck inside, grab two cups of your favourite caffeinated beverage, and sit down.

It depends,” you say, “on many things, so let’s start with first things first.

First things first

To understand what’s going on ‘under the hood’ when a sleep() is executed, it helps to know a little about how CPUs work, and that means knowing something about CPU clocks, interrupts, and schedulers. The former two are hardware concepts; the latter is a software concept.

It's a decent peek under the hood for folks who usually treat such things as blackbox.


Original Submission

Links

  1. "Phoenix666" - https://soylentnews.org/~Phoenix666/
  2. "Bob Schmidt walks us through the mechanics of why" - http://accu.org/index.php/journals/2185
  3. " 1 " - https://soylentnews.org/%23FN01
  4. "Original Submission" - https://soylentnews.org/submit.pl?op=viewsub&subid=11112

© Copyright 2023 - SoylentNews, All Rights Reserved

printed from SoylentNews, CPU Clocks and Clock Interrupts, and Their Effects on Schedulers on 2023-06-21 07:52:49