what is concurrent programming m ben ari principles of
play

What is Concurrent Programming? M. Ben-Ari Principles of - PowerPoint PPT Presentation

CoSc 450: Programming Paradigms 01 What is Concurrent Programming? M. Ben-Ari Principles of Concurrent and Distributed Programming Second Edition Addison-Wesley, 2006 c Mordechai Ben-Ari 2006 Computer Time - 0 100 200 300 400


  1. CoSc 450: Programming Paradigms 01 What is Concurrent Programming?

  2. M. Ben-Ari Principles of Concurrent and Distributed Programming Second Edition Addison-Wesley, 2006 c ≠ Mordechai Ben-Ari 2006

  3. Computer Time ª - 0 100 200 300 400 500 time (nanoseconds) ! M. Ben-Ari. Principles of Concurrent and Distributed Programming, Second edition c ≠ M. Ben-Ari 2006 Slide 1.1

  4. Human Time ª - 0 100 200 300 400 500 time (seconds) ! M. Ben-Ari. Principles of Concurrent and Distributed Programming, Second edition c ≠ M. Ben-Ari 2006 Slide 1.2

  5. Figure 8.4 Primitive, one-job-at-a-time system Loader Job 1 Loader Job 2 Loader

  6. Multiprogramming • An operating system that can switch back and forth between processes to keep the CPU busy is called a multiprogramming system • It maintains a queue of process control blocks (PCBs)

  7. Asynchronous interrupts • Time outs • I/O completions

  8. CoSc 450: Programming Paradigms 01 A multiprocessing system I/O request I/O request Time out Time out Time out Time out Time out ... J1 J2 J3 J1 J3 J2 J3

  9. CoSc 450: Programming Paradigms 01 Observation It is impossible for the programmer to predict the statements in the program where the process will be interrupted by the operating system.

  10. CoSc 450: Programming Paradigms 01 Process A process is a program during execution. The state of the process is specified by: • the program listing • the values of all the variables • the next instruction to execute program counter (PC)

  11. Figure 8.18 Q Process ID Process ID Process ID CPU time CPU time CPU time PC PC PC SP SP SP

  12. Figure 8.19 Waiting for I/O I/O complete I/O request Select to run Start Ready Running Finish Create Terminate Time out process process

  13. Multiprocessing • A computer system with more than one physical CPU • Also maintains a queue of PCBs, but more than one process can be running at the same time

  14. Figure 8.20 Input CPU CPU Main Output device 1 2 memory device Bus

  15. CoSc 450: Programming Paradigms 01 The Concurrency Theorem Multiprogramming and multiprocessing are logically equivalent.

Recommend


More recommend