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

what is concurrent programming m ben ari principles of
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 1

CoSc 450: Programming Paradigms

What is Concurrent Programming?

01

slide-2
SLIDE 2
  • M. Ben-Ari

Principles of Concurrent and Distributed Programming

Second Edition Addison-Wesley, 2006

c ≠ Mordechai Ben-Ari 2006

slide-3
SLIDE 3

Computer Time

ª

  • time (nanoseconds) !

100 200 300 400 500

  • M. Ben-Ari. Principles of Concurrent and Distributed Programming, Second edition c

≠ M. Ben-Ari 2006 Slide 1.1

slide-4
SLIDE 4

Human Time

ª

  • time (seconds) !

100 200 300 400 500

  • M. Ben-Ari. Principles of Concurrent and Distributed Programming, Second edition c

≠ M. Ben-Ari 2006 Slide 1.2

slide-5
SLIDE 5

Loader Loader Job 1 Job 2 Loader

Figure 8.4

Primitive, one-job-at-a-time system

slide-6
SLIDE 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)

slide-7
SLIDE 7

Asynchronous interrupts

  • Time outs
  • I/O completions
slide-8
SLIDE 8

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

slide-9
SLIDE 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.

slide-10
SLIDE 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)

slide-11
SLIDE 11

Process ID CPU time PC SP Process ID CPU time PC SP Process ID CPU time PC SP Q

Figure 8.18

slide-12
SLIDE 12

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

Figure 8.19

slide-13
SLIDE 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

slide-14
SLIDE 14

Input device CPU 1 CPU 2 Main memory Output device Bus

Figure 8.20

slide-15
SLIDE 15

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