~ubuntu-branches/ubuntu/utopic/gridengine/utopic

« back to all changes in this revision

Viewing changes to source/libs/cull/cull.html

  • Committer: Bazaar Package Importer
  • Author(s): Mark Hymers
  • Date: 2008-06-25 22:36:13 UTC
  • Revision ID: james.westby@ubuntu.com-20080625223613-tvd9xlhuoct9kyhm
Tags: upstream-6.2~beta2
ImportĀ upstreamĀ versionĀ 6.2~beta2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
 
2
<html>
 
3
<head>
 
4
   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
 
5
   <meta http-equiv="CONTENT-TYPE" content="text/html; charset=iso-8859-1">
 
6
   <meta name="GENERATOR" content="Mozilla/4.76C-CCK-MCD Netscape [en] (X11; U; SunOS 5.8 sun4u) [Netscape]">
 
7
   <meta name="AUTHOR" content="Ernst Bablick">
 
8
   <meta name="CREATED" content="20010608;9201000">
 
9
   <meta name="CHANGEDBY" content="Ernst Bablick">
 
10
   <meta name="CHANGED" content="20010703;14194400">
 
11
<style>
 
12
        <!--
 
13
                @page { margin-left: 1.25in; margin-right: 1.25in; margin-top: 1in; margin-bottom: 1in }
 
14
                P.sdfootnote { margin-left: 0.2in; text-indent: -0.2in; margin-bottom: 0in; font-size: 10pt }
 
15
                A.sdfootnoteanc { font-size: 57% }
 
16
        -->
 
17
        </style>
 
18
</head>
 
19
<body>
 
20
 
 
21
<h1 STYLE="margin-top: 0.17in; page-break-after: avoid">
 
22
<b><font face="Times New Roman, serif">Common Usable List Library<a NAME="sdfootnote1anc" CLASS="sdfootnoteanc" HREF="#sdfootnote1sym"></a><a NAME="sdfootnote1anc" href="#sdfootnote1sym" CLASS="sdfootnoteanc"></a><sup><a href="#sdfootnote1sym" CLASS="sdfootnoteanc" NAME="sdfootnote1anc">1</a></sup></font></b></h1>
 
23
 
 
24
<h2>
 
25
Capabilities of the Common Usable List Library (CULL)</h2>
 
26
The CULL allows to create and maintain so called CULL lists, which are
 
27
the central Grid Engine data structure in which almost all Grid Engine
 
28
data, such as jobs, queues, hosts, etc., are stored. The CULL has the following
 
29
features:
 
30
<ul>
 
31
<ul>applicability for every client/server in Grid Engine.
 
32
 
 
33
<p STYLE="margin-bottom: 0in">reusability of list management code.
 
34
<p>no need for recompilation of client code in case of uncritical data
 
35
structure changes.
 
36
<p>interface duality - either list oriented or SQL inspired.
 
37
<p>fast search functions using hash tables</ul>
 
38
</ul>
 
39
The CULL is the building block for the Grid Engine Database Interface (GDI
 
40
- see&nbsp; <a href="../gdi/gdi.html">here</a>).
 
41
<br>&nbsp;
 
42
<h2>
 
43
Internal data structures</h2>
 
44
See below for a schematic overview of the CULL internal list data structure:
 
45
<br>&nbsp;
 
46
<br>&nbsp;
 
47
<br>
 
48
<br>
 
49
<br>
 
50
<center>
 
51
<p><img SRC="list_struct.jpg" NAME="Grafik1" BORDER=0 height=530 width=524 align=BOTTOM></center>
 
52
 
 
53
<p><br>
 
54
<br>
 
55
<h3>
 
56
lList</h3>
 
57
This is the structure for the list header. The meaning of the different
 
58
fields is stated in the comments of the structure definition below. The
 
59
position and type information for all list elements is maintained in the
 
60
lDescr array. The element data itself can be referenced via the first and
 
61
last pointers.
 
62
<pre>typedef struct {
 
63
int nelem; /* number of elements in the list */
 
64
char *listname; /* name of the list */
 
65
lDescr *descr; /* pointer to the descriptor array */
 
66
lListElem *first; /* pointer to the first element of the list */
 
67
lListElem *last; /* pointer to the last element of the list */
 
68
} lList;</pre>
 
69
 
 
70
<h3>
 
71
lListElem</h3>
 
72
The following structure defines a list element being used to store data
 
73
in CULL lists. The data storage occurs in arrays of lMultiType unions (see
 
74
below). The access to the data is performed by getting the array index
 
75
and the field type through the lDescr struct array. The field descr is
 
76
used for type checking.
 
77
<pre>typedef struct {
 
78
lListElem *next; /* next lList element */
 
79
lListElem *prev; /* previous lList element */
 
80
lUlong status; /* status: element in list/ element free */
 
81
lDescr *descr; /* pointer to the descriptor array */
 
82
lMultiType *cont; /* pointer to the lMultiType array */
 
83
} lListElem;</pre>
 
84
 
 
85
<h3>
 
86
lDescr</h3>
 
87
The descriptor struct contains two integer fields. One is representing
 
88
the name of the field and the other one the associated type. The names
 
89
are represented by unique numbers, which can be mapped to enum definitions
 
90
or #define statements (the steps to define a list are shown below.)
 
91
<pre>typedef struct {
 
92
int nm;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* unique number that stands for a name */
 
93
int mt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* multitype information */
 
94
lHash *hash;&nbsp;/*&nbsp;hashing information */
 
95
} lDescr;</pre>
 
96
 
 
97
<h3>
 
98
lHash</h3>
 
99
The lHash structure stores information about hash tables to be used for
 
100
certain data fields.
 
101
<br>For each data field that shall be accessed by a hash table, the corresponding
 
102
descriptor (lDesc) contains a reference to an lHash object. The lHash object
 
103
defines the type of hash table (unique or non unique keys) and a pointer
 
104
to a HashTable object.
 
105
<pre>typedef struct {
 
106
int unique;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /*&nbsp;0 =&nbsp;non unique keys, 1 = unique keys */
 
107
HashTable table;&nbsp;/* pointer to HashTable from libs/uti/sge_hash.* */
 
108
} lHash;</pre>
 
109
 
 
110
<h3>
 
111
lMultiType</h3>
 
112
The lMultiType union consists of various basic types. Which union member
 
113
has to be accessed is determined by the type field ("mt") in the lDescr
 
114
struct. An array of lMultiType unions contains the data.
 
115
<pre>typedef union {
 
116
lFloat fl; /* float */
 
117
lDouble db; /* double */
 
118
lUlong ul; /* unsigned long */
 
119
lLong l; /* long */
 
120
lChar c; /* char */
 
121
lInt i; /* int */
 
122
lString str; /* char* */
 
123
lList *glp<b>;</b> /* sublist */
 
124
lRef ref; /* pointer */
 
125
lCondition *cp<b>;</b> /* lCondition pointer */
 
126
} lMultiType;</pre>
 
127
 
 
128
<h2>
 
129
Usage of the Generic List</h2>
 
130
In the directory source/lib/cull you can find one example which demonstrates
 
131
how to use CULL lists. To build it use the aimk script: "aimk example1"
 
132
<h3>
 
133
List definition</h3>
 
134
Each CULL list definition consists of following parts:
 
135
 
 
136
<p STYLE="margin-left: 0.79in">Definition of some constants which identify
 
137
the attributes of a CULL element.
 
138
 
 
139
<p STYLE="margin-left: 0.79in">A Section which defines the type of the
 
140
attributes of a CULL element.
 
141
 
 
142
<p STYLE="margin-left: 0.79in">A List of names used when a attribute name
 
143
should be written in readable form.
 
144
<p>You can find a definition for a CULL list <a href="hostL.h">here</a>.
 
145
Lists used in Grid Engine are part of the GDI library. Concerning source
 
146
code can be found in source/libs/gdi. Each file whose filename ends with
 
147
an capital L before the .h suffix contains CULL list definitions.
 
148
<h3>
 
149
Definition of Name Space</h3>
 
150
Suppose you intend to write a piece of Grid Engine code based on a new
 
151
CULL list. One thing you should do is to define the names to be used for
 
152
the CULL list elements and you have to make sure that none of your names
 
153
conflicts with already existing names. For this purpose you have to select
 
154
one or several of the predefined name spaces, which are defined in the
 
155
header boundaries.h (see <a href="boundaries.h">here</a>). By using one
 
156
or multiple name spaces, you can create your own list structure as shown
 
157
below.
 
158
<p>The file source/libs/gdi/sge_boundaries.h contains the name space definition
 
159
for Grid Engine.
 
160
<h3>
 
161
Application Specific Header File</h3>
 
162
 
 
163
<div STYLE="margin-bottom: 0in">Each attribute within a CULL object is
 
164
uniquely identified by a constant value which will be used to get or modify
 
165
its value. For output and debug purpose it is extremely valuable to use
 
166
strings instead of enum values. Therefore all the list structures that
 
167
shall be used, should be included in an application specific header file.
 
168
Here an array of type lNameSpace has to be defined. This table will be
 
169
used to convert field names to field numbers and vice versa within the
 
170
CULL library.</div>
 
171
 
 
172
<div STYLE="margin-bottom: 0in">The example1.h file can be found <a href="example1.h">here</a>.
 
173
The file source/libs/gdi/sge_all_listsL.h containes the array used in Grid
 
174
Engine.</div>
 
175
 
 
176
<h3>
 
177
List Usage Example</h3>
 
178
 
 
179
<div STYLE="margin-bottom: 0in">In the the C file <a href="example1.c">example1.c</a>
 
180
the usage of the various CULL list library functions is explained. Run
 
181
the corresponding application without any arguments to get a list of scenarios
 
182
demonstrated by the example.</div>
 
183
 
 
184
<h3>
 
185
<br>
 
186
Functional Overview</h3>
 
187
 
 
188
<div STYLE="margin-bottom: 0in">The most important functions of the CULL
 
189
are explained in the man page <a href="list_intro.txt">list_intro</a>(3).
 
190
In addition, more high level composite funtions exist, which combine the
 
191
use of several basic functions for standard tasks. Using these composite
 
192
functions may reduce the size of the code dramatically. There are no man
 
193
pages available for the composite functions currently but they are documented
 
194
in the sourcecode. Here their names are listed:</div>
 
195
 
 
196
<div STYLE="margin-bottom: 0in">lGetElemCaseStr(), lGetElemDescr(), lGetElemHost(),
 
197
lGetElemIndex(), lGetElemStr(), lGetElemStrLike(), lGetElemUlong(), lGetSubCaseStr(),
 
198
lGetSubHost(), lGetSubStr(), lGetSubUlong(), lAddElemUlong(), lAddElemStr(),
 
199
lAddSubStr(), lAddSubUlong(), lDelElemCaseStr(), lDelElemHost(), lDelElemStr(),
 
200
lDelElemUlong(), lDelSubCaseStr(), lDelSubStr(), lDelSubUlong()</div>
 
201
 
 
202
<div ID="sdfootnote1">
 
203
<center><a NAME="sdfootnote1sym" CLASS="sdfootnotesym" HREF="#sdfootnote1anc"></a><a NAME="sdfootnote1sym" href="#sdfootnote1anc" CLASS="sdfootnotesym"></a><a href="#sdfootnote1anc" CLASS="sdfootnotesym" NAME="sdfootnote1sym">1</a>Copyright
 
204
2001 Sun Microsystems, Inc. All rights reserved.</center>
 
205
</div>
 
206
 
 
207
</body>
 
208
</html>