How to calculate percentage of CPU time required to poll each device

Vu Old Solved Programming Based Assignments Codes are Available in this Section.
Post Reply
User avatar
ALI RAZA
★★★★★★★★★★★★★
★★★★★★★★★★★★★
Posts: 177
Joined: Fri Dec 22, 2017 8:10 am
Location: Lahore
Has thanked: 6 times
Been thanked: 7 times
Contact:
Status: Offline

How to calculate percentage of CPU time required to poll each device

Post by ALI RAZA » Wed Oct 03, 2018 7:40 am

Q 1. Suppose we have a 1.5-GHz CPU to which the following three I/O devices are connected:

a. Flash drive that can transfer data in 32-byte chunks with a maximum transfer rate of 16 MB/sec
b. DVD drive which can transfer data in 16-byte chunks with a maximum transfer rate of 16 MB/sec
c. Joystick that needs to be polled 50 times per second

Polling requires 300 instructions for each I/O device. Students are required to compute the percentage of CPU time required to poll each device.

Solution:

a. Flash drive

Time for polling Flash drive = 16 MB/32 bytes
= 524288 accesses per sec


Clock cycles for polling flash drive = 524288 x 300
= 157286400
clock cycles per second


Percentage of CPU time for = 157286400/1.5x109
polling flash drive = 0.1572 x 109/1.5x109
= 0.1048576
= 10.48 %


b. DVD drive

Time for polling DVD drive = 16 MB/16 bytes
= 1048576 accesses per sec


Clock cycles for polling DVD drive = 1048576 x 300
= 314572800
clock cycles per second


Percentage of CPU time for = 314572800/1.5x109
polling DVD drive = 0.3145 x 109/1.5x109
= 0.2097152
= 21%

b. Joystick

Clock cycles for polling Joystick = 50 x 300
= 15000 clock cycles per second


Percentage of CPU time for = 15000 /1.5x109
polling Joystick = 0.000015x 109/1.5x109
= 0.00001
= 0.001%


Q 2. Instead of polling, we want to use interrupts for handling the DVD drive. Keeping in view the DVD drive to be active only 12% of the time, you are required to compute the percentage of CPU time for handling it.

Note: Interrupt and polling requires the same amount of instructions.

Solution:


The DVD drive is active for only = 21% x 12%
12% so it will take only = 2.5% of the CPU time




The End



Post Reply

Last 10 Members Who Visited This Topic

User avatar ALI RAZA (1)

  • Similar Topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 1 guest