Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8765389
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T16:16:06+00:00 2026-06-13T16:16:06+00:00

So, are these two the same? Using delay CPU usage is crazy in task

  • 0

So, are these two the same?
Using delay CPU usage is crazy in task manager.. is this the same case as the System Idle Process?

#include <iostream>
#include <time.h>
//#include <windows.h>

int delay(long int time)
{
    clock_t beginning = clock();
    while(clock() - beginning < time) {}
    return 0;
}

int main()
{
    clock_t beginning = clock();

    begin:

    std::cout << "delay this by 1000ms\n";

    //Sleep(1000);
    delay(1000);

    goto begin; //i know, i know

    return 0;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T16:16:07+00:00Added an answer on June 13, 2026 at 4:16 pm

    This is called “busy waiting” and is most definitely not the same as calling Sleep(). Sleeping will deschedule your process so that other processes get a chance to run; busy waiting will just keep the CPU busy doing nothing useful, and slowing down the entire system.

    The “System Idle Process” is doing the same thing, but it only gets scheduled when no other process has work to do. It is probably also more power-efficient than the loop you wrote. Wikipedia has interesting details on the how and why.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Problem with Unicode in asp These two address are created using the same function
Consider there are two wi-fk networks A & B using the same channel and
These two methods appear to behave the same to me public IEnumerable<string> GetNothing() {
These two querys gives me the exact same result: select * from topics where
So these two methods have the same signature but different constraints public static void
Do these two statements pass the same type of argument (a Hash) to the
Consider these two classes mapped to the same table. One is readonly via mutable=false.
I want these two print functions to do the same thing: unsigned int Arraye[]
It seems that these two operators are pretty much the same - is there
I'm having the same problem issued in these two links: one , two .

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.