且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

DateTime.Now导致IO阻塞?

更新时间:2023-01-28 09:26:02

没有人迄今已回答其中当前时间确实来自何处。我不是最新的最新的PC架构。但在几年前,所述实时时钟的是外侧的芯片的一部分CPU(南桥)。因此,要获得的时候,你不得不做一些I / O操作与芯片。 (这不是磁盘访问,但仍然是一个I / O操作。)

Nobody so far has answered where the current time is really coming from. I'm not up to date with the latest PC architecture. But a few years ago, the real-time clock was part of a chip outside of the CPU (south bridge). So to get the time, you had to do some I/O operations with that chip. (It's not disk access but still an I/O operation.)

此外,由于当前进程必须等待从时钟的答案,它的阻塞I / O。

And since the current process has to wait for the answer from the clock, it's blocking I/O.

这样的人在会议上是正确的。

So that person on the conference was right.