SlideServe
Menu
Préférences
© SlideServe · v2026

7.11 External Sorting

yan avatar
8 diapositives · 207 Views · Aug 14, 2014

This article discusses external sorting methods to efficiently handle large datasets that exceed internal memory limits. It explains how access to secondary storage is significantly slower than memory access and presents strategies to minimize this access. Through clear examples, it elaborates on a simple merge sort with multiple tapes, demonstrating the concept of runs and passes needed for sorting. Additionally, it explores multiway merge techniques with k input devices, detailing the calculations required for the number of passes necessary based on available memory and record size.

7.11 External Sorting - slide 1
01 / 87.11 External Sorting
1 / 17

Télécharger la présentation

7.11 External Sorting
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. 7.11 External Sorting • Access to secondary storage is orders of magnitude slower than memory access. • Minimize access to secondary storage (tape or disk). • Also may want to read data sequentially (tapes).

  2. 7.11 External Sorting • Simple merge example - sorting M records at a time (M=3), with 4 tapes (Ta1,Ta2, Tb1, Tb2) Ta1 81 94 11 ; 96 12 35 ; 17 99 28 ; 58 41 75 ; 15 Ta2 Tb1, Tb2 empty

  3. 7.11 External Sorting Ta1, Ta2 empty Tb1 11 81 94 ; 17 28 99 ; 15 Tb2 12 35 96 ; 41 58 75 Ta1 11 12 35 81 94 96 ; 15 Ta2 17 28 41 58 75 99 Tb1, Tb2 empty

  4. 7.11 External Sorting • read M records at a time and sort internally • a set of sorted records is called a run • it will require log(N/M) passes, plus the initial run-constructing pass • given 10 million records of 128 bytes, and 4 M bytes of internal memory N=10*106, M=4*106/128, # of runs = N/M = 320 # of passes = log(N/M) + 1= 10

  5. 7.11 External Sorting Ta1, Ta2 empty Tb1 11 12 17 28 35 41 58 75 81 94 96 99 Tb2 15 Ta1 11 12 15 17 28 35 41 58 75 81 94 96 99 Ta2 Tb1, Tb2 empty

  6. 7.11 External Sorting • Multiway Merge • k inputdevices instead of just 2 • e.g, k=3 for the previous example Ta1 81 94 11 ; 96 12 35 ; 17 99 28 ; 58 41 75 ; 15 Ta2 Ta3 Tb1, Tb2, Tb3 empty

  7. 7.11 External Sorting Ta1, Ta2, Ta3 empty Tb1 11 81 94 ; 41 58 75 Tb2 12 35 96 ; 15 Tb3 17 28 99 Ta1 11 12 17 28 35 81 94 96 99 Ta2 15 41 58 75 Ta3 Tb1, Tb2, Tb3 empty

  8. 7.11 External Sorting Ta1, Ta2, Ta3 empty Tb1 11 12 15 17 28 35 41 58 75 81 94 96 99 Tb2 , Tb3 empty • it will require logk(N/M) passes, plus the initial run-constructing pass • for N=10*106, M=4*106/128, # of passes = log5(10*128/4) + 1= 5 Skip rest of Chapter 7