Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: How does a computer “wait” time?  (Read 57577 times)

0 Members and 1 Guest are viewing this topic.

UglyPepper

    Topic Starter


    Newbie

    Thanked: 1
    • Experience: Familiar
    • OS: Windows 10
    How does a computer “wait” time?
    « on: December 01, 2020, 04:09:27 AM »
    Me and a friend were discussing how programming languages can perform asynchronous tasks, like waiting 15 seconds before performing another task, and we started a debate.

    I know that computers have an internal clock that uses the CMOS battery that can keep track of time, but how does it know it has been 15 seconds since right now and since when I told it to wait 15 seconds without looping infinitely and performing conditional operations, or does it do that?

    Lisa_maree



      Mentor
    • My first real computer
    • Thanked: 161
      • Yes
    • Experience: Expert
    • OS: Windows 10
    Re: How does a computer “wait” time?
    « Reply #1 on: December 01, 2020, 03:35:15 PM »
    Me and a friend were discussing how programming languages can perform asynchronous tasks, like waiting 15 seconds before performing another task, and we started a debate.

    I know that computers have an internal clock that uses the CMOS battery that can keep track of time, but how does it know it has been 15 seconds since right now and since when I told it to wait 15 seconds without looping infinitely and performing conditional operations, or does it do that?

    The CMOS data is used only when the computer starts to get the current date and time after which the OS updates the date and time. If software needs an interval timed it uses timer interrupts.

    Here is a better explanation than I can do   https://www.visualmicro.com/page/Timer-Interrupts-Explained.aspx
    You have not lived today until you have done something for someone who can never repay you.”
    ― John Bunyan

    UglyPepper

      Topic Starter


      Newbie

      Thanked: 1
      • Experience: Familiar
      • OS: Windows 10
      Re: How does a computer “wait” time?
      « Reply #2 on: December 02, 2020, 03:28:56 AM »
      The CMOS data is used only when the computer starts to get the current date and time after which the OS updates the date and time. If software needs an interval timed it uses timer interrupts.

      Here is a better explanation than I can do   https://www.visualmicro.com/page/Timer-Interrupts-Explained.aspx/MyGroundBiz

      I got sufficient information from your soul of heart.Thank you so much