a typical computer malware is a program or piece of code that is loaded onto a computer and / or performs some undesired actions on a computer without the knowledge or consent of the computer operator . types of malware include computer viruses , trojan horse programs , and other content . one widespread , well - known and dangerous type of computer malware are computer viruses , that is , programs or pieces of code that replicate themselves and load themselves onto other connected computers . once the virus has been loaded onto the computer , it is activated and may proliferate further and / or damage the computer or other computers . a particular type of computer virus is the computer worm , which is a program or code that replicates itself over a computer network and may performs malicious actions , such as using up the computer &# 39 ; s resources and possibly shutting the system down . a trojan horse program is typically a destructive program that masquerades as a benign application . unlike a virus , trojan horses do not replicate themselves but they can be just as destructive . one insidious type of trojan horse is a program that claims to rid a computer of malwares but instead introduces malwares onto the computer . although terms such as virus or anti - virus may be used for clarity , such terms are used only as example of malwares and the present invention contemplates any and all types of malware , including , but not limited to computer viruses , computer worms , trojan horse programs . an exemplary data flow diagram of information processed by the present invention is shown in fig1 . as shown in fig1 an anti - virus program 102 includes virus scanning routines 104 and virus removal routines 106 . using virus scanning routines 104 , anti - virus program 102 scans files , such as scanned file 108 , looking for malware , such as viruses and worms , that may be included in the file . the scanned files may include any types of files , including data files , such as microsoft windows ® ini files , other text files , graphics files , audio files , video files , or files containing other data . when a virus or other malware is found , anti - virus program 102 may use virus removal routines 106 to remove instances of the virus from the infected file . scanned file 108 is a file that is accessed by application program 110 . application program 110 may perform access operations on scanned file 108 , such as file read operations and file write operations .. although scanned file 108 may be any type of file , including an executable file , application programs , such as application program 110 , most often write to data files . in particular , application program 110 may perform a plurality of file writes , such as the set of file writes 112 to scanned file 108 . each file write adds or modifies data 114 included in scanned file 108 . each file write may write to a sequential location in scanned file 108 or to a random location in scanned file 108 . ideally , anti - virus program 102 should only scan scanned file 108 when the plurality of writes 112 have been completed . however , virus scanning routines 104 do not have sufficient information to determine when a set of file writes , such as file writes 112 , has just begun or just ended . the oas sees a discrete set of open and close operations and cannot guess which is the last one . the present invention solves this problem by intercepting the first , or one of the first , write operations and allowing it to continue . scanned file 108 is then scanned after a time interval has elapsed . in the meantime , other open , close , and write operations requests to the same file are allowed to proceed without being scanned . the file write operation that was originally intercepted and the file operations to the file being monitored that occur after the initial interception and before the scan occurs are allowed to complete before or during the scan that does occur . if the set of file writes , such as file writes 112 , performed by application program 110 , lasts less than the time interval , then the effect is that the last write will be scanned , since the first scan occurs after the final write has occurred . if the set of file writes , such as file writes 112 , performed by application program 110 , lasts longer than the time interval , then the process will repeat and the next operation that is intercepted will be scanned after a delay . the effect is that a sample of the set of writes is scanned instead of all the writes being scanned . in addition , it is ensured that the final file , after all writes have been completed , is scanned . the main variable in this process is the time interval between the file write operation being detected and scanned file 108 being scanned . the time interval should be short enough that viruses and other malware are detected in a timely manner . however , the time interval should also be significantly longer than the open / write / close cycle that is required by application program 110 for each write , so that the fraction of operations that are scanned is small enough to provide adequate performance . each write is done as part of a discrete open - file / write / close - file sequence . on - access scanners intercept the individual opens and closes and may or may not ignore the writes . if application did open - file / write / write / . . . / write / write / close - file then there would be no problem , indeed many programs already behave nicely like this . for example , in the case of microsoft windows ® ini files , the open / write / close cycle is typically very quick — several thousand may be performed per second on an average desktop personal computer system . therefore , a delay of , for example , one second allows many such cycles to be completed without the overhead of scanning , yet keeps virus detection delay to a short time . the time interval used may be predefined , definable by the user or administrator of the anti - virus program , or the time interval may be varied based on the filetype of scanned file 108 or based on the particular application program 110 that is performing the operations . a block diagram of an exemplary computer system 200 , in which the present invention may be implemented , is shown in fig2 . computer system 200 is typically a programmed general - purpose computer system , such as a personal computer , workstation , server system , and minicomputer or mainframe computer . computer system 200 includes processor ( cpu ) 202 , input / output circuitry 204 , network adapter 206 , and memory 208 . cpu 202 executes program instructions in order to carry out the functions of the present invention . typically , cpu 202 is a microprocessor , such as an intel pentium ® processor , but may also be a minicomputer or mainframe computer processor . although in the example shown in fig2 computer system 200 is a single processor computer system , the present invention contemplates implementation on a system or systems that provide multi - processor , multi - tasking , multi - process , multi - thread computing , distributed computing , and / or networked computing , as well as implementation on systems that provide only single processor , single thread computing . likewise , the present invention also contemplates embodiments that utilize a distributed implementation , in which computer system 200 is implemented on a plurality of networked computer systems , which may be single - processor computer systems , multi - processor computer systems , or a mix thereof . input / output circuitry 204 provides the capability to input data to , or output data from , computer system 200 . for example , input / output circuitry may include input devices , such as keyboards , mice , touchpads , trackballs , scanners , etc ., output devices , such as video adapters , monitors , printers , etc ., and input / output devices , such as , modems , etc . network adapter 206 interfaces computer system 200 with network 210 . network 210 may be any standard local area network ( lan ) or wide area network ( wan ), such as ethernet , token ring , the internet , or a private or proprietary lan / wan . memory 208 stores program instructions that are executed by , and data that are used and processed by , cpu 202 to perform the functions of the present invention . memory 208 may include electronic memory devices , such as random - access memory ( ram ), read - only memory ( rom ), programmable read - only memory ( prom ), electrically erasable programmable read - only memory ( eeprom ), flash memory , etc ., and electro - mechanical memory , such as magnetic disk drives , tape drives , optical disk drives , etc ., which may use an integrated drive electronics ( ide ) interface , or a variation or enhancement thereof , such as enhanced ide ( eide ) or ultra direct memory access ( udma ), or a small computer system interface ( scsi ) based interface , or a variation or enhancement thereof , such as fast - scsi , wide - scsi , fast and wide - scsi , etc , or a fiber channel - arbitrated loop ( fc - al ) interface . memory 208 includes anti - virus program 102 , application program 112 , scanned file 108 , and operating system 212 . anti - virus program 102 includes virus scanning routines 104 and virus removal routines 106 . scanned file 108 is a file that is accessed by application program 110 . application program 110 may perform access operations on scanned file 108 , such as file read operations and file write operations .. although scanned file 108 may be any type of file , including an executable file , application programs , such as application program 110 , most often write to data files . as application program 110 performs accesses on scanned file 108 , anti - virus program 102 scans scanned file 108 using virus scanning routines 104 until a virus or other malware is found . anti - virus program 102 may then use virus removal routines 106 to remove instances of the virus from scanned file 108 . operating system 212 provides overall system functionality . an exemplary flow diagram of a file scanning process 300 , which may be implemented in the system shown in fig2 is shown in fig3 . fig3 is best viewed in conjunction with fig1 . process 300 begins with step 302 , in which system operations performed by application programs and other processes are monitored by anti - virus program 102 . anti - virus program 102 is configured to monitor a variety of system operations , including file access operations , such as file writes . when such an operation occurs , anti - virus program 102 intercepts the operation and examines it to determine what action to take . when a file write operation is performed by application program 110 on scanned file 108 , such as the first write operation among write operations 112 , the file write operation is intercepted by anti - virus program 102 . in step 304 , if the intercepted operation is a file write to a file of the appropriate file type , then the action taken by anti - virus program 102 is to allow process 300 to proceed to step 306 . if the intercepted operation is not a file write to a file of the appropriate file type , then anti - virus program 102 may take other actions . in step 306 , process 300 waits for a time interval , then , in step 308 , virus scanning routines 104 of anti - virus program 102 are used to scan scanned file 108 for viruses and other malware . during the time interval , other open , close , and write operations to scanned file 108 are allowed to proceed without being scanned . the process then loops back to step 302 , in which system operations are monitored . if the set of file writes , such as file writes 112 , performed by application program 110 , lasts less than the time interval , then the effect is that scanned file 108 will be scanned after the last write has occurred , since the first scan occurs after the final write has occurred . if the set of file writes , such as file writes 112 , performed by application program 110 , lasts longer than the time interval , then another file write will be intercepted and scanned file 108 will be scanned again after a delay . the effect is that a sample of the set of writes is scanned instead of all the writes being scanned . in addition , it is ensured that the final file , after all writes have been completed , is scanned . the main variable in this process is the time interval between the file write operation being detected and scanned file 108 being scanned . the time interval should be short enough that viruses and other malware are detected in a timely manner . however , the time interval should also be significantly longer than the open / write / close cycle that is required by application program 110 for each write , so that the fraction of operations that are scanned is small enough to provide adequate performance . for example , in the case of microsoft windows ® ini files , the open / write / close cycle is typically very quick — several thousand may be performed per second on an average desktop personal computer system . therefore , a delay of , for example , one second allows many such cycles to be completed without the overhead of scanning , yet keeps virus detection delay to a short time . the time interval used may be predefined , definable by the user or administrator of the anti - virus program , or the time interval may be varied based on the filetype of scanned file 108 or based on the particular application program 110 that is performing the operations . typically , anti - virus program 102 is configured to perform process 300 only in response to intercepting a file write operation to a file of one or more specified file types . the file types are specified based on the likelihood that the file type may contain a virus or other malware that may be detected by process 300 . for example , the microsoft windows ® ini file type is one such file type that may contain a virus or other malware that may be detected by process 300 . the specification of file types is typically done by the vendor of anti - virus program 102 , the administrator of computer systems on which anti - virus program 102 is installed , or the user of a computer system on which anti - virus program 102 is installed . it is important to note that while the present invention has been described in the context of a fully functioning data processing system , those of ordinary skill in the art will appreciate that the processes of the present invention are capable of being distributed in the form of a computer readable medium of instructions and a variety of forms and that the present invention applies equally regardless of the particular type of signal bearing media actually used to carry out the distribution . examples of computer readable media include recordable - type media such as floppy disc , a hard disk drive , ram , and cd - rom &# 39 ; s , as well as transmission - type media , such as digital and analog communications links . although specific embodiments of the present invention have been described , it will be understood by those of skill in the art that there are other embodiments that are equivalent to the described embodiments . accordingly , it is to be understood that the invention is not to be limited by the specific illustrated embodiments , but only by the scope of the appended claims .