|
|
1.1 ! root 1: /* ! 2: * static char ID_reprtc[] = "@(#) rpartition.c: 1.1 11/23/82"; ! 3: */ ! 4: ! 5: repartition() ! 6: { ! 7: ! 8: #if DPARTRESET != -1 ! 9: register int index1, index2, limit1, limit2; ! 10: register usage; ! 11: ! 12: /* ! 13: * Redefine the size of the partitions ! 14: */ ! 15: ! 16: usage = partusage[num_partitions]; ! 17: ! 18: if( dflag > 10 ) { ! 19: fprintf( stderr, "\nrepartition: %d :", num_partitions ); ! 20: for( index1 = 0; index1 < num_partitions; index1++ ) ! 21: fprintf( stderr, " (%5d %5d %5d %5d %5d)", ! 22: partitions[index1], num_linked[index1], lru[index1], mru[index1], partusage[index1] ); ! 23: } ! 24: ! 25: index2 = num_partitions - 1; ! 26: partitions[index2] = NUMBERFRAMES; ! 27: partusage[index2] = 0; ! 28: for( index1 = 0; index1 < index2; index1++ ) { ! 29: partitions[index1] = (partusage[index1] * NUMBERFRAMES)/usage; ! 30: if( partitions[index1] == 0 ) ! 31: partitions[index1] = 1; ! 32: partusage[index1] = 0; ! 33: partitions[index2] -= partitions[index1]; ! 34: } ! 35: partusage[num_partitions] = 0; ! 36: ! 37: if( dflag > 10 ) { ! 38: fprintf( stderr, "\n\t\t" ); ! 39: for( index1 = 0; index1 < num_partitions; index1++ ) ! 40: fprintf( stderr, " (%5d %5d %5d %5d %5d)", ! 41: partitions[index1], num_linked[index1], lru[index1], mru[index1], partusage[index1] ); ! 42: } ! 43: ! 44: /* ! 45: * Move the page frames into the new partitons ! 46: */ ! 47: ! 48: if( dflag > 12 ) { ! 49: fprintf( stderr, "\n" ); ! 50: for( index1 = 0; index1 < NUMBERFRAMES; index1++ ) ! 51: fprintf( stderr, " %2d", index1 ); ! 52: fprintf( stderr, "\n" ); ! 53: for( index1 = 0; index1 < NUMBERFRAMES; index1++ ) ! 54: fprintf( stderr, " %2d", manager[index1].partition ); ! 55: fprintf( stderr, "\n" ); ! 56: for( index1 = 0; index1 < NUMBERFRAMES; index1++ ) ! 57: fprintf( stderr, " %2d", manager[index1].backward ); ! 58: fprintf( stderr, "\n" ); ! 59: for( index1 = 0; index1 < NUMBERFRAMES; index1++ ) ! 60: fprintf( stderr, " %2d", manager[index1].forward ); ! 61: } ! 62: ! 63: limit1 = 0; ! 64: for( index1 = 0; index1 < num_partitions; index1++ ) { ! 65: ! 66: limit2 = limit1 + partitions[index1]; ! 67: ! 68: for( index2 = limit1; index2 < limit2; index2++ ) { ! 69: manager[index2].partition = index1; ! 70: if( manager[index2].forward != INVALID ) ! 71: break; ! 72: } ! 73: ! 74: if( index2 == limit2 ) { ! 75: lru[index1] = mru[index1] = NOFRAMES; ! 76: num_linked[index1] = 0; ! 77: continue; ! 78: } ! 79: ! 80: lru[index1] = mru[index1] = index2; ! 81: num_linked[index1] = 1; ! 82: ! 83: for( index2++; index2 < limit2; index2++ ) { ! 84: manager[index2].partition = index1; ! 85: if( manager[index2].forward == INVALID ) ! 86: continue; ! 87: num_linked[index1]++; ! 88: manager[mru[index1]].forward = index2; ! 89: manager[index2].backward = mru[index1]; ! 90: mru[index1] = index2; ! 91: } ! 92: ! 93: manager[lru[index1]].backward = LAMDA; ! 94: manager[mru[index1]].forward = LAMDA; ! 95: ! 96: limit1 = limit2; ! 97: ! 98: } ! 99: ! 100: if( dflag > 12 ) { ! 101: fprintf( stderr, "\n\n" ); ! 102: for( index1 = 0; index1 < NUMBERFRAMES; index1++ ) ! 103: fprintf( stderr, " %2d", manager[index1].partition ); ! 104: fprintf( stderr, "\n" ); ! 105: for( index1 = 0; index1 < NUMBERFRAMES; index1++ ) ! 106: fprintf( stderr, " %2d", manager[index1].backward ); ! 107: fprintf( stderr, "\n" ); ! 108: for( index1 = 0; index1 < NUMBERFRAMES; index1++ ) ! 109: fprintf( stderr, " %2d", manager[index1].forward ); ! 110: } ! 111: ! 112: #endif ! 113: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.