Presentation is loading. Please wait.

Presentation is loading. Please wait.

Processor Memory Processor-memory bus I/O Device Bus Adapter I/O Device I/O Device Bus Adapter I/O Device I/O Device Expansion bus I/O Bus.

Similar presentations


Presentation on theme: "Processor Memory Processor-memory bus I/O Device Bus Adapter I/O Device I/O Device Bus Adapter I/O Device I/O Device Expansion bus I/O Bus."— Presentation transcript:

1

2 Processor Memory Processor-memory bus I/O Device Bus Adapter I/O Device I/O Device Bus Adapter I/O Device I/O Device Expansion bus I/O Bus

3 The Operating System ( OS) controls I/O processes

4 1.OS contains the low level programs that control the I/O device. ( Device Drivers, usually provided by the device manufacturer)

5 The Operating System ( OS) controls I/O processes 1.OS contains the low level programs that control the I/O device. ( Device Drivers, usually provided by the device manufacturer) 2.Limits access to Users for Protection and Resource Scheduling. ( Some programs violate this)

6 The Operating System ( OS) controls I/O processes 1.Contains the low level programs that control the I/O device. ( Device Drivers, usually provided by the device manufacturer) 2.Limits access to Users for Protection and Resource Scheduling. ( Some programs violate this) 3.OS must give commands to devices and reads status from Devices

7 The Operating System ( OS) controls I/O processes 1.Contains the low level programs that control the I/O device. ( Device Drivers, usually provided by the device manufacturer) 2.Limits access to Users for Protection and Resource Scheduling. ( Some programs violate this) 3.OS must give commands to devices and read status from Devices 4. Devices must notify the OS of changes

8 The Operating System ( OS) controls I/O processes 1.Contains the low level programs that control the I/O device. ( Device Drivers, usually provided by the device manufacturer) 2.Limits access to Users for Protection and Resource Scheduling. ( Some programs violate this) 3.OS must give commands to devices and read status from Devices 4. Devices must notify the OS of changes 5. Data must be transferred between memory and an I/O device

9 OS must give commands to devices and read status from Devices 1.Special I/O instructions Store Register xx in Device Address yy

10 OS must give commands to devices and read status from Devices 1.Special I/O instructions Store Register xx in Device Address yy Device address is put on I/O control lines and the data is put on the I/O data lines

11 OS must give commands to devices and read status from Devices 1.Special I/O instructions Store Register xx in Device Address yy Device address is put on I/O control lines and the data is put on the I/O data lines Write from Device Address yy to a Register or Memory location

12 OS must give commands to devices and read status from Devices 1.Special I/O instructions Store Register xx in Device Address yy Device address is put on I/O control lines and the data is put on the I/O data lines Write from Device Address yy to a Register or Memory location Constraining for unknown devices

13 OS must give commands to devices and read status from Devices 1.Special I/O instructions 2.Memory Mapped I/O Memory Address Space is assigned to Devices.

14 OS must give commands to devices and read status from Devices 1.Special I/O instructions 2.Memory Mapped I/O Memory Address Space is assigned to Devices. A Write to that address goes to a device controller register and not to the memory ( Commands)

15 OS must give commands to devices and read status from Devices 1.Special I/O instructions 2.Memory Mapped I/O Memory Address Space is assigned to Devices. A Write to that address goes to a device controller register and not to the memory ( Commands) A Read of that address comes from a device controller register and not the memory ( Status)

16 OS must give commands to devices and read status from Devices 1.Special I/O instructions 2.Memory Mapped I/O Memory Address Space is assigned to Devices. A Write to that address goes to a device controller register and not to the memory ( Commands) A Read of that address comes from a device controller register and not the memory ( Status) Memory Map defined by software for the installed I/O controllers ( Flexibility and Expandability)

17 Devices must notify the OS of changes 1.Polling Processor periodically reads the status of the I/O Ex: key depressed, print complete, buffer full

18 Devices must notify the OS of changes 1.Polling Processor periodically reads the status of the I/O Ex: key depressed, print complete, buffer full Processor is in complete control

19 Devices must notify the OS of changes 1.Polling Processor periodically reads the status of the I/O Ex: key depressed, print complete, buffer full Processor is in complete control Polling loop in OS is overhead

20 Devices must notify the OS of changes 1.Polling Processor periodically reads the status of the I/O Ex: key depressed, print complete, buffer full Processor is in complete control Polling loop in OS is overhead Effective on slow devices that initiate I/O Ex: keyboard and Mouse

21 Devices must notify the OS of changes 1.Polling Processor periodically reads the status of the I/O Ex: key depressed, print complete, buffer full Processor is in complete control Polling loop in OS is overhead Effective on slow devices that initiate I/O Ex: keyboard and Mouse

22 Devices must notify the OS of changes 1.Polling Processor periodically reads the status of the I/O Ex: key depressed, print complete, buffer full Processor is in complete control Polling loop in OS is overhead Effective on slow devices that initiate I/O Ex: keyboard and Mouse Not efficient for fast devices

23 Devices must notify the OS of changes 1.Polling 2.Interrupt-driven Device controller asserts interrupt signal line and loads interrupt status register.

24 Devices must notify the OS of changes 1.Polling 2.Interrupt-driven Device controller asserts interrupt signal line and loads interrupt status register. Processor checks for interrupt at the start of each new instruction ( in parallel)

25 Devices must notify the OS of changes 1.Polling 2.Interrupt-driven Device controller asserts interrupt signal line and loads interrupt status register. Processor checks for interrupt at the start of each new instruction ( in parallel) Processor recognizes interrupts on a priority basis

26 Devices must notify the OS of changes 1.Polling 2.Interrupt-driven Device controller asserts interrupt signal line and loads interrupt status register. Processor checks for interrupt at the start of each new instruction ( in parallel) Processor recognizes interrupts on a priority basis OS services the interrupt based on the Cause register or vectored interrupt

27 Devices must notify the OS of changes 1.Polling 2.Interrupt-driven Device controller asserts interrupt signal line and loads interrupt status register. Processor checks for interrupt at the start of each new instruction ( in parallel) Processor recognizes interrupts on a priority basis OS services the interrupt based on the Cause register or vectored interrupt Enables a device to signal that data is ready to be transferred or an operation has been completed

28 The Operating System ( OS) controls I/O processes 1.Contains the low level programs that control the I/O device. ( Device Drivers, usually provided by the device manufacturer) 2.Limits access to Users for Protection and Resource Scheduling. ( Some programs violate this) 3.OS must give commands to devices and read status from Devices 4. Devices must notify the OS of changes 5. Data must be transferred between memory and an I/O device

29 Data must be transferred between memory and an I/O device 1.Processor Control Data and Status transferred by Special Instruction or Memory Mapped I/O

30 Data must be transferred between memory and an I/O device 1.Processor Control Data and Status transferred by Special Instruction or Memory Mapped I/O Polling or Interrupts are used

31 Data must be transferred between memory and an I/O device 1.Processor Control Data and Status transferred by Special Instruction or Memory Mapped I/O Polling or Interrupts are used Fast device with blocks of data can excessively load processor Ex: hard disk and display

32 Data must be transferred between memory and an I/O device 1.Processor Control 2.Direct Memory Access ( DMA) I/O controller transfers block of data between device and memory independent of the processor

33 Data must be transferred between memory and an I/O device 1.Processor Control 2.Direct Memory Access ( DMA) I/O controller transfers block of data between device and memory independent of the processor DMA transfer process 1.Processor initiates the device operation ( memory address, number of bytes, enable bus master)

34 Data must be transferred between memory and an I/O device 1.Processor Control 2.Direct Memory Access ( DMA) I/O controller transfers block of data between device and memory independent of the processor DMA transfer process 1.Processor initiates the device operation ( memory address, number of bytes, enable bus master) 2.DMA controller directly transfers block of data between memory and device, under arbitration

35 Data must be transferred between memory and an I/O device 1.Processor Control 2.Direct Memory Access ( DMA) I/O controller transfers block of data between device and memory independent of the processor DMA transfer process 1.Processor initiates the device operation ( memory address, number of bytes, enable bus master) 2.DMA controller directly transfers block of data between memory and device, under arbitration 3.DMA sends interrupt to notify completion or error

36 Data must be transferred between memory and an I/O device 1.Processor Control 2.Direct Memory Access ( DMA) I/O controller transfers block of data between device and memory independent of the processor DMA transfer process 1.Processor initiates the device operation ( memory address, number of bytes, enable bus master) 2.DMA controller directly transfers block of data between memory and device, under arbitration 3.DMA sends interrupt to notify completion or error Enables the processor to continue to operate during data transfer

37 CPU/ Memory Control Data I/O 1 I/O 2 I/O 3 I/O bus A bus master controls access to the bus

38 CPU/ Memory Control Data I/O 1 I/O 2 I/O 3 I/O bus A bus master controls access to the bus Slaves request bus access

39 CPU/ Memory Control Data I/O 1 I/O 2 I/O 3 I/O bus A bus master controls access to the bus Slaves request bus access The bus master generates controls to make the transfer

40 CPU/ Memory Control Data I/O 1 I/O 2 I/O 3 I/O bus A bus master controls access to the bus Slaves request bus access The bus master generates controls to make the transfer The processor is always a bus master and memory is always a slave

41 Typically want multiple bus masters, so need to decide which bus master gets control.

42 Typically want multiple bus masters, so need to decide which bus master gets control. Bus Arbitration Arbitration schemes are used to grant the bus based on: 1.Priority 2.Avoid lockout ( fairness)

43 I/O and Caches 1.Polling or Interrupt- driven I/O under processor control goes through cache ( virtual and performance)

44 I/O and Caches 1.Polling or Interrupt- driven I/O under processor control goes through cache ( virtual and performance) 2.DMA goes direct to main memory Cache coherency problem ( Cache and memory different) Cache flushing with hardware support

45 I/O and Caches 1.Polling or Interrupt- driven I/O under processor control goes through cache ( virtual and performance) 2.DMA goes direct to main memory Cache coherency problem ( Cache and memory different) Cache flushing with hardware support Page boundaries in virtual memory Stay within page boundaries or use virtual addresses

46 Y Counter X counter MOUSE The movement of the Mouse increments or decrements the X and Y counters

47 Y Counter X counter MOUSE The movement of the Mouse increments or decrements the X and Y counters. If the location of the cursor is updated 20 times per second it appears smooth to a human.

48 Y Counter X counter MOUSE The movement of the Mouse increments or decrements the X and Y counters. If the location of the cursor is updated 20 times per second it appears smooth to a human. 1.Poll at 40 times per second. 2. Polling I/O routine takes 800 clock cycles 3.Each counter is 2 Bytes, Sample is 1 Word 4.Clock Rate is 500 MHz GIVEN:

49 1.Poll at 40 times per second. 2. Polling I/O routine takes 800 clock cycles 3.Each counter is 2 Bytes, Sample is 1 Word 4.Clock Rate is 500 MHz GIVEN: MOUSE % Processor Usage? Each Polling Cycle is 1/40 sec Number of clock cycles each polling cycle = 500x10 6 clock cycles/sec * 1/40 sec = 12.5 x 10 6

50 1.Poll at 40 times per second. 2. Polling I/O routine takes 800 clock cycles 3.Each counter is 2 Bytes, Sample is 1 Word 4.Clock Rate is 500 MHz GIVEN: MOUSE % Processor Usage? Each Polling Cycle is 1/40 sec Number of clock cycles each polling cycle = 500x10 6 clock cycles/sec * 1/40 sec = 12.5 x 10 6 % Processor Usage = 800 = 64 x 10 -6 = 0.0064 % 12.5 x 10 6

51 1.Poll at 40 times per second. 2. Polling I/O routine takes 800 clock cycles 3.Each counter is 2 Bytes, Sample is 1 Word 4.Clock Rate is 500 MHz GIVEN: MOUSE % Processor Usage? Each Polling Cycle is 1/40 sec Number of clock cycles each polling cycle = 500x10 6 clock cycles/sec * 1/40 sec = 12.5 x 10 6 % Processor Usage = 500 = 40 x 10 -6 = 0.004 % 12.5 x 10 6 Transfer Rate = 4 bytes * 40 times/ sec = 160 bytes / sec

52 HARD DRIVE Platters 6 Surfaces and Heads Tracks or Cylinders Sectors

53 HARD DRIVE Platters 6 Surfaces and Heads Tracks or Cylinders Sectors Seek Time- Move Head to Track - Min, Max, Ave.

54 HARD DRIVE Platters 6 Surfaces and Heads Tracks or Cylinders Sectors Seek Time- Move Head to Track - Min, Max, Ave. Rotational latency – Time for the sector to rotate to the Head – Average is ½ rotation time

55 HARD DRIVE Given: Average Seek Time = 10 ms Rotational speed = 5400 RPM Sector size = 512 bytes Data Rate = 5 MBpsec What is the average transfer rate?

56 HARD DRIVE Platters 6 Surfaces and Heads Tracks or Cylinders Sectors Seek Time- Move Head to Track - Min, Max, Ave. Rotational latency – Time for the sector to rotate to the Head – Average is ½ rotation time

57 HARD DRIVE Given: Average Seek Time = 10 ms Rotational speed = 5400 RPM Sector size = 512 bytes Data Rate = 5 MBps What is the average transfer rate from the disk? Time to transfer a sector = 10 ms + ½ (60 sec/min) + 512 bytes 5400 rev/min 5 x 10 6 bytes/sec = 10 + 5.56 + 0.102 ms = 15.67 ms

58 HARD DRIVE Given: Average Seek Time = 10 ms Rotational speed = 5400 RPM Sector size = 512 bytes Data Rate = 5 MBps What is the average transfer rate from the disk? Time to transfer a sector = 10 ms + ½ (60 sec/min) + 512 bytes 5400 rev/min 5 x 10 6 bytes/sec = 10 + 5.56 + 0.102 ms = 15.67 ms Average transfer rate = 512 bytes = 32.7 KBps from the disk 15.67ms

59 HARD DRIVE What is the time to transfer 4 KB from the disk under DMA? Given: 1. OS requires 1000 clock cycles for initial set up and 500 clock cycles to handle completion interrupt 2. Clock is 500 Mhz 3. Average transfer rate from the disk is 32.7 KBps

60 HARD DRIVE What is the time to transfer 4 KB from the disk under DMA? Given: 1. OS requires 1000 clock cycles for initial set up and 500 clock cycles to handle completion interrupt 2. Clock is 500 MHz 3. Average transfer rate from the disk is 32.7 KBps Transfer time for 4 KB = 1000 clocks + 4 K B + 500 clocks 500 MHz 32.7 KBps 500 MHz

61 HARD DRIVE What is the time to transfer 4 KB from the disk under DMA? Given: 1. OS requires 1000 clock cycles for initial set up and 500 clock cycles to handle completion interrupt 2. Clock is 500 MHz 3. Average transfer rate from the disk is 32.7 KBps Transfer time for 4 KB = 1000 clocks + 4 K B + 500 clocks 500 MHz 32.7 KBps 500 MHz = 0.002 ms + 122.32 ms + 0.001 ms

62 HARD DRIVE What is the % Processor usage for this transfer? Given: 1. OS requires 1000 clock cycles for initial set up and 500 clock cycles to handle completion interrupt 2. Clock is 500 MHz 3. Average transfer rate from the disk is 32.7 KBps 4. Time to transfer 4 KB = 122.32 ms

63 HARD DRIVE What is the % Processor usage for this transfer? Given: 1. OS requires 1000 clock cycles for initial set up and 500 clock cycles to handle completion interrupt 2. Clock is 500 MHz 3. Average transfer rate from the disk is 32.7 KBps 4. Time to transfer 4 KB = 122.32 ms Processor time = 1000 + 500 clocks = 0.003 ms 500 MHz

64 HARD DRIVE What is the % Processor usage for this transfer? Given: 1. OS requires 1000 clock cycles for initial set up and 500 clock cycles to handle completion interrupt 2. Clock is 500 MHz 3. Average transfer rate from the disk is 32.7 KBps 4. Time to transfer 4 KB = 122.32 ms Processor time = 1000 + 500 clocks = 0.003 ms 500 MHz % Processor usage = 0.003 = 0.0025 % 122.32 Assuming no memory contention

65 A Optical disk transfers data to the processor in 32 bit units and has a data rate of 1M Bytes per sec. No data transfers can be missed. Consider a computer with a 900 MHz clock rate and a polling loop of 1500 clock cycles that includes the cycles to transfer a 32 bit unit. What is the required polling rate to not miss any data?

66 A Optical disk transfers data to the processor in 32 bit units and has a data rate of 1M Bytes per sec. No data transfers can be missed. Consider a computer with a 900 MHz clock rate and a polling loop of 1500 clock cycles that includes the cycles to transfer a 32 bit unit. What is the required polling rate to not miss any data? Polling Rate = 1M B/s * 8 bits/Byte = 0.25 M units/sec 32 b/sample

67 What is the % Processor Usage?

68 Polling period = 1/ 0.25 M = 4 microsec

69 What is the % Processor Usage? Polling period = 1/ 0.25 M = 4 microsec Processor Time = 1500 Clk Cycles = 1.67 microsec 900 M Hz

70 What is the % Processor Usage? Polling period = 1/ 0.25 M = 4 microsec Processor Time = 1500 Clk Cycles = 1.67 microsec 900 M Hz % Processor Usage = 1.67 / 4 = 41.75%

71 Consider a interrupt driven I/O instead of polling with a interrupt routine of 2000 clock cycles that includes the cycles to transfer a 32 bit unit each interrupt. If the optical disk is active transferring data 5% of the time, what is the % Processor Usage?

72 Processing time each interrupt = 2000 clock cycles 900 Mhz = 2.222 microsec

73 Consider a interrupt driven I/O instead of polling with a interrupt routine of 2000 clock cycles that includes the cycles to transfer a 32 bit unit each interrupt. If the optical disk is active transferring data 5% of the time, what is the % Processor Usage? Processing time each interrupt = 2000 clock cycles 900 Mhz = 2.222 microsec Interrupt period = 32 bits/ unit during transfer 8 bits/byte * 1 M bytes/sec = 4 microsec/transfer

74 Consider a interrupt driven I/O instead of polling with a interrupt routine of 2000 clock cycles that includes the cycles to transfer a 32 bit unit each interrupt. If the optical disk is active transferring data 5% of the time, what is the % Processor Usage? Processing time each interrupt = 2000 clock cycles 900 Mhz = 2.222 microsec Interrupt period = 32 bits/ unit during transfer 8 bits/byte * 1 M bytes/sec = 4 microsec/transfer % Processor usage = 5% * 2.222x10 -6 = 0.125 % 4 x 10 -6

75 Review for Exam III Chapter 7: Memory Hierarchy Organization and operation of Caches: Direct, 2-way and 4-way associative with multiword blocks. Memory Organizations interfacing with Cache

76 Review for Exam III Chapter 7: Memory Hierarchy Organization and operation of Caches: Direct, 2-way, 4-way and Fully associative with multiword blocks. Memory Organizations interfacing with Cache Cache Performance Measures: Ave Memory Access Time, Hit Rate, Miss Rate, Miss Penalty, Effective CPI

77 Review for Exam III Chapter 7: Memory Hierarchy Organization and operation of Caches: Direct, 2-way and 4-way associative with multiword blocks. Memory Organizations interfacing with Cache Cache Performance Measures: Ave Memory Access Time, Hit Rate, Miss Rate, Miss Penalty, Effective CPI Organization and operation of Virtual Memory: Page Tables, TLB, TLB Miss, Page Fault

78 Review for Exam III Chapter 8: Input / Output I/O Busses

79 Review for Exam III Chapter 8: Input / Output I/O Busses Polling, Interrupt Driven, DMA

80 Review for Exam III Chapter 8: Input / Output I/O Busses Polling, Interrupt Driven, DMA Performance: I/O Rates, % Processor Usage


Download ppt "Processor Memory Processor-memory bus I/O Device Bus Adapter I/O Device I/O Device Bus Adapter I/O Device I/O Device Expansion bus I/O Bus."

Similar presentations


Ads by Google