© 2010 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Chapter 15:...

Preview:

Citation preview

© 2010 Pearson Addison-Wesley. All rights reserved.

Addison Wesley is an imprint of

Chapter 15:Multiprocessing Using Processes and Threads

Problem Solving & Program Design in C

Sixth Edition

By Jeri R. Hanly &

Elliot B. Koffman

1-2

1-2

© 2010 Pearson Addison-Wesley. All rights reserved.

Figure 15.1 Three Modes of Processing

1-3

1-3

© 2010 Pearson Addison-Wesley. All rights reserved.

Figure 15.2 Preemptive Multitasking

1-4

1-4

© 2010 Pearson Addison-Wesley. All rights reserved.

Figure 15.3 Context Switching from P1 to P2 to P1

1-5

1-5

© 2010 Pearson Addison-Wesley. All rights reserved.

Figure 15.4 Interprocess Communications Using Half-duplex Pipes

1-6

1-6

© 2010 Pearson Addison-Wesley. All rights reserved.

Figure 15.5 Program to Launch Another Program (parent.c)

continued

1-7

1-7

© 2010 Pearson Addison-Wesley. All rights reserved.

Figure 15.5 Program to Launch Another Program (parent.c) (cont’d)

continued

1-8

1-8

© 2010 Pearson Addison-Wesley. All rights reserved.

Figure 15.5 Program to Launch Another Program (parent.c) (cont’d)

1-9

1-9

© 2010 Pearson Addison-Wesley. All rights reserved.

Figure 15.6 Program to Be Launched from the Program in Figure 15.5 (child.c)

1-10

1-10

© 2010 Pearson Addison-Wesley. All rights reserved.

Figure 15.7 Memory Resources for a Process with Three Threads

1-11

1-11

© 2010 Pearson Addison-Wesley. All rights reserved.

Figure 15.8 Program That Creates a Thread and Updates a Shared Resource (thread.c)

continued

1-12

1-12

© 2010 Pearson Addison-Wesley. All rights reserved.

Figure 15.8 Program That Creates a Thread and Updates a Shared Resource (thread.c) (cont’d)

continued

1-13

1-13

© 2010 Pearson Addison-Wesley. All rights reserved.

Figure 15.8 Program That Creates a Thread and Updates a Shared Resource (thread.c) (cont’d)

1-14

1-14

© 2010 Pearson Addison-Wesley. All rights reserved.

Figure 15.9 Program for Modeling the Delivery and Dispensing of Gasoline (caseused.c)

continued

1-15

1-15

© 2010 Pearson Addison-Wesley. All rights reserved.

Figure 15.9 Program for Modeling the Delivery and Dispensing of Gasoline (casuesed.c) (cont’d)

continued

1-16

1-16

© 2010 Pearson Addison-Wesley. All rights reserved.

Figure 15.9 Program for Modeling the Delivery and Dispensing of Gasoline (casuesed.c) (cont’d)

continued

1-17

1-17

© 2010 Pearson Addison-Wesley. All rights reserved.

Figure 15.9 Program for Modeling the Delivery and Dispensing of Gasoline (casuesed.c) (cont’d)

continued

1-18

1-18

© 2010 Pearson Addison-Wesley. All rights reserved.

Figure 15.9 Program for Modeling the Delivery and Dispensing of Gasoline (casuesed.c) (cont’d)

continued

1-19

1-19

© 2010 Pearson Addison-Wesley. All rights reserved.

Figure 15.9 Program for Modeling the Delivery and Dispensing of Gasoline (casuesed.c) (cont’d)

continued

1-20

1-20

© 2010 Pearson Addison-Wesley. All rights reserved.

Figure 15.9 Program for Modeling the Delivery and Dispensing of Gasoline (casuesed.c) (cont’d)

continued

1-21

1-21

© 2010 Pearson Addison-Wesley. All rights reserved.

Figure 15.9 Program for Modeling the Delivery and Dispensing of Gasoline (casuesed.c) (cont’d)

continued

1-22

1-22

© 2010 Pearson Addison-Wesley. All rights reserved.

Figure 15.9 Program for Modeling the Delivery and Dispensing of Gasoline (casuesed.c) (cont’d)

Recommended