• No results found

sigcse02 pdf

N/A
N/A
Protected

Academic year: 2020

Share "sigcse02 pdf"

Copied!
5
0
0

Loading.... (view fulltext now)

Full text

(1)

A Communication Library

t o

Support Concurrent Programming

Courses*

Steve Carr, Changpeng Fang, Tim Jozwowski, Jean Mayo and Ching-Kuang Shene

Department of Computer Science

Michigan Technological University

Houghton, MI 49931

Email: {carr, cfang, trjozwow, jmayo, shene}@mtu.edu

Abstract

A n u m b e r of c o m m u n i c a t i o n libraries have b e e n writ- t e n t o s u p p o r t c o n c u r r e n t p r o g r a m m i n g . For a v a r i e t y of reasons, these libraries generally are n o t well-suited for use in u n d e r g r a d u a t e courses. We have w r i t t e n a c o m m u n i c a t i o n l i b r a r y u n i q u e l y t a i l o r e d to an a c a d e m i c e n v i r o n m e n t . T h e l i b r a r y provides t w o levels of c o m m u - n i c a t i o n a b s t r a c t i o n ( t o p o l o g y a n d channel) a n d sup- p o r t s c o m m u n i c a t i o n a m o n g t h r e a d s , processes o n t h e s a m e m a c h i n e , a n d processes on different machines, v i a a unified interface. T h e r o u t i n e s facilitate c o n t r o l l e d m e s s a g e loss along channels a n d c a n b e i n t e g r a t e d w i t h a n existing g r a p h i c a l t o o l t h a t s u p p o r t s v i s u a l i z a t i o n of t h e c o m m u n i c a t i o n t h a t occurs. A n editor has b e e n d e v e l o p e d for a u t o m a t i c c o d e g e n e r a t i o n for a r b i t r a r y topologies via a g r a p h i c a l interface. All t h e s e tools r u n over Solaris, Linux, a n d W i n d o w s .

1

Motivation

C o n c u r r e n t p r o g r a m m i n g is increasingly f u n d a m e n t a l to u n d e r g r a d u a t e C o m p u t e r Science e d u c a t i o n [1]. Corre- spondingly, courses d e d i c a t e d to, or c o n t a i n i n g a c o m - p o n e n t in, this area are m o v i n g ever earlier into t h e un- d e r g r a d u a t e c u r r i c u l u m . Yet this r e m a i n s a v e r y chal- lenging s u b j e c t t o teach. Aside f r o m t h e difficulty of t h e m a t e r i a l , available tools generally are n o t t a i l o r e d t o a n a c a d e m i c e n v i r o n m e n t .

I n o u r experience, a significant hurdle to s t u d e n t u n d e r - s t a n d i n g , especially a m o n g lower-level s t u d e n t s , is t h e

*This work supported in part by the National S c i e n c e

Foundation under grants DUE-9752244 and DUE-9952509. The fourth author was also supported by National Science Foundation C A R E E R award CC1:t-9984862.

Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that

copies bear this notice and the full citation on the first page. To copy otherwise, or republish, to post on servers or to redistribute to lists,

requires prior specific permission and/or a fee.

SIGCSE '02, February 27- March 3, 2002, Covington, Kentucky, LISA.

Copyright 2002 ACM 1-58113-473-8/02/0002...$5.00.

c o m p l e x i t y a n d diversity of c o m m u n i c a t i o n interfaces. S t u d e n t s likely learn s e p a r a t e interfaces for s y n c h r o - nized c o m m u n i c a t i o n a m o n g t h r e a d s (lightweight pro- cesses), processes ( h e a v y w e i g h t processes) on t h e s a m e m a c h i n e , a n d processes on different machines. A n o t h e r difficulty faced in temching n e t w o r k e d c o m m u n i c a t i o n in p a r t i c u l a r is t h e i n t r o d u c t i o n of m e s s a g e loss in s o m e controlled fashion.

I n o r d e r to address these issues, we have d e v e l o p e d a l i b r a r y t o s u p p o r t c o m m u n i c a t i o n a m o n g t h r e a d s , pro- cesses o n t h e s a m e m a c h i n e , or processes o n different machines, v i a a unified interface. T h e s e r o u t i n e s imple- m e n t an a b s t r a c t i o n of t h e p r i m a r y o v e r a r c h i n g char- acteristics of I P C (interprocess c o m m u n i c a t i o n ) . T h e y facilitate t h e s t u d y of c o n c u r r e n t a p p l i c a t i o n design a n d c a n serve as a s t a r t i n g p o i n t for s t u d y of t h e i m p l e m e n - t a t i o n of I P C w i t h i n a p a r t i c u l a r p a r a d i g m , t h r e a d s , processes o n t h e s a m e m a c h i n e , or processes on different machines. T h e l i b r a r y a b s t r a c t s t h e p a s s i n g of messages at t w o levels: t o p o l o g y (the h i g h e s t level) a n d channel. Additionally, t h e r o u t i n e s provide a m e c h a n i s m for in- t r o d u c i n g m e s s a g e loss in a c o n t r o l l e d fashion. T h e s e r o u t i n e s c a n be i n t e g r a t e d into an existing v i s u a l i z a t i o n s y s t e m t h a t depicts t h e c o m m u n i c a t i o n t h a t takes place. A t o p o l o g y e d i t o r has b e e n d e v e l o p e d t h a t facilitates a u t o m a t e d g e n e r a t i o n of code for a r b i t r a r y t o p o l o g i e s using a g r a p h i c a l interface. T h e routines, v i s u a l i z a t i o n s y s t e m , a n d t o p o l o g y editor r u n over Solaris, Linux, a n d W i n d o w s .

2 Related Work

(2)

levels of a b s t r a c t i o n , controlled m e s s a g e loss, or inte- g r a t e d v i s u a l i z a t i o n s u p p o r t .

O t h e r , c o m m e r c i a l l y used m e s s a g e p a s s i n g libraries are available, e.g. P V M a n d M P I . M P I is p e r h a p s t h e m o s t widely used, a n d s t r u c t u r i n g o u r m e s s a g e p a s s i n g l i b r a r y a r o u n d t h e M P I i n t e r f a c e ( a d d i n g s u p p o r t for v i s u a l i z a t i o n a n d m a i n t e n a n c e of v e c t o r t i m e over t h e M P I p r i m i t i v e s ) was considered. However, at t h e t i m e o u r d e v e l o p m e n t b e g a n , p u b l i c l y available i m p l e m e n t a - tions of M P I , like X D P , required t h a t t h e s a m e code be e x e c u t e d for each process c o m p r i s i n g an application. T h i s m a d e it u n s u i t a b l e for d i s t r i b u t e d or t h r e a d e d ap- p l i c a t i o n d e v e l o p m e n t . Additionally, we did n o t w a n t to m a k e i n s t a l l a t i o n a n d m a i n t e n a n c e of M P I or P V M a r e q u i r e m e n t for t h e use of our s y s t e m .

M c D o n a l d a n d K a z e m i have e x t e n d e d t h e P V M a n d M P I m e s s a g e p a s s i n g e n v i r o n m e n t to s u p p o r t virtual process %opologies [10]. Several core functions have also b e e n d e v e l o p e d to e n a b l e a parallel p r o g r a m to r e q u e s t use of a s t a n d a r d process topology, t o s p a w n a n d in- s t a n t i a t e all t a s k s p a r t i c i p a t i n g in a topology, a n d to specify t r a n s m i s s i o n , reception, a n d s y n c h r o n i z a t i o n in t e r m s of logical c o m m u n i c a t i o n p a t t e r n s , e l i m i n a t i n g , for e x a m p l e , t h e need for s t u d e n t s to c o m p u t e process identifiers. T h e y also p r o v i d e a graphical i n t e r f a c e for specifying, verifying, a n d v i e w i n g topologies. Hence, t h e i r tools are similar to w h a t is achieved b y o u r topol- o g y classes a n d editor. O u r tools a d d i t i o n a l l y p r o v i d e controlled m e s s a g e loss a n d e x e c u t i o n visualization.

3

Communication Library

C o m m u n i c a t i o n is a b s t r a c t e d at two levels: c h a n n e l a n d topology. T h e two a b s t r a c t i o n s are described, in t u r n , below.

C h a n n e l T h e goal of t h e channel classes is to p r o v i d e

a n a b s t r a c t i o n of c o m m u n i c a t i o n t h a t ties closely to t h a t e n c o u n t e r e d in t h e l i t e r a t u r e . T h r e e c h a n n e l t y p e s h a v e b e e n i m p l e m e n t e d . T h e first class is a s y n c h r o n o u s o n e - t o - o n e channel. A l o n g this channel, b o t h send a n d receive are blocking [5]. A d d r e s s i n g in this class, as in all t h e classes, a m o n g t h r e a d s is b y P T h r e a d s t h r e a d identifier 1 a n d a m o n g processes is b y integer identifier. P r o c e s s identifiers are either assigned implicitly w h e n a p p l i c a t i o n processes are s t a r t e d b y a control process, described later, or c a n b e assigned explicitly b y t h e user w h e n a c h a n n e l is c r e a t e d . No a t t e m p t is m a d e to p r e v e n t d e a d l o c k caused b y a p p l i c a t i o n c o m m u n i c a - tion p a t t e r n s , a n d t h e r o u t i n e s will block indefinitely. M e s s a g e loss c a n n o t be i n t r o d u c e d artificially into syn- chronous channels.

1Pthreads refers to thread implementations t h a t adhere to the POSIX standard PI003.1c.

char msg[]="False pearls before real svine"; channell = ne~ AsynOnetoOneChannel(1,

myID,dropSome(rand())); channell.send((void *)msg,sizeof(msg));

(a) Sender

char

msg[MSGLEN];

c h a n n e l O = ne~

AsynOnetoOneChannel(O,myID,O.5);

channelO.recv((void *)msg,sizeof(msg));

F i g u r e 1: C h a n n e l

(b) Receiver

M e s s a g e T r a n s m i s s i o n along A s y n c h r o n o u s

T h e second class i m p l e m e n t s an a s y n c h r o n o u s one-to- one channel. Along t h e s e channels, sends are non- blocking; two receive p r i m i t i v e s are provided, one block- ing a n d one n o n - b l o c k i n g [5]. M e s s a g e loss c a n b e intro- d u c e d along a n y a s y n c h r o n o u s o n e - t o - o n e channel be- t w e e n processes. T h e loss can b e specified e i t h e r as a value b e t w e e n zero a n d one or v i a an integer function, w i t h a single integer i n p u t , at t h e t i m e t h e c h a n n e l is c r e a t e d . W h e n t h e loss is specified as a value b e t w e e n zero a n d one, m e s s a g e s will b e d r o p p e d , i m m e d i a t e l y p r i o r to t h e p o i n t at which t h e y would b e sent along a t o t a l l y reliable channel, b y t h e c o m m u n i c a t i o n layer according to a u n i f o r m d i s t r i b u t i o n . W h e n loss is speci- fied as a function, t h e f u n c t i o n is e v a l u a t e d at this s a m e p o i n t i m m e d i a t e l y prior to t h e s e n d o p e r a t i o n . If t h e r e t u r n value f r o m t h e u s e r - s u p p l i e d f n n c t i o n is g r e a t e r

t h a n or equal to one, t h e m e s s a g e is sent, o t h e r w i s e t h e m e s s a g e is d r o p p e d . (Hence, t h e loss function is directional.) F i g u r e 1 depicts code t h a t c r e a t e s a chan- nel b e t w e e n t h e processes w i t h identifiers zero a n d one; process zero t h e n sends a m e s s a g e t o process one. Mes- sages sent b y process zero are d r o p p e d a c c o r d i n g to t h e function d r o p S o m e ( ) (which is a s s u m e d t o b e defined elsewhere). H a l f t h e m e s s a g e s sent b y process one (to p r o c e s s zero) are d r o p p e d a c c o r d i n g to a u n i f o r m dis- t r i b u t i o n .

I m p l e m e n t a t i o n of this code using a B S D socket inter- face would require a p p r o x i m a t e l y twice as m a n y calls as t h e two ( c o n s t r u c t o r a n d send) required here. T h i s e s t i m a t e neglects t h e additional, non-trivial, c o m p l e x - i t y required to s u p p o r t process a d d r e s s i n g v i a integer identifier a n d to d r o p messages in a controlled fashion.

T h e final class is a m a n y - t o - m a n y channel, a n d is cur- r e n t l y available o n l y for t h r e a d s . T h i s class essentially i m p l e m e n t s a b o u n d e d buffer.

[image:2.612.318.572.53.197.2]
(3)

theGrid = new Grid(RQWS,CDLS,myID);

if ((myID Z COLS) != 3)

theGrid.send(RIGHT,(void *)&myID,sizeof(myID)); if ((myID Z COLS) != 0)

theGrid.send(LEFT,(void *)~myID,sizeof(myID)); if (myID >= CQLS)

theGrid.send(UP,(void *)~myID,sizeof(myID)); if (myID < (RDWS-1)*COLS)

theGrid.send(DONN,(void *)~nnyID,sizeof(myID));

F i g u r e 3: H i s t o r y W i n d o w

F i g u r e 2: E x c h a n g e of I D A m o n g G r i d N e i g h b o r s

value of o n e w h e n d a t a is available, b u t h a s no effect on t h e c h a n n e l itself. If no m e s s a g e is available, t h e r e t u r n value is zero.

V e c t o r t i m e is m a i n t a i n e d w i t h i n user a p p l i c a t i o n s . Vec- t o r t i m e is u s e d to d e t e r m i n e t h e h a p p e n e d - b e f o r e re- l a t i o n [8] a m o n g events t h a t o c c u r w i t h i n a d i s t r i b u t e d c o m p u t a t i o n [9]. Users c a n query, a n d i n c r e m e n t t h e lo- cal c o m p o n e n t of, t h e c u r r e n t local v e c t o r t i m e w i t h i n an a p p l i c a t i o n .

T o p o l o g y O n e - t o - o n e c h a n n e l s c a n b e j o i n e d into topologies. T h e p r i m a r y f u n c t i o n of t h e t o p o l o g y class is to facilitate c r e a t i o n of m u l t i p l e c h a n n e l s v i a i n s t a n - t i a t i o n of a single class. Several s t a n d a r d t o p o l o g i e s , d e r i v e d f r o m t h e t o p o l o g y class, axe also p r o v i d e d in- cluding: f u l l y - c o n n e c t e d , star, linear array, ring, grid, a n d t o r u s . M e s s a g e sends arid receives axe r e s t r i c t e d to d i r e c t l y c o n n e c t e d n o d e s w i t h i n t h e topology. For e x a m p l e , t h e c e n t e r n o d e of a s t a r n e t w o r k is t h e o n l y n o d e able to s e n d to, a n d receive from, o u t e r nodes; o u t e r n o d e s c a n o n l y s e n d to, a n d receive from, t h e c e n t e r node. T o p o l o g i e s are b u i l t w i t h reliable a~yn- c h r o n o u s channels. F i g u r e 2 d e p i c t s e x c h a n g e of iden- tifiers a m o n g all n e i g h b o r s in a grid topology. N o t e t h a t m a c r o s RIGHT,LEFT,UP,DOWN axe defined w i t h i n o u r s y s t e m . Similar m a c r o s a r e defined as a p p r o p r i a t e to a given topology.

W i t h i n t h e t o p o l o g y class, a n d e a c h s t a n d a r d t o p o l - ogy, t h e m e t h o d s S e n d ( ) , R e c e i v e ( ) , B r o a d c a s t ( ) , S c a t t e r ( ) , G a t h e r ( ) , a n d R e d u c e ( ) are p r o v i d e d .

T h e Send (Receive) routine sends (receives) a mes-

sage to (from) a specified process. B r o a d c a s t effects

a broadcast, to all processes, of a specified m e s s a g e

f r o m a specified source process. S c a t t e r partitions an

input block of data, f r o m a specified source process,

into a n u m b e r of pieces equal to the n u m b e r of pro-

cesses a n d sends a unique piece to each of the applica-

tion processes. G a t h e r c o m p l e m e n t s S c a t t e r a n d col-

lects data from application processes to the process with

a specified identifier. A R e d u c e m e t h o d collects data

f r o m e a c h a p p l i c a t i o n p r o c e s s a n d s t o r e s t h e result in a specified l o c a t i o n . T h e user specified f u n c t i o n is t h e n r u n t o r e d u c e t h e collected d a t a . S c a t t e r , G a t h e r , a n d R e d u c e c u r r e n t l y o p e r a t e on o n e - d i m e n s i o n a l ar- r a y s ( c o n s e c u t i v e s t o r a g e ) . S u p p o r t for o p e r a t i o n s on s o m e n o n - c o n s e c u t i v e s t o r a g e in t w o - d i m e n s i o n a l a r r a y s (e.g., s u b m a t r i x ) is u n d e r d e v e l o p m e n t .

I m p l e m e n t a t i o n A p p l i c a t i o n s c o m p r i s e d of m u l t i p l e processes are s p a w n e d v i a a c e n t r a l c o n t r o l process. S p e c i f i c a t i o n of t h e user p r o g r a m s a n d t h e m a c h i n e s o n which t h e y s h o u l d e x e c u t e t a k e s p l a c e e i t h e r v i a t h e c o m m a n d line or f r o m user-specified c o n f i g u r a t i o n files. T h e c o n t r o l p r o c e s s also s p a w n s t h e v i s u a l i z a t i o n pro- cess, w h e n r e q u e s t e d . V i s u a l i z a t i o n d a t a is p a s s e d along T C P c h a n n e l s b e t w e e n t h e user processes a n d t h e visu- a l i z a t i o n process. W h e n channels (or t o p o l o g i e s ) are used, a T C P c o n n e c t i o n b e t w e e n t h e user processes is c r e a t e d t o effect a channel. Hence, t h e c o n t r o l p r o c e s s is n o t involved in c o m m u n i c a t i o n s b e t w e e n user processes.

4 Topology Editor

A t o p o l o g y e d i t o r h a s b e e n c r e a t e d t o f a c i l i t a t e r a p i d d e v e l o p m e n t of c o m p l e x t o p o l o g i e s v i a a g r a p h i c a l inter- face. T h e e d i t o r allows c r e a t i o n of c o n n e c t i o n s a m o n g single n o d e s or a m o n g topologies. T h e e d i t o r o u t p u t is a file c o n t a i n i n g s p e c i f i c a t i o n of a class d e r i v e d f r o m t h e t o p o l o g y class. ( T h e d e r i v e d class n a m e c a n op- t i o n a l l y b e specified b y t h e user.) T h e i n t e r f a c e for this class is e q u i w l e n t t o t h a t for t h e t o p o l o g y class. T h i s file c a n b e i n c l u d e d b y t h e u s e r in h e r c o d e t o easily c r e a t e t h e c o n s t r u c t e d t o p o l o g y . T h e d e r i v e d class sup- p o r t s b r o a d c a s t , s c a t t e r , g a t h e r , a n d r e d u c e f u n c t i o n s for e a c h c u s t o m topology.

5 Visualization

[image:3.612.346.539.50.168.2] [image:3.612.37.295.67.172.2]
(4)

t h e c h a n n e l class, a n d hence is available w h e n the chan- nel, topology, a n d specific t o p o l o g y classes are used.

A History Graph

w i n d o w (see figure 3) depicts t h e sends a n d receives t h a t o c c u r w i t h i n each process or t h r e a d , a n d connects c o r r e s p o n d i n g send a n d receive o p e r a t i o n s b e t w e e n t h r e a d s or processes. Clicking on a n y channel in this window o p e n s t h e

Channel

window. T h i s win- dow displays all recent a c t i v i t y along this channel, in- cluding c h a n n e l t y p e , m e s s a g e s in t h e channel, m e s s a g e s received since t h e window was o p e n e d , a n d c u r r e n t sta- tus, either

Sending Message

or

Receive Message.

6

Experience

T h e c h a n n e l classes closely follow t h e a b s t r a c t i o n s of c o m m u n i c a t i o n found in t h e l i t e r a t u r e a n d t h e y are eas- ily i n c o r p o r a t e d into existing assignments. T h e i r use provides t h e a d d i t i o n a l a d v a n t a g e of allowing s t u d e n t s to visualize t h e c o m m u n i c a t i o n t h a t takes place.

w i t h 1 - n e w SynOneTnOneChannel(1,0);

neg.veLlue - mmx(mySet);

oentValue~mog.valuo

v i * h l - s u n d ( ( v u i d e ) m e K j s £ z e o f ( m s K ) ) ; E e ~ o v o ( m y S e ~ , m s K . v a l u e ) ;

w ± ~ h l . r e c v ( ( v u i d * ) m s ~ , s ~ z e o f C m e g ) ) ;

a d d ( m y S e t , m s ~ . v a l u e ) ; } while (sen~Vs/ue • ms~.velue);

m s ~ . d o n e ~ l ;

v * t h l . s e n d ( ( v o t d * ) m s E . s ± z e o f ( m e E ) ) ;

(a) Solution for Process Zero

~ I t h O - n e w SDQ~eToOneChaanel(O,l);

u i ~ h O . r e c v ( ( v n i d ~)ms~,e~zeof(~s~)); if ( m B . d o n e "" 0){

add(mySet~s~.value); meE.value - min(mySet);

w S t h O . e e n d ( ( v o S d * ) m s E , e i z ~ o f ( m e ~ ) ) ;

remove(mySe~,meE.value); } while (~s~.doneffi~O);

(b) Solution .for Process One

F i g u r e 4: Set P a r t i t i o n

We p r e s e n t a sequence of exercises t h a t result f r o m o u r e x p e r i e n c e w i t h t e a c h i n g n e t w o r k p r o g r a m m i n g over t h e p a s t several years in an u p p e r - l e v e l u n d e r g r a d u a t e course. T h e s e exercises were r e c e n t l y d e v e l o p e d t o serve as t h e first set of n e t w o r k p r o g r a m m i n g exercises. Ini- tially, o u r first n e t w o r k p r o g r a m m i n g a s s i g n m e n t was m o r e complex. We t y p i c a l l y r e q u i r e d an a p p l i c a t i o n t h a t c o n t a i n e d m u l t i p l e clients a n d a server for all client types, similar to t h a t d e s c r i b e d in [4]. W h i l e t h e y re- p o r t large-scale success, we h a v e f o u n d t h a t , while m a n y s t u d e n t s are able to c o m p l e t e t h e a s s i g n m e n t , a signif- icant n u m b e r of s t u d e n t s h a v e difficulty. We h o p e t h a t c o m p l e t i o n of t h e s e exercises will lead t o g r e a t e r success

in t h e m o r e c o m p l e x client server exercise.

T h i s set of exercises was designed to d e m o n s t r a t e t h r e e f u n d a m e n t a l a s p e c t s of c o n c u r r e n t a p p l i c a t i o n design: (1) t h e use of s y n c h r o n o u s versus a s y n c h r o n o u s c o m - m u n i c a t i o n , (2) d e t e r m i n i s t i c versus n o n - d e t e r m i n i s t i c c o m m u n i c a t i o n , a n d (3) t h e use of a client-server ar- c h i t e c t u r e versus a fully d i s t r i b u t e d one. T h e basis of t h e exercises is S o u n d a r a r a j a n ' s C S P [7] i m p l e m e n t a - t i o n [11] of a set p a r t i t i o n i n g p r o b l e m [6]. T h e p r o b l e m is to p a r t i t i o n a set of integers into two sets a c c o r d i n g t o t h e e l e m e n t values. E a c h p r o c e s s ( h e a v y w e i g h t or lightweight) initially has h a l f of t h e set. O n e process P0 will e n d u p w i t h t h e lower h a l f of t h e e l e m e n t s a n d t h e o t h e r process P1 ends u p w i t h t h e u p p e r h a l f of t h e elements.

T h e first exercise requires t h a t t h e p r o b l e m b e solved using s y n c h r o n o u s m e s s a g e passing. P0 sends t h e m a x - i m u m value

max(So)

f r o m its set So to P1 a n d r e m o v e s

max(So)

f r o m So. Po t h e n waits t o receive t h e m i n i m u m value

rain(S1)

f r o m t h e set $1 of P1. T h i s continues un- til P0 receives a value t h a t is g r e a t e r t h a n or equal to t h e one it sent.

U p o n receiving a value f r o m P0, P1 a d d s t h e received value to $1. P1 t h e n sends

rain(S1)

to Po a n d r e m o v e s

rain(S1)

f r o m its set. T h i s continues until P0 notifies P1 t h a t t h e set is p a r t i t i o n e d . A solution is given in figure 4. T h i s exercise illustrates d e v e l o p m e n t of a s i m p l e ap- p l i c a t i o n p r o t o c o l . (Po a n d P1 m u s t agree on t h e f o r m a t of messages, a n d agree on a sentinel m e s s a g e t h a t lets -P1 k n o w t h a t no f u r t h e r m e s s a g e s will be sent.) I t also serves to familiarize s t u d e n t s w i t h t h e ( s y n c h r o n o u s ) m e s s a g e passing interface.

¢~x.~' ~: ~ r ~ l i L~,lmi ~ . . .

i ... ~ 2 ~ - ~ : ! ! ~ : = : - - ~ ~ : = : : f ~ ' ~ ' ° ~ ...

. ~ j ~._~.,

I

1

T

I

I

F i g u r e 5: S i m u l t a n e o u s S y n c h r o n o u s Sends - H i s t o r y W i n d o w

[image:4.612.40.295.295.520.2] [image:4.612.350.538.461.555.2]
(5)

t h e use of a p a r t i c u l a r channel class. D e v e l o p m e n t of a solution requires t h a t s t u d e n t s c o m e to t h e realization t h a t o n l y a s y n c h r o n o u s message passing facilitates si- m u l t a n e o u s e x e c u t i o n of a send b y b o t h P0 and P1- If s y n c h r o n o u s c o m m u n i c a t i o n is chosen by t h e s t u d e n t , t h e p r o b l e m quickly presents itself w i t h i n t h e visualiza- t i o n s y s t e m , as d e p i c t e d in figure 5.

T h e final exercise of this sequence i n c o r p o r a t e s N pro- cesses w i t h p o r t i o n s of t h e set and requires a central- ized solution. S t u d e n t s use a supplied n o n - d e t e r m i n i s t i c receive f u n c t i o n (or c a n c r e a t e this f u n c t i o n for t h e m - selves) t h a t listens for d a t a on any i n c o m i n g channel. A server collects a set of integers f r o m all clients, com- p u t e s t h e set p a r t i t i o n , a n d r e t u r n s t h e resulting sets to t h e clients.

7 Conclusions and Future W o r k

W e have d e v e l o p e d a message passing l i b r a r y t h a t pro- vides two levels of a b s t r a c t i o n , c h a n n e l and topology, for t h e c o m m u n i c a t i o n t h a t occurs a m o n g processes a n d t h r e a d s . T i g h t l y i n t e g r a t e d v i s u a l i z a t i o n s u p p o r t is available, as is s u p p o r t for controlled message loss. A t o p o l o g y e d i t o r allows d e v e l o p m e n t of c u s t o m topolo- gies via a graphical interface. We a n t i c i p a t e t h a t t h e s e c o m m u n i c a t i o n classes a n d associated tools will s u p p o r t t h e i n s t r u c t i o n of c o n c u r r e n t p r o g r a m m i n g b y r e d u c i n g t h e o v e r h e a d a s s o c i a t e d w i t h learning message passing interfaces, b y p r o v i d i n g a u n i f o r m interface for c o m m u - n i c a t i o n b o t h a m o n g t h r e a d s a n d a m o n g processes, a n d b y p r o v i d i n g i n t e g r a t e d v i s u a l i z a t i o n s u p p o r t w i t h o u t t h e n e e d for i n s t r u m e n t i n g user p r o g r a m s .

T h e s e message passing classes are p a r t of a larger sys- t e m t h a t provides a class l i b r a r y for t h r e a d s , t h r e a d s y n c h r o n i z a t i o n , a n d message passing. T h e s y s t e m c u r r e n t l y also has s u p p o r t for visualizing t h e synchro- n i z a t i o n of t h r e a d s a n d t h e message passing t h a t oc- curs a m o n g t h r e a d s a n d processes. We axe c u r r e n t l y a d d i n g s u p p o r t for s y n c h r o n i z a t i o n of processes (bar- rier and m u t u a l exclusion), i m p l e m e n t i n g well-known parallel a n d d i s t r i b u t e d algorithms, a d d i n g s u p p o r t for d i s t r i b u t e d arrays, and a d d i n g a d d i t i o n a l v i s u a l i z a t i o n s u p p o r t specifically for parallel and d i s t r i b u t e d pro- g r a m m i n g . We believe t h e tools can be used at a n y level in which s t u d e n t s h a v e t h e p r o g r a m m i n g sophisti- c a t i o n a n d b a c k g r o u n d sufficient to cover c o n c u r r e n c y . We have t a u g h t t h r e a d and n e t w o r k p r o g r a m m i n g in a c o u r s e p o p u l a t e d p r e d o m i n a n t l y b y s o p h o m o r e s a n d ju- niors. T h e s y s t e m has n o t b e e n used at a lower level. C o m p r e h e n s i v e , d e t a i l e d i n f o r m a t i o n on o u r work is

available at http ://www. cs.mtu, edu/-shene/NSF-3/

index, html.

References

[1]

ACM. C o m p u t i n g C u r r i c u l a 2001 ( S t e e l m a n D r a f t , A u g u s t 1, 2001). h t t p : / / ~ r ~ r a . a c m . o r g / s i g s /

sigcse/cc2001/steelman/, 2001.

[2]

Arnow, D . M . A simple l i b r a r y for t e a c h i n g a d i s t r i b u t e d p r o g r a m m i n g m o d u l e . In Twenty- Sixth S I G C S E Technical Symposium on Computer

Science Education (Nashville, Tennessee, Max.2-4

1995), pp. 82-86.

[3]

Bedy, M., Caxr, S., H u a n g , X., and Shene, C.-K. A v i s u a l i z a t i o n s y s t e m for m u l t i t h r e a d e d p r o g r a m - ming. In Proceedings off the 31st Annual S I G C S E Technical Symposium on Computer Science Educa-

tion (Austin, T X , M a r c h 2000), pp. 1-5.

[4]

B r y a n t , R. E., a n d O'Hallaxon, D. R. I n t r o d u c i n g c o m p u t e r s y s t e m s f r o m a p r o g r a m m e r ' s perspec- tive. In Proceeding of ~he Thirty-second S I G C S E Technical Symposium on Computer Sciense Edu-

c~'ion (SIGCSE-01) (New York, Feb.21-25 2001),

pp. 9O-94.

[5]

Coulouris, G., Dollimore, J., a n d K i n d b e r g , T. Dis-

tributed Systems Concepts and Design, t h i r d ed.

Addison-Wesley, 2001.

[6]

Dijkstra, E. W. A c o r r e c t n e s s p r o o f for n e t w o r k s of c o m m u n i c a t i n g sequential processes - a small exer- cise. E W D - 6 0 7 , 1977.

[7] Hoaxe, C. C o m m u n i c a t i n g sequential processes.

Commun. A C M ~1, 8 (1978), 666-677.

[8]

L a m p o r t , L. T i m e , clocks, a n d t h e o r d e r i n g of events in a d i s t r i b u t e d s y s t e m . Commun. A C M

P1, 7 (1978), 558-565.

[91

M a t t e r n , F. V i r t u a l t i m e a n d global s t a t e s of dis- t r i b u t e d systems. In Parallel and Distributed Algo- rithms: Proceedings of the International Workshop

on Parallel and Distributed Algorithms, M. C. et.

al., Ed. Elsevier Science P u b l i s h e r s B. V., 1989, pp. 215-226.

[10]

M c D o n a l d , C., a n d K a z e m i , K. T e a c h i n g paral- lel a l g o r i t h m s w i t h process topologies. In Thirty- first S I G C S E Technical Symposium on Computer

Science Education (Austin, Texas, Max.7-12 2000),

pp. 70-74.

[11]

S o u n d a r a r a j a n , N. A x i o m a t i c s e m a n t i c s of com- m u n i c a t i n g s e q u e n t i a l processes. A C M Transac- tions on Programming Languages and Systems 6, 4

Figure

Figure 1: Channel Message Transmission along Asynchronous
Figure 3: History Window
Figure 4: Set Partition

References

Related documents

In conclusion, a radiomics score based on US texure analysis presented a high diagnostic performance in the differential diagnosis of fibroadenoma and TNBC, even in BI-RADS category

Disclaimer: The Fellowship News is the monthly newsletter of Sonoma County Intergroup Fellowship.. Opinions contained herein are strictly those

We further recommend Navy Enterprise link their performance measurement efforts with the Navy’s financial management improvement efforts to construct cost accounting

Confirm that the diagram shown corresponds to your vehicle by referencing the factory

increase in wages mutes the response of hours per person (intensive margin), so total labor input, and hence output, react less than employment, thus increasing the relative

The Gulf of Guinea formed at the culmination of late Jurassic to early Cretaceous tectonism that was characterized by both block and transform faulting superimposed across an

In order to determine if there were an impact on classroom size that was significant enough to potentially impact student achievement, we calculated the number of teachers who

Earlier our country exported hues quantity of granite stones to middle east , European and Arab countries for their infrastructure developments projects but now