gpt4 book ai didi

operating-system - 什么是上下文切换时间?

转载 作者:行者123 更新时间:2023-12-04 07:26:46 27 4
gpt4 key购买 nike

我对上下文切换有疑问。
在多线程中,当发生上下文切换时,两次上下文切换之间的时间是多少?是固定的时间间隔吗?

最佳答案

这真的取决于操作系统和情况。你必须阅读 scheduling in general关于您使用的特定线程技术:there is a nice list here .

在考虑线程时,如果其他进程需要 CPU 时间,则实际墙时间间隔可能会发生变化,因为这会占用运行线程的进程的时间。

话虽如此,there are some nice C code samples to measure that time .

关于operating-system - 什么是上下文切换时间?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2148813/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com