Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site mh3bs.UUCP Path: utzoo!linus!security!genrad!mit-eddie!mit-vax!eagle!mh3bs!agp From: agp@mh3bs.UUCP Newsgroups: net.unix-wizards Subject: Re: m and n of mkfs Message-ID: <354@mh3bs.UUCP> Date: Sat, 19-Nov-83 10:45:58 EST Article-I.D.: mh3bs.354 Posted: Sat Nov 19 10:45:58 1983 Date-Received: Mon, 21-Nov-83 01:15:23 EST References: <298@bunker.UUCP> Organization: Bell Labs, Murray Hill, NJ Lines: 101 A few USENIX conferences ago, someone presented a paper on computing optimal magic numbers for a cpu/disk pair. For what it is worth, I will post their program here: #include #define SECTORS (disk[n].d_sec_tk * disk[n].d_surf) struct cpu { char *cpu_name; int Bps; }; struct cpu cpu[] = { "PDP23", 119, "pdp23", 119, "11/23", 119, "23", 119, "PDP34", 119, "pdp34", 119, "11/34", 119, "34", 119, "PDP45", 170, "pdp45", 170, "11/45", 170, "45", 170, "PDP70", 210, "pdp70", 210, "11/70", 210, "70", 210, "VAX780", 210, "vax780", 210, "11/780", 210, "780", 210, "VAX", 210, "vax", 210, NULL, NULL }; struct disk { char *d_name; int d_spin; int d_sec_tk; int d_byte_bk; int d_surf; int d_cyl; int d_tk_seek; int d_avg_seek; }; struct disk disk[] = { /* disk spin sec_tk byte_blk surf cyl tk_seek avg_seek */ "rk05", 1500, 12, 512, 2, 203, 10, 50, "rl01", 2400, 20, 256, 2, 256, 15, 55, "rp03", 2400, 10, 512, 20, 406, 8, 29, "rp04", 3600, 22, 512, 19, 411, 7, 28, "rp05", 3600, 22, 512, 19, 411, 6, 29, "rp06", 3600, 22, 512, 19, 815, 6, 29, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }; main(argc,argv) char **argv; { register int k, n, i; int block, speed; int f_n; for(k=0; cpu[k].cpu_name[0] != NULL; ++k) { if(strcmp(argv[1],cpu[k].cpu_name) == 0) break; } if(cpu[k].Bps == NULL) { printf("unknown cpu: %s\n",argv[1]); exit(1); } for(n=0; disk[n].d_name[0] != NULL; ++n) { block=((disk[n].d_spin/10)*disk[n].d_sec_tk); speed=((60*(cpu[k].Bps + 1))/10); for(i=1; i <= disk[n].d_surf; ++i) { f_n = SECTORS / i; if(f_n >= 100) continue; if((SECTORS % i) == 0) { if((f_n % disk[n].d_sec_tk) == 0) break; } break; } printf("%s: %d / %d", disk[n].d_name, (block / speed) + 1, SECTORS); printf("\n"); } }