txt" ) );
}
catch( Exception e ) {
System.out.println( e.getMessage() );
System.exit(1);
}
output.println( "number\tsquare\n______\t______" );
for( int i = 1; i <= 20; i++ ) {
output.println( i + "\t" + i*i );
}
output.close();
}
}
200 ANSWERS TO REVIEW QUESTIONS
OPERATING SYSTEMS
6.1 What is the advantage of managing I/O with interrupts? If an active typist is typing 30 words per minute
into a word processor, and the computer operates at one million machine instructions per second, how
many machine instructions can be executed in the time it takes a character to be typed on the keyboard?
While the I/O device is performing the transfer, independent of the CPU, the CPU can be doing
other useful work, instead of simply waiting for the I/O device to complete its work.
30 words-per-minute * 5 characters-per-word = 150 characters-per-minute
(1 min / 150 chars) * (60 sec / min) = 60/150 = .4 seconds-per-character.
.4 seconds * 1,000,000 instructions / sec = 400,000 instructions executed per character typed.
6.2 Explain why a DMA channel would or would not be useful in a computer without an interrupt-based
I/O system.
A DMA channel would be much less useful in a computer without an interrupt-based I/O system.
Pages:
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522