2. Chapter 11
MIMD Programming Languages
• 11.1 Concurrent Pascal
• 11.2 Communicating Sequential Process CSP
• 11.3 occam
• 11.4 Ada
• 11.5 Sequent C
• 11.6 Linda,
• 11.7 Modular P
3. Introduction
• Only procedural, parallel programming languages for
MIMD systems will be dealt with in this chapter.
•
• Non-procedural parallel (functional and logic languages)
are treated in next chapters.
•
• The most important concepts are discussed and further
explained with programming examples (The individual
languages are only briefly introduced).
4. 11.1 Concurrent Pascal
• The language is a parallel extension of the sequential
programming language (Except OCCAM, all others are an
extend of an existing sequential language).
• The Most important parallel concepts of concurrent Pascal
are:
• 1. The introduction of the process concept (declaration of
process types and corresponding variables, the processes).
• 2. The synchronization of parallel processes via monitors
with conditions (here called queue).
• 3. The introduction of classes (abstract data types).
5. 11.2 Communicating sequential
process CSP
• A system consist of a number of parallel processes.
• Each process is executed sequentially, and they
communicate via data exchanges as necessary.
• Since all synchronization and communication between
processes in CSP is handled via messages, there is no need
for semaphores or monitors (Guarded command for
communication).
6. Parallel language constructs
• Page 95
•
• Program (page 95-96)
•
• Program for volume control 1(page 96)
•
• In order to allow a single process to send different
messages to VolCon, the example program has to be
changed considerably.
•
• Program for volume control 2 (page 97)
7.
8.
9.
10.
11. 11.3 occam
• The occam language is a direct commercial successor of
CSP, and was developed by Inmos for transputers.
• Parallel Language construct.
• Page 98
• v := e assign the value of expression e to variable v,
• c ! e output the value of expression e to channel c,
• c ? v input from channel c to variable v.
• Alan figure 7
• SEQ sequential execution: component executed one after
the other.
12.
13.
14.
15.
16.
17.
18. • PAR parallel execution: components executed
concurrently.
• ALT alternative execution: first component ready is
executed.
• Alan page 15.
• Example (page 99).
•
• Page 99-100
•
• Program for volume control
19.
20.
21.
22.
23.
24.
25. 11.4 Ada
• Language Constructs
•
• Page 101
•
• Program for volume control (page 102)
•
• Example Program(page 103)
26.
27.
28.
29.
30. 11.5 Sequent C
• Parallel library functions
• Page 104,
• Sample Program page 104
•
• Figure 9.1 shows execution of the sample program.
• Example of iteration inside of Child Processes:
•
• Program page 105.
•
• Output of the Program page 106.
31.
32.
33.
34.
35.
36. 11.6 Linda
• Parallel Operations
• Page 106 - 107
• Figure 9.2 shows Linda’s tuple space
• Example program page 108-109
• When executing a read (RD) or input (IN) operation, three
different case can arise
• Cases page 109
• Implementation of semaphore by using a Landa primitive
• Initialization OUT (“sema”);
37.
38.
39.
40.
41.
42. • Pi
• ….
• IN (“sema”);
• <critical section>
• OUT (“sema”);
• ….
•
• Program prime number generation page 109-110
• Figure 9.3 shows tuples from the prime number program.
• Pros and cons of Linda2s parallel language concepts
• Page 110-111
43.
44.
45.
46. 11.7 Modula P
• In Modula-P there are three types of module :
• Processor Modules: The initialization of whole process
system is being started in the processor module.
• High level modules (regular modules): At this level,
individual processes can be declared and started.
• Low level modules: This is lower level of a program is
only required when real time programming or machine
control must be carried out via direct memory addressing.
• Page 111-112 (gerekli deği)
• Parallel language construct
• Page 112-113.
• Example of monitor page 113.
• Programs page 114-115.