320 likes | 849 Views
Memory & Hard Drive Management Chapters 6 & 9 David Turton Conestoga College Institute of Technology & Advanced Learning http://www.conestogac.on.ca/~dturton Doon 1D17 x3610 Early Memory Decisions (DOS) "no-one needs more than 640KB of memory"
E N D
Memory & Hard Drive ManagementChapters 6 & 9 David Turton Conestoga College Institute of Technology & Advanced Learning http://www.conestogac.on.ca/~dturton Doon 1D17 x3610
Early Memory Decisions (DOS) • "no-one needs more than 640KB of memory" • early 20-line busses: max addresses 220=1,024K=1M • conventional memory: 0-640K • O/S, applications, data • upper memory: 640K to 1024K • BIOS, device drivers • eg: 640K to 768K for video (128KB … Pong in B&W?) • extended memory: above 1024K • >24 address lines in bus available • Needed an extended memory manager • Code/data was swapped down to conventional to execute • Aberration: 1st 64K un-allocated • "High Memory" – for parts of O/S (eg: mouse driver)
This is a map of memory addresses Not physical RAM Video/network cards Responded to an assigned range of addresses Physical RAM Responded to a disjoint address range DOS Memory Map
Implications(other than BillG getting embarrassed) • O/S, applications and data had to fit in 640K • programs cannot have contiguous data space • couldn't run past 640K because of video • video ROM hard-coded to fixed address range • finite number of devices • only so many address ranges available • device memory conflicts frequent: modem/COM ports, etc. • devices couldn't grow larger • video range is 128K, period. • some applications (Lotus123) had own memory manager • To manage data files 1M or larger • WordPerfect had to write own memory manager
Windows 9x • O/S lives in extended memory • conventional & upper memory available for 16-bit apps • Virtual Memory • swap file (or page file) on hard drive • used as an extension to memory • swaps 4K pages between physical memory & swap file • Unused code/data to disk, active code to memory
RAM is faster than hard drive, no seek time SATA 1.0 150MB/sec PC3200 (400MHz) 3.2GB/sec (20x faster) the more paging you do, the slower you go. thrashing: RAM is continually full, continually paging CPU wasting time, high disk usage, slow response solutions: Close applications Increase RAM Page file to another hard drive On another EIDE cable Increasing RAM Business app score Mult. applications open Multimedia score Editing media files 128MB 256MB Business: 33% gain Multimedia: 50% gain 128MB 512MB Business: 8% gain Multimedia: 10% gain 512MB 1GB Business: 5% gain Multimedia: 7% gain Virtual Memory: Problems
NT/2000/XP/2003 Memory Management • Eliminated fixed memory ranges • lost some backward compatibility • Each application has a virtual memory range • Each range starts at byte 1 • Grows in allocations of 4K pages • Virtual Memory Manager • between application/driver & physical memory • pages in & out of virtual memory • app asks for address 256 • VMM delivers: might actually be address 5285 in RAM
This is one reason programs can’t work in “REAL MODE” … Not enough memory for everyone. “PROTECTED MODE” hides physical limitations, allows O/S to give everyone everything they need. Windows NT+ Virtual Memory Manager memory space for application 1 Application1 Physical RAM memory space for application 2 Application2 pagefile.sys
Improving Virtual Memory • should be 2.5x RAM size • or more • make max and min page file size same • prevents file growing on demand • …and fragmenting • move page file to another physical disk • I/O to memory simultaneous with I/O for data & apps
Memory Errors • recurring errors/lockups • "General Protection Fault" • "exception fault 0E at >>0137:BFF9C0D" • causes: • virus • update & run AV, download patches • memory modules faulty • Run test utilities (memtest86) • Pull/swap DIMMs one at a time, retest • Not enough RAM • Not enough free space on system disk
Emergency Start-up Disksincludes utilities to troubleshoot a failed hard drive… or at least see if you can salvage something … outlook.pst? • Win 9x • Single bootable diskette • Utility programs: fdisk, format, extract, etc. • Compressed cabinet file (ebd.cab) • Uncompressed to RAM drive at boot • Can pick individual programs w/ extract.exe: • extract ebd.cab /d list files • extract edb.cab fred.txt extract single file fred.txt • control panel add/remove progs startup disk • Win 2000 - 4 diskettes, includes O/S kernel • Win XP - backup file & boot diskette
Win 9x rescue disk • If can boot to A: prompt • Motherboard, CPU, memory, floppy drive, power supply and video system are functioning • Check amount of memory: ensure it sees it all. • Problem is likely the hard drive • fdisk – is partition table OK? • No: can repair: • Win 9x fdisk /mbr • Win 2000+ fixmbr • Can be used on Win XP systems • But can't look into NTFS file system
FAT16 DOS/Win 95 limit 2-4GB VFAT Win 3.11/95 limit 2-4GB 255-byte file names 16-bit FAT FAT32 Win 95 SP2 limit >32GB NTFS Win NT limit ??EB File Systems (Micro$oft)if the file system is not healthy, cannot use drive
File Allocation Table 1 pointer for each cluster on disk Points to next cluster for a file All 1's means end-of-file All zeros means cluster is free Else: address of next location FAT16 16 bits per pointer Max value 216 = 65,536 Can only be 65,534 clusters on disk 2GB disk … 2,147,483,648 bytes / 65,534 clusters = 32,700 bytes/cluster 5-byte file uses 32KB on disk FAT32 32 bits per pointer Max 232 = 4.2 billion pointers 80GB disk … Still has spare pointers Min physical cluster size: 1 sector or 512 bytes Min cluster used: 2 sectors or 1KB FAT16 vs. FAT32
chkdsk c: /f check c: for errors and fix them from DOS prompt scandisk c: older: only Win 9x like chkdisk better with windows up defrag only win 9x defragment a drive debug try it! … well, try the help prompt for it first Win XP facilities chkdsk still works need to disable some things else chkdsk restarts Disk error checks
chkdisk & defrag: keep restarting never finish need to disable: startup programs settings drivers reset from clean boot: general tab click Normal start-up run msconfig general tab selective startup clear: system.ini, Win.ini, startup items, load system services services tab: check: Hide all Microsoft Services, Disable All OK restart Clean Boot for Windows XPMs article 310353
win 9x fdisk /status partition info, all drives fdisk screens to display or modify partitions fdisk /mbr repairs a damaged MBR win 2000/XP Disk Manager prep a drive for 1st use diskpart similar to fdisk fixmbr similar to fdisk /mbr Partitioning disks formatting a disk with a file system: see format /?
Disk Inefficiencies • fragmentation • files are written to first available clusters • larger files may be written to several groups of clusters • these may be spread throughout drive • files are still available • but read time slowed with head movement • cross-linked files • clusters with more than one file pointing to them • lost clusters • clusters marked as in use • but no file in FAT references them
Disk Defragmenter Collect file fragments rewrite in contiguous space
chkdsk • supported by all Windows versions • "repairs" cross-linked files & lost clusters • lost clusters become "file001.chk" • locates and flags bad sectors • XP also has graphical version • note: needs exclusive access • Clean boot or check before loading services
Freeing SpaceXP: through properties on a disk driver • Disk Cleanup • lists & deletes temporary files • Disk Compression • stores data in drive in one big file • compression algorithm uses less space • trade-off: • more data transferred per read or write • more CPU load to compress/decompress
many slow trips CPU hard drive Caching cache program CPU hard drive few slow trips many fast trips RAM • RAM to hold data read from or written to hard drives • cache program reads ahead of CPU • faster from RAM than waiting for disk to move • Hardware cache • BIOS and RAM on drive controller • slower bus to CPU • software cache • uses systems RAM • faster bus to CPU
Backups • can recover data lost to system failure, virus, etc. • only if you plan ahead • full backup • every file – very large, very slow • incremental backup • files changed since last backup (full or incremental) • archive bit turned off • fastest – need to restore full backup and every incremental since • differential backup • files changed since last full backup • archive bit left on • fast – need to restore full backup and only last differential • Note: • XP's backup doesn't compress – commercial products do
Scheduled TasksControl Panel Scheduled Tasks • schedule tasks to run • daily, weekly, etc. • used by Ms backup, Norton AV • can create a batch file • copy certain folders • schedule to run daily
Troubleshooting Hard Drives • Norton Utilities www.symantec.com • prevent drive damage, recover data, repair damage, improve performance • use version for your O/S • damage could result • Partition Magic www.powerquest.com • FAT16 to FAT32, create/resize/move partitions • without losing data • Great for clients that "shorted" c: drive space • hide partitions • SpinRite www.grc.com • DOS: small footprint, real mode from floppy • analyse drive surface, data recovery from corrupted files, recover file system information
Resolving drive problems • invalid drive or drive specification • Booting from C: • same message using XP boot diskette • Partition table damaged on hard drive • Win 9x: fdisk /mbr XP: fixmbr • Invalid media type • Non-DOS disk • Unable to read from drive C: • O/S boot record damaged • recover from backup copy, if have one • repair w/ Norton disk doctor or SpinRite
Resolving drive problems cont'd • Sector not found reading drive C, abort, retry, Ignore, Fail? • FAT or root directory damage • try copying important files off drive • Norton Disk Doctor • to repair FAT or root directory • Non system disk or disk error • Invalid system disk • Win9x: to recover io.sys & msdos.sys: • sys C: • Win XP: copy, from another machine: • ntldr, ntdetect.com, boot.ini