Strand
■カテゴリ / ■テンプレート
| パラダイム | 並行論理プログラミング |
|---|---|
| 登場時期 | 1989年 |
| 設計者 | Ian Foster 他 |
| 型付け | 動的型付け |
| 主な処理系 | Strand88 |
| 影響を受けた言語 | Prolog、Relational Language、Concurrent Prolog、PARLOG、Guarded Horn Clauses |
| 影響を与えた言語 | PCN |
Strandは、1989年に発表された商用ベースの並行論理プログラミング言語である。Ian FosterとStephen Taylorにより、設計された。開発はArtificial Intelligence Limitedで行われ、1989年のBritish Computer Society Awardを受賞した[1]。販売はStrand Software Technologies Inc.から行われた。
この言語はErlang開発初期にベース言語としても使われた[2]。
概要
Strandは並行プログラミングのためのプログラミング言語で、論理変数を介して通信を行う複数の軽量プロセスのネットワークとしてプログラムを記述する。言語仕様や考え方はそれ以前に開発されたPARLOGや第五世代コンピュータプロジェクトで開発されたGuarded Horn Clausesと非常によく似ている。
Strandではホーン節にガードを導入した以下のような規則の集まりでプログラムを記述する。
Head :- G1, ..., Gn| B1, ..., Bm. (n,m≧0)
HeadとG1, ..., Gnはプロセス書き換えのための条件、B1, ..., Bmは書き換え後のプロセスを表す。生成されたプロセスは全て並行に実行される。プロセス間の通信にはプロセスで共有する論理変数を使用する。書き換え規則の適用に十分な情報がなければ書き換えを中断し、判断に必要な情報が得られるまで待つことで、プロセス間の同期が行われる。ストリームは論理変数を含んだリストとして表現する。論理変数を共有するプロセスの数に制限はないため、ストリーム通信は1対1だけではなく1対Nのブロードキャストなど、様々な形態が可能である。
StrandはFortranやC言語とのインタフェースを持ち、また個々のプロセスを実行するプロセッサーを指定するためのプラグマを持っていた。
プログラム例
2本のストリームをマージして1本のストリームにするStrandプログラムの例を以下に示す。Prologと同様、A や Xs など英大文字で始まる項は変数を表す。
merge([A|Xs],Ys,Zs0) :- true | Zs0:=[A|Zs], merge(Xs,Ys,Zs).
merge(Xs,[A|Ys],Zs0) :- true | Zs0:=[A|Zs], merge(Xs,Ys,Zs).
merge([],Ys,Zs) :- true | Zs:=Ys.
merge(Xs,[],Zs) :- true | Zs:=Xs.
例えば、上記プログラムの最初の節では、最初の引数が[A|Xs]のようなリストの形になっていない場合は中断し、他のプロセスにより[A|Xs]の形に具体化された(具体的に値が決まった)場合に実行を再開する。この時点でXs自体は具体化されていなくても構わないため、リストの先頭からインクリメンタルに具体化されるストリームを素直に処理できる。
出典
- ^ BCS IT Awards: 1973 - 1999. 2010年1月22日検索
- ^ Foster, I.,and Tayler, S.(ed) Strand: New Concepts in Parallel Programming. p.288-304
参考文献
- Foster, I.,and Tayler, S.(ed) Strand: New Concepts in Parallel Programming. Prentice Hall 1990, ISBN 978-0138505875
関連項目
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.