Read/write conflicts
Read/write conflicts, commonly termed interlocking in accessing the same shared memory location simultaneously are resolved by one of the following strategies: #Exclusive read exclusive write (EREW)—every memory cell can be read or written to by only one processor at a time #Concurrent read exclusive write (CREW)—multiple processors can read a memory cell but only one can write at a time #Exclusive read concurrent write (ERCW)—never considered #Concurrent read concurrent write (CRCW)—multiple processors can read and write. A CRCW PRAM is sometimes called a concurrent random-access machine. Here, E and C stand for 'exclusive' and 'concurrent' respectively. The read causes no discrepancies while the concurrent write is further defined as: ::''Common''—all processors write the same value; otherwise is illegal ::''Arbitrary''—only one arbitrary attempt is successful, others retire ::''Priority''—processor rank indicates who gets to write ::Another kind of '' array reduction'' operation like SUM, Logical AND or MAX. Several simplifying assumptions are made while considering the development of algorithms for PRAM. They are: # There is no limit on the number of processors in the machine. # Any memory location is uniformly accessible from any processor. # There is no limit on the amount of shared memory in the system. # Resource contention is absent. # The programs written on these machines are, in general, of type SIMD. These kinds of algorithms are useful for understanding the exploitation of concurrency, dividing the original problem into similar sub-problems and solving them in parallel. The introduction of the formal 'P-RAM' model in Wyllie's 1979 thesisWyllie, James CImplementation
PRAM algorithms cannot be parallelized with the combination ofExample code
This is an example of SystemVerilog code which finds the maximum value in the array in only 2 clock cycles. It compares all the combinations of the elements in the array at the first clock, and merges the result at the second clock. It uses CRCW memory;m <= 1
and maxNo <= data /code> are written concurrently. The concurrency causes no conflicts because the algorithm guarantees that the same value is written to the same memory. This code can be run on FPGA
A field-programmable gate array (FPGA) is an integrated circuit designed to be configured by a customer or a designer after manufacturinghence the term '' field-programmable''. The FPGA configuration is generally specified using a hardware de ...
hardware.
module FindMax #(parameter int len = 8)
(input bit clock, resetN, input bit :0data en output bit :0maxNo);
typedef enum bit :0 State;
State state;
bit m en
int i, j;
always_ff @(posedge clock, negedge resetN) begin
if (!resetN) begin
for (i = 0; i < len; i++) m <= 0;
state <= COMPARE;
end else begin
case (state)
COMPARE: begin
for (i = 0; i < len; i++) begin
for (j = 0; j < len; j++) begin
if (data < data m <= 1;
end
end
state <= MERGE;
end
MERGE: begin
for (i = 0; i < len; i++) begin
if (m 0) maxNo <= data
end
state <= DONE;
end
endcase
end
end
endmodule
See also
* Analysis of PRAM algorithms
* Flynn's taxonomy
* Lock-free and wait-free algorithms
* Random-access machine
* Parallel programming model
* XMTC
* Parallel external memory (Model)
References
*
*
*
*
*
*
*
*
External links
Saarland University's prototype PRAM
University Of Maryland's PRAM-On-Chip prototype
This prototype seeks to put many parallel processors and the fabric for inter-connecting them on a single chip
XMTC: PRAM-like Programming - Software release
{{Authority control
Models of computation
Analysis of parallel algorithms