等待IO的线程是否也阻塞了内核?(Does a thread waiting on IO also block a core?)
在计算的同步/阻塞模型中,我们通常会说等待IO任务完成时,一个执行线程将等待(被阻塞 )。
我的问题是,这通常会导致执行线程的CPU内核处于空闲状态,或者等待IO的线程通常会被上下文切换并处于等待状态,直到IO准备好被处理?
In the synchronous/blocking model of computation we usually say that a thread of execution will wait (be blocked) while it waits for an IO task to complete.
My question is simply will this usually cause the CPU core executing the thread to be idle, or will a thread waiting on IO usually be context switched out and put into a waiting state until the IO is ready to be processed?
原文:https://stackoverflow.com/questions/35688553
最满意答案
我想我已经解决了。 每当我使用ReSharper运行我的silverlight单元测试时,都会发现这个问题。 但是,如果我使用内置的运行Web应用程序进行silverlight测试,则异常消失了
I think i've solved it. the issue only is found whenever I use ReSharper for running my silverlight unit tests. But if i use the built in running web app for the silverlight tests, the exception is gone
相关问答
更多-
尝试将读取/保存文件的.Net用户的访问权限设置为“完全控制”。 Try setting the access permissions to "Full control" for the .Net user from where you are reading/saving the files.
-
您是否在应用的清单中添加了ID_CAP_MEDIALIB_PHOTO功能? UnauthorizedAccessException是99%的缺失功能。 Did you add an ID_CAP_MEDIALIB_PHOTO capability to your app's manifest? UnauthorizedAccessException is 99% of the time a missing capability.
-
使用MVVVMLight,您可以使用DispatcherHelper确保代码在UI线程上运行(您的问题)。 例如 DispatcherHelper.CheckBeginInvokeOnUI(YOUR-ACTION); With MVVVMLight you can use The DispatcherHelper to ensure code runs on the UI thread (your problem). e.g. DispatcherHelper.CheckBeginInvokeOnUI(Y ...
-
创建文件时System.UnauthorizedAccessException(System.UnauthorizedAccessException while creating a file)[2023-04-10]
您的路径很奇怪:“我的文档”目录必须是“C:\ Users \ MyName \ Documents \” 您可以使用Environment来轻松纠正它: String myDocumentPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); 请注意,它将访问运行exe的用户的“我的文档”文件夹。 第二个错误,CreateDirectory必须在参数中有一个路径,而不是文件。 像你一样使用将创建一个带有文件名的子目 ... -
我想我已经解决了。 每当我使用ReSharper运行我的silverlight单元测试时,都会发现这个问题。 但是,如果我使用内置的运行Web应用程序进行silverlight测试,则异常消失了 I think i've solved it. the issue only is found whenever I use ReSharper for running my silverlight unit tests. But if i use the built in running web app for ...
-
这是我基于异常消息的建议。 尽量避免在get方法中设置timeoutTimer的属性。 如果可能,为BasicAuth创建一个无参数构造函数并在那里移动这些行 timeoutTimer.Interval = TimeSpan.FromSeconds(5); timeoutTimer.Tick += new EventHandler(timeout); 有点猜测,但希望这项工作。 This is my suggestion based on the exception messages. Try to av ...
-
愿这会对你有所帮助。 private subscripeToNewChatRoom(long tempID) { ChatRoomOverview.Subscription Subscription = new ChatRoomOverview.Subscription { ContentID = Convert.ToInt32(tempID), userId = App.UserInfromationID }; Dispatcher ...
-
File.Copy的文档中介绍了此异常: 呼叫者没有所需的权限。 -要么- destFileName是只读的。 在第一次复制后检查文件的属性。 权限是您所期望的吗? 您是否需要升级程序(以管理员身份)? This exception is covered in the documentation for File.Copy: The caller does not have the required permission. -or- destFileName is read-only. Check the ...
-
问题产生于BitmapImage无法在UI线程之外实例化。 您可以通过将调用包装在Dispatcher Invoke调用中来解决此问题。 但是,您需要确保正确调用NotifyComplete。 因此,您可能需要在Dispatcher调用中放置NotifyComplete。 Deployment.Current.Dispatcher.BeginInvoke(() => { UpdateSyncPictureName(...); NotifyComplete(); ...
-
您需要使用调度程序来调用正确的线程 - 请参阅http://www.codeproject.com/Articles/368983/Invoking-through-the-Dispatcher-on-Windows-Phone-a You need to use a dispatcher to marshal a call to the proper thread - see http://www.codeproject.com/Articles/368983/Invoking-through-the-D ...