Concepts of Programming Languages

(Sean Pound) #1
13.10 Statement-Level Concurrency 621

As stated previously, F# has the concurrent generic collections of .NET
available to its programs. This can save a great deal of programming effort
when building multithreaded programs that need a shared data structure in the
form of a queue, stack, or bag.

13.10 Statement-Level Concurrency


In this section, we take a brief look at language design for statement-level con-
currency. From the language design point of view, the objective of such designs
is to provide a mechanism that the programmer can use to inform the compiler
of ways it can map the program onto a multiprocessor architecture.^10
In this section, only one collection of linguistic constructs from one lan-
guage for statement-level concurrency is discussed: High-Performance Fortran.

13.10.1 High-Performance Fortran


High-Performance Fortran (HPF; ACM, 1993b) is a collection of extensions
to Fortran 90 that are meant to allow programmers to specify information to
the compiler to help it optimize the execution of programs on multiproces-
sor computers. HPF includes both new specification statements and intrin-
sic, or built-in, subprograms. This section discusses only some of the HPF
statements.
The primary specification statements of HPF are for specifying the num-
ber of processors, the distribution of data over the memories of those proces-
sors, and the alignment of data with other data in terms of memory placement.
The HPF specification statements appear as special comments in a Fortran
program. Each of them is introduced by the prefix !HPF$, where! is the char-
acter used to begin lines of comments in Fortran 90. This prefix makes them
invisible to Fortran 90 compilers but easy for HPF compilers to recognize.
The PROCESSORS specification has the following form:

!HPF$ PROCESSORS procs (n)

This statement is used to specify to the compiler the number of processors that
can be used by the code generated for this program. This information is used
in conjunction with other specifications to tell the compiler how data are to be
distributed to the memories associated with the processors.
The DISTRIBUTE and ALIGN specifications are used to provide informa-
tion to the compiler on machines that do not share memory—that is, each
processor has its own memory. The assumption is that an access by a processor
to its own memory is faster than an access to the memory of another processor.


  1. Although ALGOL 68 included a semaphore type that was meant to deal with statement-
    level concurrency, we do not discuss that application of semaphores here.

Free download pdf