File: task.h

package info (click to toggle)
pvm 3.4.6-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 8,284 kB
  • sloc: ansic: 72,074; makefile: 1,198; fortran: 631; sh: 285; csh: 74; asm: 37
file content (188 lines) | stat: -rw-r--r-- 6,802 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188

/* $Id: task.h,v 1.10 2000/06/16 16:27:33 pvmsrc Exp $ */

/*
 *         PVM version 3.4:  Parallel Virtual Machine System
 *               University of Tennessee, Knoxville TN.
 *           Oak Ridge National Laboratory, Oak Ridge TN.
 *                   Emory University, Atlanta GA.
 *      Authors:  J. J. Dongarra, G. E. Fagg, M. Fischer
 *          G. A. Geist, J. A. Kohl, R. J. Manchek, P. Mucci,
 *         P. M. Papadopoulos, S. L. Scott, and V. S. Sunderam
 *                   (C) 1997 All Rights Reserved
 *
 *                              NOTICE
 *
 * Permission to use, copy, modify, and distribute this software and
 * its documentation for any purpose and without fee is hereby granted
 * provided that the above copyright notice appear in all copies and
 * that both the copyright notice and this permission notice appear in
 * supporting documentation.
 *
 * Neither the Institutions (Emory University, Oak Ridge National
 * Laboratory, and University of Tennessee) nor the Authors make any
 * representations about the suitability of this software for any
 * purpose.  This software is provided ``as is'' without express or
 * implied warranty.
 *
 * PVM version 3 was funded in part by the U.S. Department of Energy,
 * the National Science Foundation and the State of Tennessee.
 */

/*
 *	task.h
 *
 *	Task descriptors.
 *
 * $Log: task.h,v $
 * Revision 1.10  2000/06/16 16:27:33  pvmsrc
 * DAMN.  The seemingly cool and efficient tp->t_flag / TF_MBNOTIFY
 * solution is not as cool as previously thought.
 * 	- each pvmd only keeps a *local* tasks table...!  D-OH!
 * 	- need to just search the wait context list for an existing
 * 		WT_TASKX mbox notify, as previously feared.
 * 	- already checking wait context list for WT_RECVINFO, so this
 * 		is not too terrible...
 * 	- Damn, though...
 * Removed TF_MBNOTIFY contant - now fricking useless.
 * (Spanker=kohl)
 *
 * Revision 1.9  2000/06/13 22:37:25  pvmsrc
 * Added new task flag (tp->t_flag):
 * 	- TF_MBNOTIFY for marking whether a task has had a mbox notify
 * 		set up or not.
 * 	- to avoid a HUGE number of redundant notifies for multiple
 * 		inserts by the same task.  D-Oh!
 * (Spanker=kohl)
 *
 * Revision 1.8  1999/07/08 19:00:25  kohl
 * Fixed "Log" keyword placement.
 * 	- indent with " * " for new CVS.
 *
 * Revision 1.7  1997/07/02  20:27:34  pvmsrc
 * 	Fixed startup race on shmem to that a shmem task can get fully
 * 	configured before getting any messages.
 * 	This involved adding two states
 * 	TF_PRESHMCONN and TF_SHM.  TF_PRESHMCONN indicates that messages
 * 	with MM_PRIO set can be sent to a task, but regular messages are
 * 	queued. This allows shmem tasks to be completely configured
 * 	before any messages flow.  When the daemon changes the state from
 * 	TF_PRESHMCONN to TF_SHMCONN it calls shm_wrt_pkts to write any
 * 	packets that were queued before task state changed to TF_SHMCONN.
 *
 * Revision 1.6  1997/06/27  20:05:58  pvmsrc
 * Integrated WIN32 changes.
 *
 * Revision 1.5  1997/06/27  19:22:09  pvmsrc
 * Task struct updated to hold message state info about its last message
 * 	to the RM.
 * Avoids duplicate messages and helps migrated/new RMs understand task
 * 	state.
 *
 * Revision 1.4  1997/05/27  14:44:11  pvmsrc
 * Added TF_SHMCONN for tasks that connect via shared memory instead
 * 	of sockets.
 *
 * Revision 1.3  1997/01/28  19:28:25  pvmsrc
 * New Copyright Notice & Authors.
 *
 * Revision 1.2  1996/10/24  21:47:19  pvmsrc
 * Added new TF_ISTRACER constant for tracer tasks.
 *
 * Revision 1.1  1996/09/23  23:43:35  pvmsrc
 * Initial revision
 *
 * Revision 1.4  1995/07/03  19:08:36  manchek
 * added TF_DEADSND flag
 *
 * Revision 1.3  1994/10/15  19:33:47  manchek
 * added TF_FORKD flag
 *
 * Revision 1.2  1994/06/03  20:38:28  manchek
 * version 3.3.0
 *
 * Revision 1.1  1993/08/30  23:26:52  manchek
 * Initial revision
 *
 */


/* descriptor for a pvm task */

struct task {
	struct task *t_link;		/* complete list ordered by tid */
	struct task *t_rlink;
	struct task *t_plink;		/* partial list ordered by pid */
	struct task *t_prlink;
	int t_tid;					/* task id */
#ifdef WIN32
	int t_handle;				/* task handle */
#endif
	int t_ptid;					/* parent task id */
	int t_flag;					/* status */
	int t_pid;					/* unix pid */
	int t_sock;					/* t-d tcp socket */
	struct sockaddr_in t_sad;	/* addr of sock */
	int t_salen;				/* addr length */
	struct waitc *t_wait;		/* wait channel */
	struct pkt *t_txq;			/* to task */
	struct pkt *t_rxp;			/* pkt reassembly from task */
	struct pmsg *t_rxm;			/* to-us msg reassembly from task */
	int t_out;					/* pipe from stdout/err */
	char *t_authnam;			/* d-auth file name */
	int t_authfd;				/* d-auth file desc */
	char *t_a_out;				/* a.out name (info only) */
	struct mca *t_mca;			/* mca currently in use by task */
	int t_outtid;				/* dst for stdout data */
	int t_outctx;
	int t_outtag;
	int t_trctid;				/* dst for trace data */
	int t_trcctx;
	int t_trctag;
	int	t_sched;				/* scheduler responsible for task */
	int	t_schedlmsg;			/* Last message to scheduler */
	int t_status;				/* unix exit status and code */
	struct timeval t_utime;		/* user time used */
	struct timeval t_stime;		/* system time used */
	struct ccon *t_ccs;			/* list of context ids owned by task */
};

/* to reserve communication contexts */

struct ccon {
	struct ccon *c_link;		/* complete list ordered by cid */
	struct ccon *c_rlink;
	struct ccon *c_peer;		/* list attached to an owner */
	struct ccon *c_rpeer;
	int c_cid;					/* context id */
	int c_tid;					/* owner */
};

/* t_flag bits */

#define	TF_FORKD		2		/* task process is child of pvmd */
#define	TF_CONN			4		/* task is connected */
#define	TF_AUTH			8		/* task needs to auth */
#define	TF_CLOSE		16		/* should delete ctx after flush msgs */
#define	TF_DEADSND		32		/* task is deadlocked needing shmem */
#define	TF_SHMCONN		64		/* task is connected via shmem */
#define	TF_ISSCHED		0x100	/* task is scheduler */
#define	TF_ISHOSTER		0x200	/* task is hoster */
#define	TF_ISTASKER		0x400	/* task is tasker */
#define	TF_ISTRACER		0x800	/* task is tracer */
#define	TF_PRESHMCONN	0x1000	/* task is pre-connected via shmem, */
								/* can send msgs w/MM_PRIO flag set */
#define	TF_SHM			0x2000

#define	ISLOCLTASK(x)	(((x)&tidhmask)==(hosts->ht_local<<(ffs(tidhmask)-1)))

void task_init __ProtoGlarp__(( void ));
int tid_new __ProtoGlarp__(( void ));
struct task *task_new __ProtoGlarp__(( int tid ));
struct task *task_find __ProtoGlarp__(( int tid ));
struct task *task_findpid __ProtoGlarp__(( int pid ));
void task_setpid __ProtoGlarp__(( struct task *tp, int pid ));
void task_cleanup __ProtoGlarp__(( struct task *tp ));
void task_free __ProtoGlarp__(( struct task *tp ));
struct ccon *ccon_new __ProtoGlarp__(( struct task *tp ));