计算机是否可以在没有内置时钟的情况下报时?

发布于 2024-08-27 04:55:19 字数 126 浏览 8 评论 0原文

计算机通过主板上的内置时钟正常计时。但出于好奇,计算机能否确定某个时间间隔何时过去了?

我认为计算机不能只执行指令。当然,您可以依靠计算机了解自己的处理速度,但这将是一种极其粗暴的黑客行为,会占用太多时钟周期并且容易出错。

Computers keep time normally with a built in clock on the motherboard. But out of curiosity, can a computer determine when a certain interval of time has passed?

I would think not as a computer can only execute instructions. Of course, you could rely on the computer knowing its own processing speed, but that would be an extremely crude hack that would take up way too many clock cycles and be error prone.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

把时间冻结 2024-09-03 04:55:19

不是没有它不断地运行来跟踪它,它不断地从互联网上拉出时间,或者没有一个硬件从不断广播的信号中获取时间。

Not without it constantly running to keep track of it, it pulling the time off of the internet constantly, or a piece of hardware to get the time from the constantly broadcast signal.

左秋 2024-09-03 04:55:19

在某些情况下,这是可能的。一些微控制器和较旧的处理器在定义的时间段内执行指令,因此通过跟踪执行的指令数量,可以跟踪时间段。对于某些情况(例如振荡播放声波),这很有效,而且很有用,但总的来说,你是对的,它并不是特别有用。

In certain cases, this is possible. Some microcontrollers and older processors execute their instructions in a defined time period, so by tracking the number of instructions executed, one can keep track of periods of time. This works well, and is useful, for certain cases (such as oscillating to play a sound wave), but in general, you're right, it's not particularly useful.

浮生未歇 2024-09-03 04:55:19

在过去,有一个固定的定时器中断。在美国通常每 60 秒一次。

旧操作系统只是简单地计算这些中断——有效地使其成为一个时钟。

而且,除了对它们进行计数之外,它还使用它来重新安排任务,从而防止长时间运行的任务独占处理器。

这个方案确实意味着你每次打开电源时都必须设置时间。

但在当时,关闭计算机电源(并重新启动)是一项只有专家才能完成的艰巨任务。

我记得有几天机器无法“IPL”(初始程序加载)几个小时,因为操作系统、补丁和硬件中出现了问题。

In the olden days there was a fixed timer interrupt. Often every 60th of a second in the US.

Old OS's simply counted these interrupts -- effectively making it a clock.

And, in addition to counting them, it also used this to reschedule tasks, thereby preventing a long-running task from monopolizing the procesor.

This scheme did mean that you had to set the time every time you turned the power on.

But in those days, powering down a computer (and getting it to reboot) was an epic task performed only by specialists.

I recall days when the machine wouldn't "IPL" (Initial Program Load) for hours because something was not right in the OS and the patches and the hardware.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文