FileSystemWatcher对硬盘驱动器有什么影响? [英] What is the impact of a FileSystemWatcher on a hard drive?

查看:79
本文介绍了FileSystemWatcher对硬盘驱动器有什么影响?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我过去曾经使用过FileSystemWatcher.但是,我希望有人能解释它在幕后的实际运作方式.

I've used FileSystemWatcher in the past. However, I am hoping someone can explain how it actually is working behind the scenes.

我计划在正在开发的应用程序中使用它,它将监视大约5个驱动器,甚至300,000个文件.

I plan to utilize it in an application I am making and it would monitor about 5 drives and maybe 300,000 files.

FileSystemWatcher实际上是否在驱动器上执行检查"-如那样,会导致驱动器磨损吗?还会影响硬盘驱动器睡眠"的能力

Does the FileSystemWatcher actually do "Checking" on the drive - as in, will it be causing wear/tear on the drive? Also does it impact hard drive ability to "sleep"

这是我不明白它是如何工作的-是要像在计时器上扫描驱动器等...,或者它在执行任何操作之前要等待来自操作系统的某种通知.

This is where I do not understand how it works - if it is like scanning the drives on a timer etc... or if its waiting for some type of notification from the OS before it does anything.

我只是不想实施会导致驱动器上的额外读取并使驱动器不休眠的事情.

I just do not want to implement something that is going to cause extra reads on a drive and keep the drive from sleeping.

推荐答案

没什么.文件系统驱动程序仅根据您选择的过滤器监视计算机上运行的其他程序所请求的正常文件操作.如果存在匹配项,则它将一个条目添加到内部缓冲区,该缓冲区记录该操作和文件名.这样就完成了驱动程序请求并获得了要在您的程序中运行的事件.您将从该缓冲区中获得传递给您的操作的详细信息.

Nothing like that. The file system driver simply monitors the normal file operations requested by other programs that run on the machine against the filters you've selected. If there's a match then it adds an entry to an internal buffer that records the operation and the filename. Which completes the driver request and gets an event to run in your program. You'll get the details of the operation passed to you from that buffer.

因此,操作本身实际上没有发生任何事情,根本没有额外的磁盘活动.只是运行的软件而已.开销很小,没有任何明显的变慢.

So nothing actually happens the operations themselves, there is no extra disk activity at all. It is all just software that runs. The overhead is minimal, nothing slows down noticeably.

这篇关于FileSystemWatcher对硬盘驱动器有什么影响?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆