Path: utzoo!attcan!uunet!husc6!bu-cs!madd From: madd@bu-cs.BU.EDU (Jim Frost) Newsgroups: comp.sys.ibm.pc Subject: Re: disk updates and power failures Message-ID: <23706@bu-cs.BU.EDU> Date: 8 Jul 88 01:32:03 GMT References: <472@apctrc.UUCP> Reply-To: madd@bu-it.bu.edu (Jim Frost) Followup-To: comp.sys.ibm.pc Organization: Boston University Distributed Systems Group Lines: 35 In article <472@apctrc.UUCP> zgel05@apctrc.UUCP (George E. Lehmann) writes: |Does anyone have any experience with maintaining file integrity on a DOS |system during extreme conditions such as power failure or users rebooting |the system? Doesn't DOS buffer writes interminably beyond the normal C |programmer's control, preventing my knowing what has actually made it out |to disk? MS-DOS and most cache programs use "write-through" techniques, meaning that every write goes to the disk when it's made, with no buffering. Many languages buffer internally for speed advantages (C is definitely one of them), but you can override this buffering with a simple fflush on the standard functions. Some controllers may do real caching, but I haven't dealt with any. It's not the norm. Additionally I've seen drivers that allow it, but again it's not the norm. If you're worried about power outages, I'd suggest an uninterruptable power supply. They aren't cheap, but they're worth it if your data is important. |What about techniques for making linked lists and such survive these |calamaties? If you're talking about on-disk linked lists (I assume you are) then you should try hard to make sure all writes are actually made. Using the lowest level commands (eg open() close() read() write()) will insure this, but often at some speed penalties. Note, however, that it's pretty easy to recover most or all of a linked list in most cases, so even if you don't do physical writes all the time, it's quite likely that you could make an automatic restore utility. This is basically what CHKDSK is. jim frost madd@bu-it.bu.edu