Content deleted Content added
hdg |
Cosmoose312 (talk | contribs) No edit summary Tags: Mobile edit Mobile app edit Android app edit |
||
(36 intermediate revisions by 31 users not shown) | |||
Line 1:
{{Short description|Theoretical programming language for describing concurrent computations}}
{{about|the 1988 theoretical language|other uses|Unity (disambiguation)#Software{{!}}Unity § Software}}
{{multiple issues|
{{technical|date=September 2011}}
{{primary sources|date=July 2019}}
}}
'''UNITY''' is a programming language constructed by [[K. Mani Chandy]] and [[Jayadev Misra]] for their book ''Parallel Program Design: A Foundation''. It is a theoretical language which focuses on ''what'', instead of ''where'', ''when'' or ''how''. The language contains no method of [[flow control (data)|flow control]], and program [[statement (programming)|statement]]s run in a [[Nondeterministic programming|nondeterministic]] way until statements cease to cause changes during execution. This allows for programs to run indefinitely, such as auto-pilot or power plant safety systems, as well as programs that would normally terminate (which here converge to a [[Fixed point combinator|fixed point]]).
== Description ==
All statements are
==Examples==
Line 9 ⟶ 16:
===Bubble sort===
[[Bubble sort]] the array by comparing adjacent numbers, and swapping them if they are in the wrong order. Using <math>\Theta(n)</math> expected time, <math>\Theta(n)</math> processors and <math>\Theta(n^2)</math> expected work. The reason you only have <math>\Theta(n)</math> ''expected'' time, is that <code>k</code> is always chosen randomly from <math>\{0,1\}</math>.
Program bubblesort
Line 17 ⟶ 24:
initially
n = 20 #
<
assign
<# k : 0 <= k < 2 ::
Line 23 ⟶ 30:
A[i], A[i+1] := A[i+1], A[i]
if A[i] > A[i+1] > >
end
===Rank-sort===
Program ranksort
Line 103 ⟶ 46:
assign
<|| i : 0 <= i < n ::
R[i] := <+ j : 0 <= j < n and (A[j] < A[i] or (A[j] = A[i] and j < i)) :: 1 > >
#
<|| i : 0 <= i < n ::
Line 109 ⟶ 52:
end
===Floyd–Warshall algorithm===
Using the [[
Program shortestpath
Line 148 ⟶ 91:
* K. Mani Chandy and Jayadev Misra (1988) ''Parallel Program Design: A Foundation''.
[[Category:
|