Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Consider a 100Mhz microprocessor connected to a printer that takes 10ms to print

ID: 3711055 • Letter: C

Question

Consider a 100Mhz microprocessor connected to a printer that takes 10ms to print a character. We wish to implement polling to do printing on this printer, as shown in the diagram below:

If you are printing 250 characters, how many cycles are wasted on polling?

String to be printed User space Printed page Printed page ABCD EFGH AB Next Next Kernel space ABCD EFGH ABCD EFGH copy_fromuser(buffer, p, count) for i 0; count; ++) /* p is the kernel bufer / while (printer-status-reg != READY) ; *printer_data_register p[l; loop on every character/ /* loop until ready */ /*output one character/ return_to user();

Explanation / Answer

Answer: 249 cycles are waste on polling

Explanation :

while(*printer_status_reg != READY); we are checking it everytime,

Instead we could load all characterin the Kernel Space and Check once (

printer_status_reg == READY)

And print all 250 character one at a sort.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote