Successfully reported this slideshow.
Your SlideShare is downloading. ×

More Related Content



  1. 1. Unit-4 Parallelism Chapter - 9
  2. 2. <ul><li>Executing two or more operations at the same time is known as Parallelism . </li></ul><ul><li>Goals of Parallelism: </li></ul><ul><li>The purpose of parallel processing is to speedup the computer processing capability or in words, it increases the computational speed. </li></ul><ul><li>Increases throughput, i.e. amount of processing that can be accomplished during a given interval of time. </li></ul><ul><li>Improves the performance of the computer for a given clock speed. </li></ul><ul><li>Two or more ALUs in CPU can work concurrently to increase throughput. </li></ul><ul><li>The system may have two or more processors operating concurrently. </li></ul>
  3. 3. Exploitation of Concurrency: <ul><li>Techniques of Concurrency: </li></ul><ul><li>Overlap : execution of multiple operations by heterogenous functional units. </li></ul><ul><li>Parallelism : execution of multiple operations by homogenous functional units. </li></ul><ul><li>Throughput Enhancement </li></ul><ul><li>A computer’s performance is measured by the time taken for executing a program. </li></ul><ul><li>The program execution involves performing instruction cycles, which includes two types of operations: </li></ul><ul><li>Internal Micro-operations: performed inside the hardware functional units such as the processor, memory, I/O etc. </li></ul><ul><li>Transfer of information: between different functional hardware units for Instruction fetch, operand fetch, I/O operation etc. </li></ul>
  4. 4. <ul><li>Types of Parallelism: </li></ul><ul><li>Instruction Level Parallelism (ILP) </li></ul><ul><li>Pipelining </li></ul><ul><li>Superscalar </li></ul><ul><li>Processor Level Parallelism </li></ul><ul><li>Array Computer </li></ul><ul><li>Multiprocessor </li></ul>
  5. 5. Instruction Pipeline (sec-9.4) <ul><li>An instruction pipeline reads consecutive instructions from memory while previous instructions are being executed in other segments. </li></ul><ul><li>Computer needs to process each instruction with the following sequence of steps. </li></ul><ul><li>Fetch the instruction from memory </li></ul><ul><li>Decode the instruction </li></ul><ul><li>Calculate the effective address </li></ul><ul><li>Fetch the operands from memory </li></ul><ul><li>Execute the instruction </li></ul><ul><li>Store the result in the proper place </li></ul>
  6. 6. Four segment CPU Pipeline Fetch Instruction Decode & calculate effective Address Branch? Fetch Operand Execute Instruction Interrupt? Interrupt handling Update PC Empty Pipe Yes No No Yes
  7. 7. Timing of Instruction Pipeline Instruction Step 1 2 3 4 5 6 7 8 9 10 11 12 13 1 FI DA FO EX 2 FI DA FO 3 FI DA 4 FI - - FI DA FO EX 5 - - - FI DA FO EX 6 FI DA FO EX 7 FI DA FO EX
  8. 8. Pipeline Conflicts <ul><li>Resource conflicts caused by access to memory by two segments at the same time. These may be resolved by using separate instruction and data memories. </li></ul><ul><li>Data Dependency conflicts arise when an instruction depends on the result of a previous instruction, but this result is not yet available. </li></ul><ul><li>Branch Difficulties arise from branch and other instructions that change the value of PC. </li></ul>
  9. 9. Instruction-level parallelism (ILP) <ul><li>Instruction-level parallelism (ILP) is a measure of how many of the operations in a computer program can be performed simultaneously. </li></ul><ul><li>Micro-architectural techniques that are used to exploit ILP include: </li></ul><ul><li>Instruction pipelining where the execution of multiple instructions can be partially overlapped. </li></ul><ul><li>Superscalar execution in which multiple execution units are used to execute multiple instructions in parallel. In typical superscalar processors, the instructions executing simultaneously are adjacent in the original program order. </li></ul>
  10. 10. <ul><li>A superscalar CPU architecture implements a form of parallelism called instruction-level parallelism within a single processor. </li></ul><ul><li>It therefore allows faster CPU throughput than would otherwise be possible at a given clock rate . </li></ul><ul><li>A superscalar processor executes more than one instruction during a clock cycle by simultaneously dispatching multiple instructions to redundant functional units on the processor. </li></ul><ul><li>Each functional unit is not a separate CPU core but an execution resource within a single CPU such as an arithmetic logic unit , a bit shifter, or a multiplier . </li></ul><ul><li>While a superscalar CPU is typically also pipelined . </li></ul><ul><li>Pipelining and Superscalar architecture are considered different performance enhancement techniques. </li></ul>
  11. 11. The superscalar technique is associated with several identifying characteristics (within a given CPU core): <ul><li>Instructions are issued from a sequential instruction stream. </li></ul><ul><li>CPU hardware dynamically checks for data dependencies between instructions at run time (versus software checking at compile time ) </li></ul><ul><li>The CPU accepts multiple instructions per clock cycle. </li></ul><ul><li>Available performance improvement from superscalar techniques is limited by two key areas: </li></ul><ul><li>The degree of intrinsic parallelism in the instruction stream, i.e. limited amount of instruction-level parallelism, and </li></ul><ul><li>The complexity and time cost of the dispatcher and associated dependency checking logic. </li></ul><ul><li>The branch instruction processing. </li></ul>
  12. 12. Processor Level Parallelism <ul><li>Multiprocessing is the use of two or more central processing units (CPUs) within a single computer system. </li></ul><ul><li>The term also refers to the ability of a system to support more than one processor and/or the ability to allocate tasks between them. </li></ul><ul><li>Multiprocessing sometimes refers to the execution of multiple concurrent software processes in a system as opposed to a single process at any one instant. </li></ul><ul><li>The terms multitasking or multiprogramming are more appropriate to describe this concept, which is implemented mostly in software, whereas multiprocessing is more appropriate to describe the use of multiple hardware CPUs. </li></ul><ul><li>A system can be both multiprocessing and multiprogramming, only one of the two, or neither of the two. </li></ul><ul><li>In a multiprocessing system, all CPUs may be equal, or some may be reserved for special purposes. </li></ul>
  13. 13. <ul><li>In multiprocessing, the processors can be used to execute a single sequence of instructions in multiple contexts </li></ul><ul><li>In a single instruction stream, single data stream or SISD, one processor sequentially processes instructions, each instruction processes one data item. </li></ul><ul><li>S ingle-instruction, multiple-data or SIMD, often used in vector processing </li></ul><ul><li>Multiple sequences of instructions in a single context multiple-instruction, single-data or MISD, used to describe pipelined processors. </li></ul><ul><li>Multiple sequences of instructions in multiple contexts ( multiple-instruction, multiple-data or MIMD . </li></ul>
  14. 14. Amdahl's law <ul><li>Amdahl's law , also known as Amdahl's argument , is named after computer architect Gene Amdahl , and is used to find the maximum expected improvement to an overall system when only part of the system is improved. </li></ul><ul><li>It is often used in parallel computing to predict the theoretical maximum speedup using multiple processors. </li></ul><ul><li>The speedup of a program using multiple processors in parallel computing is limited by the time needed for the sequential fraction of the program. </li></ul><ul><li>Amdahl's law is a model for the relationship between the expected speedup of parallelized implementations of an algorithm relative to the serial algorithm, under the assumption that the problem size remains the same when parallelized. </li></ul><ul><li>The law is concerned with the speedup achievable from an improvement to a computation that affects a proportion P of that computation where the improvement has a speedup of S . (For example, if an improvement can speed up 30% of the computation, P will be 0.3; if the improvement makes the portion affected twice as fast, S will be 2.) </li></ul>
  15. 15. <ul><li>Amdahl's law states that the overall speedup of applying the improvement will be: </li></ul><ul><li>Old Running Time = 1 </li></ul><ul><li>New Running Time (1-P)+P/S </li></ul><ul><li>To see how this formula was derived, assume that the running time of the old computation was 1, for some unit of time. The running time of the new computation will be the length of time the unimproved fraction takes, (1 − P ), plus the length of time the improved fraction takes. </li></ul><ul><li>The length of time for the improved part of the computation is the length of the improved part's former running time divided by the speedup, making the length of time of the improved part P / S . The final speedup is computed by dividing the old running time by the new running time, which is what the above formula does. </li></ul><ul><li>In the case of parallelization, Amdahl's law states that if P is the proportion of a program that can be made parallel (i.e. benefit from parallelization), and (1 − P ) is the proportion that cannot be parallelized (remains serial), then the maximum speedup that can be achieved by using N processors is : </li></ul><ul><li>1/(1-P)+P/N. </li></ul><ul><li>P can be estimated by using the measured speedup SU on a specific number of processors NP using </li></ul><ul><li>P estimated = (1/SU – 1) / (1/NP-1). </li></ul><ul><li>P estimated in this way can then be used in Amdahl's law to predict speedup for a different number of processors. </li></ul>
  16. 17. Basic Page Replacement <ul><li>Find the location of the desired page on disk </li></ul><ul><li>Find a free frame: - If there is a free frame, use it - If there is no free frame, use a page replacement algorithm to select a victim frame </li></ul><ul><li>Bring the desired page into the (newly) free frame; update the page and frame tables </li></ul><ul><li>Restart the process </li></ul>
  17. 18. Page Replacement : OPT (Optimal Policy) <ul><li>Replace page that will not be used for longest period of time. It requires future knowledge. </li></ul><ul><li>3 frames example </li></ul><ul><li>Adv : Reduces Page Faults </li></ul><ul><li>Disadv : It is difficult to implement as future knowledge of reference string is required. </li></ul>
  18. 19. <ul><li>CAO Model Question Paper </li></ul><ul><li>Unit – 2 </li></ul><ul><li>Q:1 Discuss hardwired control design method. </li></ul><ul><li>Q:2 Explain the concept of Micro programmed Sequencer. </li></ul><ul><li>Q:3 Explain five stages instruction cycle with the help of flowchart. </li></ul><ul><li>Q:4 What is Content Addressable Memory? Explain the match logic in CAM. </li></ul><ul><li>Q:5 What do you mean by “Next Address Generator” present in a Microprogrammed Control Unit? Explain briefly along with its block diagram. </li></ul><ul><li>Q:6 Explain 2D RAM organization with suitable diagram. (J. P. Hayes-Sec-6.1.2,fig 6.8, fig 6.13) </li></ul>
  19. 20. CAO Model Question Paper Unit – 3 <ul><li>Q: 1 Discuss the principle of Locality of Reference associated with the Memory Hierarchy. </li></ul><ul><li>Q: 2 What are the reasons for using Virtual memory? Distinguish between Paging and Segmentation. </li></ul><ul><li>Q: 3 What are LRU and OPT Policies of page replacement? Compare them. </li></ul><ul><li>Q: 4 Explain working of a cache memory. What are the relative advantages and disadvantages of direct and Associative mapping of cache memory? </li></ul>
  20. 21. Modes of transfer (11.4) <ul><li>Data transfer between the central computer and the I/O devices may be handled in a variety of modes. </li></ul><ul><li>The modes of transfer are: </li></ul><ul><li>Programmed I/O. </li></ul><ul><li>Interrupt-initiated I/O </li></ul><ul><li>Direct memory access (DMA) </li></ul>
  21. 22. Programmed I/O <ul><li>Programmed I/O operations are the result of I/O instructions written in the computer program. </li></ul><ul><li>Each data item transfer is initiated by an instruction in the program. </li></ul><ul><li>Usually, the transfer is to and from CPU register and peripheral. </li></ul><ul><li>Other instructions are needed to transfer the data to and from CPU and memory. </li></ul><ul><li>Transferring data under program control requires constant monitoring of the peripheral by the CPU . </li></ul><ul><li>Once a data transfer is initiated, the CPU is required to monitor the interface to see when a transfer can again be made. </li></ul><ul><li>It is up to the programmed instructions executed in the CPU to keep close tabs on everything that is taking place in the interface unit and the I/O device. </li></ul><ul><li>In this method, the CPU stays in a program loop until the I/O unit indicates that it is ready for data transfer. </li></ul><ul><li>This is a time-consuming process since it keeps the processor busy needlessly. </li></ul>
  22. 23. Interrupt Initiated IO <ul><li>In the programmed I/O method, the CPU stays in a program loop until the I/O unit indicates that it is ready for data transfer. </li></ul><ul><li>This is a time-consuming process since it keeps the processor busy needlessly. </li></ul><ul><li>It can be avoided by using interrupt facility and special commands to inform the interface to issue an interrupt request signal when the data are available from the device . </li></ul><ul><li>In the mean-time the CPU can proceed to execute another program. </li></ul><ul><li>The interface meanwhile keeps monitoring the device. </li></ul><ul><li>When the interface determines that the device is ready for the data transfer, it generates an interrupt request to the computer. </li></ul><ul><li>Upon detecting the external interrupt signal, the CPU momentarily stops the task it is processing, branches to a service program to process the I/O transfer, and then returns to the task it was originally performing. </li></ul>
  23. 24. Types of Interrupt <ul><li>External interrupts </li></ul><ul><li>Internal interrupts </li></ul><ul><li>Software interrupts </li></ul><ul><li>External interrupts come from I/O devices, from a timing device, from a circuit monitoring the power supply, or from any other external source. For example: Timeout interrupt </li></ul><ul><li>Internal interrupts arise from illegal or erroneous use of an instruction or data. Internal interrupts are also called traps . For example, attempt to divide by zero. </li></ul>
  24. 25. <ul><li>The difference between internal interrupt and external interrupt </li></ul><ul><li>The internal interrupt is initiated by some exceptional condition caused by program itself rather than by an external event. </li></ul><ul><li>External interrupts depend on external conditions that are independent of the program. </li></ul><ul><li>Software Interrupt: A software interrupt is initiated by executing an instruction. Software interrupt is a special call instruction that behaves like an interrupt rather than a subroutine call. The most common use of a software interrupt is associated with a supervisor call instruction. This instruction provides means for switching from a CPU user mode to the supervisor mode. </li></ul>
  25. 26. DMA (Direct Memory Access – 11.6 ) <ul><li>Direct memory access is an I/O technique used for high speed data transfer. </li></ul><ul><li>In DMA, the interface transfers data into and out of the memory unit through the memory bus . </li></ul><ul><li>In DMA, the CPU releases the control of the buses to a device called a DMA controller. </li></ul><ul><li>Removing the CPU from the path and letting the peripheral device manage the memory buses directly would improve the speed of transfer. </li></ul><ul><li>The CPU initiates the transfer by supplying the interface with the starting address and the number of words needed to be transferred and then proceeds to execute other tasks. </li></ul><ul><li>When the transfer is made, the DMA requests memory cycles through the memory bus. </li></ul><ul><li>When the request is granted by the memory controller, the DMA transfers the data directly into memory. </li></ul><ul><li>The CPU merely delays its memory access operation to allow the direct memory I/O transfer. </li></ul>
  26. 27. <ul><li>Many computers combine the interface logic with the requirements for direct memory access into one unit and call it an I/O processor ( IOP). </li></ul><ul><li>A DMA controller takes over the memory buses to manage the transfer directly between the I/O device and memory using 2 special control signals BR And BG . </li></ul><ul><li>The BR (bus request) output signal is used by the DMA controller to the CPU to take control of memory buses. </li></ul><ul><li>The CPU then activates the BG (BUS GRANT) signal to inform the external DMA that the buses are in high-impedance state. </li></ul><ul><li>Then DMA takes the control of memory buses. </li></ul><ul><li>DMA CONTROLLER: It needs the usual circuit of an interface to communicate with the CPU and I/O device. </li></ul>
  27. 28. <ul><li>CPU bus signals for DMA Transfer </li></ul>BR DBUS ABUS CPU RD BG WR
  28. 29. <ul><li>Block diagram of DMA Controller </li></ul>Address Bus buffers Address registers Word count Register Control Register DS RS DMA RD Control logic WR BR BG Interrupt DMA Req DMA ACK To IO Device Data Bus buffers Data bus Address bus
  29. 30. CAO Model Question Paper Unit – 4 <ul><li>Q:1 State Amdahl’s law. Discuss its significance. </li></ul><ul><li>Q:2 Explain 3 major types of instructions. </li></ul><ul><li>Q:3 Explain the concept of Memory Hierarchy. </li></ul><ul><li>Q:4 Write a note on Computer Registers </li></ul><ul><li>Q:5 Short Note on: </li></ul><ul><li>DMA </li></ul><ul><li>Priority Interrupt </li></ul><ul><li>Superscalar Processing </li></ul>