Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/42.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
System.currentTimeMillis()是如何获取时间的_Time_Jvm_System Calls - Fatal编程技术网

System.currentTimeMillis()是如何获取时间的

System.currentTimeMillis()是如何获取时间的,time,jvm,system-calls,Time,Jvm,System Calls,是否实现了方法System.currentTimeMillis()对底层操作系统进行系统调用以接收当前时间 我这样问是因为据我所知,该方法运行得非常快,只需要6个CPU时钟,但这没有意义,因为系统调用速度很慢 我在这里遗漏了什么?系统。currentTimeMillis()通常不需要切换到内核模式。操作系统提供了一种机制,通过将相应的内核页面直接映射到应用程序地址空间,允许从用户模式读取当前时间 例如,Linux上System.currentTimeMillis()的Oracle JDK和Ope

是否实现了方法
System.currentTimeMillis()
对底层操作系统进行系统调用以接收当前时间

我这样问是因为据我所知,该方法运行得非常快,只需要6个CPU时钟,但这没有意义,因为系统调用速度很慢


我在这里遗漏了什么?

系统。currentTimeMillis()通常不需要切换到内核模式。操作系统提供了一种机制,通过将相应的内核页面直接映射到应用程序地址空间,允许从用户模式读取当前时间

例如,Linux上
System.currentTimeMillis()
的Oracle JDK和OpenJDK实现调用glibc函数。此调用通过调用直接从用户空间访问内核数据