csp for java (jcsp) 1_0-rc7 api specification.mht

来自「这是英国Kent大学开发的进程代数的JAVA库,对付多线程和并发系统变得很容易,」· MHT 代码 · 共 1,530 行 · 第 1/5 页

MHT
1,530
字号
overview-tree.html"><FONT=20
            class=3DNavBarFont1><B>Tree</B></FONT></A>&nbsp;</TD>
          <TD class=3DNavBarCell1 bgColor=3D#eeeeff><A=20
            =
href=3D"http://www.cs.kent.ac.uk/projects/ofa/jcsp/jcsp1-0-rc7/jcsp-docs/=
deprecated-list.html"><FONT=20
            class=3DNavBarFont1><B>Deprecated</B></FONT></A>&nbsp;</TD>
          <TD class=3DNavBarCell1 bgColor=3D#eeeeff><A=20
            =
href=3D"http://www.cs.kent.ac.uk/projects/ofa/jcsp/jcsp1-0-rc7/jcsp-docs/=
index-files/index-1.html"><FONT=20
            class=3DNavBarFont1><B>Index</B></FONT></A>&nbsp;</TD>
          <TD class=3DNavBarCell1 bgColor=3D#eeeeff><A=20
            =
href=3D"http://www.cs.kent.ac.uk/projects/ofa/jcsp/jcsp1-0-rc7/jcsp-docs/=
help-doc.html"><FONT=20
            =
class=3DNavBarFont1><B>Help</B></FONT></A>&nbsp;</TD></TR></TBODY></TABLE=
></TD>
    <TD vAlign=3Dtop align=3Dright rowSpan=3D3><EM><B>CSP for =
Java<BR>(JCSP)=20
      1.0-rc7</B></EM> </TD></TR>
  <TR>
    <TD class=3DNavBarCell2 bgColor=3Dwhite><FONT =
size=3D-2>&nbsp;PREV&nbsp;=20
      &nbsp;NEXT</FONT></TD>
    <TD class=3DNavBarCell2 bgColor=3Dwhite><FONT size=3D-2><A=20
      =
href=3D"http://www.cs.kent.ac.uk/projects/ofa/jcsp/jcsp1-0-rc7/jcsp-docs/=
index.html"=20
      target=3D_top><B>FRAMES</B></A> &nbsp; &nbsp;<A =
href=3D"about:blank"=20
      target=3D_top><B>NO =
FRAMES</B></A></FONT></TD></TR></TBODY></TABLE><!-- =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D END OF NAVBAR =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D -->
<HR>

<CENTER>
<H2>CSP for Java<SUP><FONT size=3D-2>TM</FONT></SUP> (JCSP) 1.0-rc7 API=20
Specification</H2></CENTER>This document is the specification for the =
JCSP core=20
API.=20
<P><B>See:=20
</B><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A=20
href=3D"http://www.cs.kent.ac.uk/projects/ofa/jcsp/jcsp1-0-rc7/jcsp-docs/=
overview-summary.html#overview_description"><B>Description</B></A>=20

<P>
<TABLE cellSpacing=3D0 cellPadding=3D3 width=3D"100%" border=3D1>
  <TBODY>
  <TR class=3DTableHeadingColor bgColor=3D#ccccff>
    <TD colSpan=3D2><FONT size=3D+2><B>Packages</B></FONT></TD></TR>
  <TR class=3DTableRowColor bgColor=3Dwhite>
    <TD width=3D"20%"><B><A=20
      =
href=3D"http://www.cs.kent.ac.uk/projects/ofa/jcsp/jcsp1-0-rc7/jcsp-docs/=
jcsp/awt/package-summary.html">jcsp.awt</A></B></TD>
    <TD>This provides CSP extensions for all <A=20
      =
href=3D"http://java.sun.com/j2se/1.5.0/docs/api/java/awt/package-summary.=
html">java.awt</A>=20
      components -- GUI events and widget configuration map to channel=20
      communications.</TD></TR>
  <TR class=3DTableRowColor bgColor=3Dwhite>
    <TD width=3D"20%"><B><A=20
      =
href=3D"http://www.cs.kent.ac.uk/projects/ofa/jcsp/jcsp1-0-rc7/jcsp-docs/=
jcsp/lang/package-summary.html">jcsp.lang</A></B></TD>
    <TD>This provides classes and interfaces corresponding to the =
fundamental=20
      primitives of CSP.</TD></TR>
  <TR class=3DTableRowColor bgColor=3Dwhite>
    <TD width=3D"20%"><B><A=20
      =
href=3D"http://www.cs.kent.ac.uk/projects/ofa/jcsp/jcsp1-0-rc7/jcsp-docs/=
jcsp/plugNplay/package-summary.html">jcsp.plugNplay</A></B></TD>
    <TD>This provides an assortment of <I>plug-and-play</I> CSP =
components to=20
      wire together (with <TT>Object</TT>-carrying wires) and =
reuse.</TD></TR>
  <TR class=3DTableRowColor bgColor=3Dwhite>
    <TD width=3D"20%"><B><A=20
      =
href=3D"http://www.cs.kent.ac.uk/projects/ofa/jcsp/jcsp1-0-rc7/jcsp-docs/=
jcsp/plugNplay/ints/package-summary.html">jcsp.plugNplay.ints</A></B></TD=
>
    <TD>This provides an assortment of <I>plug-and-play</I> CSP =
components to=20
      wire together (with <TT>int</TT>-carrying wires) and =
reuse.</TD></TR>
  <TR class=3DTableRowColor bgColor=3Dwhite>
    <TD width=3D"20%"><B><A=20
      =
href=3D"http://www.cs.kent.ac.uk/projects/ofa/jcsp/jcsp1-0-rc7/jcsp-docs/=
jcsp/util/package-summary.html">jcsp.util</A></B></TD>
    <TD>This provides classes and interfaces to customise the semantics =
of=20
      <TT>Object</TT> channels.</TD></TR>
  <TR class=3DTableRowColor bgColor=3Dwhite>
    <TD width=3D"20%"><B><A=20
      =
href=3D"http://www.cs.kent.ac.uk/projects/ofa/jcsp/jcsp1-0-rc7/jcsp-docs/=
jcsp/util/ints/package-summary.html">jcsp.util.ints</A></B></TD>
    <TD>This provides classes and interfaces to customise the semantics =
of=20
      <TT>int</TT> channels.</TD></TR></TBODY></TABLE>
<P>&nbsp;<A name=3Doverview_description><!-- --></A>=20
<P>This document is the specification for the JCSP core API.=20
<P>JCSP provides a complete library for building complex functionality =
through=20
layered networks of communicating processes. It conforms to the <A=20
href=3D"http://www.comlab.ox.ac.uk/archive/csp.html">CSP</A> model of=20
cummunicating systems so that twenty years of theory, tools and =
practical=20
experience can be brought to bear in the support of Java multi-threaded=20
applications. Newcomers to JCSP should start with the documentation on =
the <A=20
href=3D"http://www.cs.kent.ac.uk/projects/ofa/jcsp/jcsp1-0-rc7/jcsp-docs/=
jcsp/lang/CSProcess.html"><CODE><TT>CSProcess</TT></CODE></A>=20
interface, which outlines and motivates the notion of <I>components</I> =
as=20
<I>communicating processes</I> and the <I>process oriented design</I> =
pattern.=20
<P>Processes interact solely via CSP synchronising primitives, such as =
<A=20
href=3D"http://www.cs.kent.ac.uk/projects/ofa/jcsp/jcsp1-0-rc7/jcsp-docs/=
jcsp/lang/One2OneChannel.html"><CODE><I>channels</I></CODE></A>,=20
<A=20
href=3D"http://www.cs.kent.ac.uk/projects/ofa/jcsp/jcsp1-0-rc7/jcsp-docs/=
jcsp/lang/One2OneCallChannel.html"><CODE><I>CALL=20
channels</I></CODE></A>, <A=20
href=3D"http://www.cs.kent.ac.uk/projects/ofa/jcsp/jcsp1-0-rc7/jcsp-docs/=
jcsp/lang/CSTimer.html"><CODE><I>timers</I></CODE></A>,=20
<A=20
href=3D"http://www.cs.kent.ac.uk/projects/ofa/jcsp/jcsp1-0-rc7/jcsp-docs/=
jcsp/lang/Crew.html"><CODE><I>crews</I></CODE></A>,=20
<A=20
href=3D"http://www.cs.kent.ac.uk/projects/ofa/jcsp/jcsp1-0-rc7/jcsp-docs/=
jcsp/lang/Barrier.html"><CODE><I>barriers</I></CODE></A>,=20
<A=20
href=3D"http://www.cs.kent.ac.uk/projects/ofa/jcsp/jcsp1-0-rc7/jcsp-docs/=
jcsp/lang/Bucket.html"><CODE><I>buckets</I></CODE></A>=20
or other well-defined modes of access to shared passive objects. =
Processes do=20
not invoke each other's methods. Processes may be combined to run in <A=20
href=3D"http://www.cs.kent.ac.uk/projects/ofa/jcsp/jcsp1-0-rc7/jcsp-docs/=
jcsp/lang/Sequence.html"><CODE><I>sequence</I></CODE></A>=20
or <A=20
href=3D"http://www.cs.kent.ac.uk/projects/ofa/jcsp/jcsp1-0-rc7/jcsp-docs/=
jcsp/lang/Parallel.html"><CODE><I>parallel</I></CODE></A>.=20
Processes may be combined to wait passively on a number of <A=20
href=3D"http://www.cs.kent.ac.uk/projects/ofa/jcsp/jcsp1-0-rc7/jcsp-docs/=
jcsp/lang/Alternative.html"><CODE><I>alternative</I></CODE></A>=20
events, with one of them trigered into action only by the external =
generation of=20
that event. Such collections of events may be serviced either <A=20
href=3D"http://www.cs.kent.ac.uk/projects/ofa/jcsp/jcsp1-0-rc7/jcsp-docs/=
jcsp/lang/Alternative.html#fairSelect()"><CODE><I>fairly</I></CODE></A>=20
(guaranteeing no starvation of one event by the repeated arrival of its=20
siblings), by any user-defined <A=20
href=3D"http://www.cs.kent.ac.uk/projects/ofa/jcsp/jcsp1-0-rc7/jcsp-docs/=
jcsp/lang/Alternative.html#priSelect()"><CODE><I>priority</I></CODE></A> =

or in an <A=20
href=3D"http://www.cs.kent.ac.uk/projects/ofa/jcsp/jcsp1-0-rc7/jcsp-docs/=
jcsp/lang/Alternative.html#select()"><CODE><I>arbitrary</I></CODE></A>=20
manner.=20
<P>JCSP is an alternative to the built-in <I>monitor</I> model for Java =
threads.=20
JCSP primitives should not normally be mixed into designs with=20
<TT>synchronized</TT> method declarations, instances of the=20
<TT>java.lang.Runnable</TT> interface or <TT>java.lang.Thread</TT> =
class, or=20
invocations of the <TT>wait</TT>/<TT>notify</TT>/<TT>notifyAll</TT> =
methods from=20
<TT>java.lang.Object</TT>.=20
<P>However, JCSP is compatible with the built-in model and, with care, =
can be=20
mixed safely and profitably. In particular, process communication via=20
<TT>wait</TT>-free <TT>synchronized</TT> method invocations on a shared =
passive=20
object directly implements a common CSP <I>server</I> idiom (see <A=20
href=3D"http://www.cs.kent.ac.uk/projects/ofa/jcsp/jcsp1-0-rc7/jcsp-docs/=
jcsp/awt/DisplayList.html"><CODE><TT>DisplayList</TT></CODE></A>=20
for an example). Further, existing libraries that interact with user =
software=20
via <I>listener</I> registration and callback (such as the standard =
<I>AWT</I>=20
and <I>Swing</I>) can be easily tailored to operate as processes with=20
channel-based interfaces (for example, see <A=20
href=3D"http://www.cs.kent.ac.uk/projects/ofa/jcsp/jcsp1-0-rc7/jcsp-docs/=
jcsp/awt/package-summary.html">jcsp.awt</A>).=20

<P>Finally, we note that the JCSP library reflects the <A=20
href=3D"http://wotug.ukc.ac.uk/parallel/occam/projects/occam-for-all/"><B=
>occam</B></A>=20
realisation of CSP, with some extensions to take advantage of the =
dynamic nature=20
of Java. An <B>occam</B> <TT>PROC</TT> declaration maps simply into a =
class=20
implementing <A=20
href=3D"http://www.cs.kent.ac.uk/projects/ofa/jcsp/jcsp1-0-rc7/jcsp-docs/=
jcsp/lang/CSProcess.html"><CODE><TT>CSProcess</TT></CODE></A>,=20
whose constructor parameters mirror the <TT>PROC</TT> parameters and =
whose=20
<TT>run</TT> method mirrors the <TT>PROC</TT> body.=20
<P>
<H2>Acknowledgements</H2>This <A=20
href=3D"http://www.cs.ukc.ac.uk/projects/ofa/jcsp/">JCSP</A> library was =
developed=20
from work originally carried out and presented by numerous individuals =
at the <A=20
href=3D"http://wotug.ukc.ac.uk/">WoTUG</A> <A=20
href=3D"http://wotug.ukc.ac.uk/parallel/groups/wotug/java/"><I>Java =
Threads=20
Workshop</I></A> and conferences (<A=20
href=3D"http://www.rt.el.utwente.nl/wotug20/"><I>WoTUG-20</I></A>, <A=20
href=3D"http://wotug.ukc.ac.uk/parallel/groups/wotug/wotug21/"><I>WoTUG-2=
1</I></A>,=20
<A =
href=3D"http://www.keele.ac.uk/depts/cs/events/wotug22/"><I>WoTUG-22</I><=
/A> <A=20
href=3D"http://wotug.ukc.ac.uk/cpa2000/"><I>WoTUG-23/CPA-2000</I></A> =
and <A=20
href=3D"http://www.cs.bris.ac.uk/Events/CPA2001/"><I>WoTUG-24/CPA-2001</I=
></A>) in=20
the period 1996-2000. Please follow the links to find the original =
sources.=20
Special thanks are owed to <A =
href=3D"mailto:p_d_austin@hotmail.com">Paul=20
Austin</A>, who developed <A=20
href=3D"http://www.cs.ukc.ac.uk/projects/ofa/jcsp0-5/"><I>the original=20
JCSP</I></A> library.=20
<H2>References</H2><I>`Communicating Sequential Processes'</I>, C.A.R. =
Hoare,=20
CACM, 21-8, pp. 666-677, August 1978.=20
<BLOCKQUOTE>This is the original exposition of CSP. Presentation is =
largely=20
  from the programmer's point of view. The <B>Ada</B> tasking model and =
the=20
  <B>occam</B>/transputer process model were derived from this work.=20
</BLOCKQUOTE><I>`Communicating Sequential Processes'</I>, C.A.R. Hoare, =
Prentice=20
Hall, 1985.=20
<BLOCKQUOTE>This is <I>`the book'</I>. Presentation is more abstract =
(i.e.=20
  mathematical) and a more general theory is given than in the original =
CACM=20
  paper. One crucial difference is that <I>events</I> (and =
<I>channels</I>)=20
  become concepts that are separate from the processes that engage in =
them. This=20
  difference was adopted in the <B>occam</B>/transputer model, but =
<B>Ada</B>=20
  missed out on it. The <I>JCSP</I> library follows the model presented =
in this=20
  book. </BLOCKQUOTE><I>`The Theory and Practice of Concurrency'</I>, =
A.W. Roscoe,=20
Prentice Hall, ISBN 0-13-674409-5, 1997.=20
<BLOCKQUOTE>This brings CSP up to date with refinements developed over =
the=20
  past decade. It is <I>`the new book'</I>. </BLOCKQUOTE>`<A=20
href=3D"http://wotug.ukc.ac.uk/parallel/theory/formal/csp/jeremy-martin/c=
hapter1.ps.gz"><I>Communicating=20
Sequential Processes and Deadlock</I></A>' J.M.R.Martin, Chapter 1 from =
his Ph.D=20
thesis ("<A=20
href=3D"http://wotug.ukc.ac.uk/parallel/theory/formal/csp/jeremy-martin/"=
>The=20
Design and Construction of Deadlock-Free Concurrent Systems</A>"), =
University of=20
Buckingham, UK, 1996.=20
<BLOCKQUOTE>This gives a crisp, amusing and accurate tour around all the =
CSP=20
  concepts, strongly recommended for beginners and experienced CSP users =
alike.=20
  [Actually only up to (and including) page 11 are for normal mortals - =
after=20
  that it starts to get scary. But those first few pages are a gem.]=20
</BLOCKQUOTE><I>`A Classical Mind - Essays in Honour of C.A.R. =
Hoare'</I>,=20
Edited by A.W. Roscoe, Prentice Hall, ISBN 0-13-294844-3, 1994.=20
<BLOCKQUOTE>Serious bedtime reading. </BLOCKQUOTE><I>`Parallel =
Processing with=20
Communicating Process Architecture'</I>, I.R.East, UCL press, ISBN=20
1-85728-239-6, 1995.=20
<BLOCKQUOTE>This is an excellent text on how to design and program with =
the=20
  CSP model - many higher level design issues are addressed.=20
</BLOCKQUOTE><I>`occam 2 -- including occam 2.1'</I>, John Galletly, UCL =
press,=20
ISBN 1-85728-362-7, 1996.=20
<BLOCKQUOTE>This is a good textbook on the <B>occam</B> version of the =
CSP=20
  model. A knowledge of <B>occam</B> gives insight that makes =
multithreading in=20
  <B>Java</B> simpler and, hence, safer to manage ;-) ...=20
</BLOCKQUOTE><I>`Parallel and Distributed Computing in Education'</I>, =
<A=20
href=3D"mailto:P.H.Welch@ukc.ac.uk">P.H.Welch</A>, in <I>Proceedings of=20
VecPar'98</I>, Lecture Notes in Computer Science #1573, Springer-Verlag, =
April=20
1999.=20
<BLOCKQUOTE>This is a tutorial introduction to CSP from the point of =
view

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?