Internal vs External Fragmentation
Qhov sib txawv ntawm kev sib cais sab hauv thiab sab nraud yog ib lub ntsiab lus txaus siab rau ntau tus neeg uas nyiam txhim kho lawv cov kev paub hauv computer. Ua ntej paub qhov txawv no, peb yuav tsum saib seb qhov tawg yog dab tsi. Fragmentation yog qhov tshwm sim uas tshwm sim hauv lub cim xeeb hauv computer xws li Random Access Memory (RAM) lossis hard disks, uas ua rau nkim thiab siv tsis tau qhov chaw dawb. Thaum qhov kev siv tau zoo ntawm qhov chaw muaj kev cuam tshuam, qhov no ua rau muaj teeb meem kev ua haujlwm, thiab. Internal fragmentation tshwm sim thaum lub cim xeeb faib raws li qhov loj me ntawm cov partitions uas tom qab ib daim ntawv thov me me raug muab tso rau hauv ib lub qhov uas qhov seem dawb ntawm qhov qhov ntawd yog nkim. Sab nraud fragmentation tshwm sim thaum lub cim xeeb yog dynamically faib nyob qhov twg tom qab thauj khoom thiab unloading ntawm ob peb slots ntawm no thiab muaj qhov chaw dawb yog muab faib es tsis yog contiguous.
Internal Fragmentation yog dab tsi?
Xav txog daim duab saum toj no uas tau ua raws li qhov ntsuas qhov ntsuas qhov loj me me. Thaum xub thawj, lub cim xeeb yog khoob thiab tus allocator tau faib lub cim xeeb rau hauv qhov chaw ruaj khov. Tom qab ntawd peb qhov kev pab cuam npe A, B, C tau raug thauj mus rau thawj peb qhov kev faib tawm thaum lub 4th muab faib tseem pub dawb. Program A sib phim qhov loj ntawm qhov muab faib, yog li tsis muaj kev khib nyiab hauv qhov kev faib tawm, tab sis Program B thiab Program C yog me dua qhov muab faib loj. Yog li ntawd, nyob rau hauv partition 2 thiab partition 3 muaj seem seem dawb. Txawm li cas los xij, qhov chaw dawb no siv tsis tau vim tias lub cim xeeb faib tsuas yog muab tag nrho cov partitions rau cov kev pab cuam tab sis tsis muaj qhov ntawm nws. Qhov nkim ntawm qhov chaw dawb no hu ua internal fragmentation.
Hauv qhov piv txwv saum toj no, nws yog qhov sib npaug ntawm qhov sib npaug sib npaug tab sis qhov no tuaj yeem tshwm sim nyob rau hauv qhov xwm txheej uas muaj qhov sib faib ntawm ntau qhov ntau thiab tsawg. Feem ntau lub cim xeeb lossis qhov chaw nyuaj tshaj plaws tau muab faib ua cov blocks uas feem ntau yog qhov loj ntawm lub zog ntawm 2 xws li 2, 4, 8, 16 bytes. Yog li ib qho kev pab cuam lossis cov ntaub ntawv ntawm 3 bytes yuav raug muab rau 4 byte thaiv tab sis ib byte ntawm qhov thaiv ntawd yuav dhau los ua siv tsis tau ua rau sab hauv tawg.
Dab tsi yog External Fragmentation?
Xav txog daim duab saum toj no uas kev faib lub cim xeeb ua tiav dynamically. Hauv kev faib lub cim xeeb dynamic, tus faib faib tsuas yog qhov xav tau tiag tiag rau qhov kev pab cuam ntawd. Thawj lub cim xeeb yog dawb kiag li. Tom qab ntawd cov Kev Pab Cuam A, B, C, D thiab E ntawm ntau qhov sib txawv yog loaded ib tug tom qab lwm yam thiab lawv muab tso rau hauv lub cim xeeb contiguously nyob rau hauv qhov kev txiav txim. Tom qab ntawd, Program A thiab Program C kaw thiab lawv raug tshem tawm ntawm lub cim xeeb. Tam sim no muaj peb qhov chaw dawb hauv lub cim xeeb, tab sis lawv tsis nyob ib sab. Tam sim no ib qho kev pab cuam loj hu ua Program F tab sis tsis muaj qhov chaw dawb thaiv tsis txaus rau Program F. Qhov sib ntxiv ntawm tag nrho cov chaw dawb yog twv yuav raug hu txaus rau Program F, tab sis vim tsis muaj qhov nyob ib sab uas qhov chaw yog. siv tsis tau rau Program F. Qhov no hu ua External Fragmentation.
Dab tsi yog qhov txawv ntawm Internal thiab External Fragmentation?
• Internal Fragmentation tshwm sim thaum siv cov txheej txheem kev faib qhov loj me me. Sab nraud fragmentation tshwm sim thaum siv cov txheej txheem nco dynamic faib.
• Internal fragmentation tshwm sim thaum ib qho kev faib loj tas mus rau ib qho kev pab cuam / cov ntaub ntawv nrog tsawg dua qhov muab faib ua qhov seem ntawm qhov chaw hauv qhov muab faib siv tsis tau. Kev tawg sab nraud yog vim tsis muaj qhov chaw nyob ib sab txaus tom qab thauj khoom thiab tshem tawm cov kev pab cuam lossis cov ntaub ntawv rau qee lub sijhawm vim tias txhua qhov chaw dawb tau faib tawm ntawm no thiab muaj.
• Sab nraud fragmentation tuaj yeem raug mined los ntawm kev sib cog lus qhov twg cov blocks raug txav mus rau ib sab, kom qhov chaw sib txuas tau txais. Txawm li cas los xij, qhov kev ua haujlwm no yuav siv sijhawm thiab tseem muaj qee qhov chaw tseem ceeb xws li cov kev pabcuam hauv lub cev tsis tuaj yeem txav mus tau zoo. Peb tuaj yeem soj ntsuam cov kauj ruam compaction ua tiav ntawm hard disks thaum khiav lub disk defragmenter hauv Windows.
• Sab nraud fragmentation tuaj yeem tiv thaiv los ntawm cov txheej txheem xws li segmentation thiab paging. Ntawm no yog ib qho kev sib txuas lus sib txuas ntawm lub cim xeeb virtual yog muab thaum qhov tseeb cov ntaub ntawv / cov kev pab cuam tau muab faib ua ntu thiab muab tso rau ntawm no thiab muaj.
• Internal fragmentation tuaj yeem ua rau muaj kev cuam tshuam ntawm ntau qhov ntau thiab tsawg thiab muab cov kev pab cuam raws li qhov zoo tshaj plaws. Txawm li cas los xij, tseem muaj kev sib cais sab hauv tsis raug tshem tawm tag nrho.
Summary:
Internal vs External Fragmentation
Ob qho tib si sab hauv thiab sab nrauv tawg yog qhov tshwm sim uas nco tau khib. Internal fragmentation tshwm sim nyob rau hauv tas loj me me faib faib thaum sab nraud fragmentation tshwm sim nyob rau hauv dynamic nco allocation. Thaum ib qho kev faib faib yog nyob los ntawm ib qho kev pab cuam uas tsawg dua qhov muab faib, qhov seem seem mus nkim ua rau sab hauv fragmentation. Thaum txaus qhov chaw nyob ib sab tsis tuaj yeem pom tom qab thauj khoom thiab tshem tawm cov kev pab cuam, vim qhov tseeb tias qhov chaw pub dawb tau muab faib rau ntawm no thiab nyob ntawd, qhov no ua rau muaj kev puas tsuaj sab nraud. Fragmentation tuaj yeem tshwm sim hauv txhua lub cim xeeb xws li RAM, Hard disk thiab Flash drives.