File: process.sgml

package info (click to toggle)
visualos 1.0.3.cvs20011122-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 5,276 kB
  • ctags: 2,014
  • sloc: ansic: 13,526; sh: 3,291; makefile: 693; yacc: 439
file content (255 lines) | stat: -rw-r--r-- 9,308 bytes parent folder | download
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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
<refentry id="VisualOS-Processes">
<refmeta>
<refentrytitle>Processes</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>VISUALOS Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>Processes</refname><refpurpose>Process Handling.</refpurpose>
</refnamediv>

<refsynopsisdiv><title>Synopsis</title>
<synopsis>



<link linkend="proc-t">proc_t</link>*     <link linkend="create-process">create_process</link>                  (void);
<link linkend="proc-t">proc_t</link>*     <link linkend="new-process">new_process</link>                     (void);
void        <link linkend="insert-process">insert_process</link>                  (<link linkend="proc-t">proc_t</link> *proc);
void        <link linkend="free-process">free_process</link>                    (<link linkend="proc-t">proc_t</link> *proc);
<link linkend="gint">gint</link>        <link linkend="destroy-process">destroy_process</link>                 (<link linkend="proc-t">proc_t</link> *proc);
<link linkend="proc-queue-t">proc_queue_t</link> <link linkend="get-proc-list">get_proc_list</link>                  (void);
<link linkend="proc-t">proc_t</link>*     <link linkend="get-proc-by-pid">get_proc_by_pid</link>                 (<link linkend="gint">gint</link> pid);
void        <link linkend="select-process">select_process</link>                  (<link linkend="proc-t">proc_t</link> *proc);
<link linkend="proc-t">proc_t</link>*     <link linkend="get-CPU-selected-proc">get_CPU_selected_proc</link>           (void);
void        <link linkend="save-processes-to-file">save_processes_to_file</link>          (void);
void        <link linkend="load-processes-from-file">load_processes_from_file</link>        (void);
#define     <link linkend="burst">burst</link>                           (proc)
</synopsis>
</refsynopsisdiv>





<refsect1>
<title>Description</title>
<para>
This functions provide general process handling. Creation, insertion into the
system, destruction, finding a certain process...
</para>
</refsect1>

<refsect1>
<title>Details</title>
<refsect2>
<title><anchor id="create-process">create_process ()</title>
<programlisting><link linkend="proc-t">proc_t</link>*     create_process                  (void);</programlisting>
<para>
Do everything necesary to  have a new process in the system.</para>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> the newly created process.
</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="new-process">new_process ()</title>
<programlisting><link linkend="proc-t">proc_t</link>*     new_process                     (void);</programlisting>
<para>
Allocate data for new process.
</para>
<para>
Note: the process will have to be inserted to have any efect.</para>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> the newly allocate process data.
</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="insert-process">insert_process ()</title>
<programlisting>void        insert_process                  (<link linkend="proc-t">proc_t</link> *proc);</programlisting>
<para>
Inserts process <parameter>proc</parameter> in the system.
</para>
<para>
Note: <parameter>proc</parameter> can be obtained with <parameter>new_process</parameter>.</para>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>proc</parameter>&nbsp;:</entry>
<entry> the process involved.
</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="free-process">free_process ()</title>
<programlisting>void        free_process                    (<link linkend="proc-t">proc_t</link> *proc);</programlisting>
<para>
Definitely free all data related to <parameter>proc</parameter>.
</para>
<para>
Note: <parameter>proc</parameter> will be gone for good.</para>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>proc</parameter>&nbsp;:</entry>
<entry> process involved.
</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="destroy-process">destroy_process ()</title>
<programlisting><link linkend="gint">gint</link>        destroy_process                 (<link linkend="proc-t">proc_t</link> *proc);</programlisting>
<para>
Start considering <parameter>proc</parameter> a terminated process and remove it from the
system.
</para>
<para>
Note: the data of <parameter>proc</parameter> is not freed, and <parameter>proc</parameter> will be saved by
<parameter>save_processes_to_file</parameter>.</para>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>proc</parameter>&nbsp;:</entry>
<entry> process involved.
</entry></row>
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> nothing important.
</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="get-proc-list">get_proc_list ()</title>
<programlisting><link linkend="proc-queue-t">proc_queue_t</link> get_proc_list                  (void);</programlisting>
<para>
</para>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> the list of all currently running processes.
</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="get-proc-by-pid">get_proc_by_pid ()</title>
<programlisting><link linkend="proc-t">proc_t</link>*     get_proc_by_pid                 (<link linkend="gint">gint</link> pid);</programlisting>
<para>
</para>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>pid</parameter>&nbsp;:</entry>
<entry> process ID
</entry></row>
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> the data of process <parameter>pid</parameter> or NULL if there is no process
with PID <parameter>pid</parameter>.
</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="select-process">select_process ()</title>
<programlisting>void        select_process                  (<link linkend="proc-t">proc_t</link> *proc);</programlisting>
<para>
Makes <parameter>proc</parameter> the selected process.
</para>
<para>
Note: some code will do things to the selected process.</para>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>proc</parameter>&nbsp;:</entry>
<entry> process involved.
</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="get-CPU-selected-proc">get_CPU_selected_proc ()</title>
<programlisting><link linkend="proc-t">proc_t</link>*     get_CPU_selected_proc           (void);</programlisting>
<para>
Find out which is the currently selected process</para>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> the currently selected process.
</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="save-processes-to-file">save_processes_to_file ()</title>
<programlisting>void        save_processes_to_file          (void);</programlisting>
<para>
Asks the user for a filename and saves all processes on the current
session to a file, ready to be loaded in a new session.
</para>
<para>
Note: Both terminated and not yet running processes will be written.</para>
<para>

</para></refsect2>
<refsect2>
<title><anchor id="load-processes-from-file">load_processes_from_file ()</title>
<programlisting>void        load_processes_from_file        (void);</programlisting>
<para>
Asks the user for a filename and loads all processes it can find it it.
</para>
<para>
Note: Not all processes will be visible at once, they will be inserted
at the right time.</para>
<para>

</para></refsect2>
<refsect2>
<title><anchor id="burst">burst()</title>
<programlisting>#define burst(proc) (proc-&gt;next_event.time - proc-&gt;time)
</programlisting>
<para>
Calculates the current burst (time until next voluntary event) for <parameter>proc</parameter>.</para>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>proc</parameter>&nbsp;:</entry>
<entry> process involved.
</entry></row>
</tbody></tgroup></informaltable></refsect2>

</refsect1>




</refentry>