3 proc \- running processes
31 device serves a two-level directory structure.
32 The first level contains the
34 file (see below) and numbered directories
35 corresponding to pids of live processes;
36 each such directory contains a set of files
37 representing the corresponding process.
41 file contains the current memory image of the process.
42 A read or write at offset
44 which must be a valid virtual address,
45 accesses bytes from address
47 up to the end of the memory segment containing
49 Kernel virtual memory, including the kernel stack for the process and
50 saved user registers (whose addresses are machine-dependent),
51 can be accessed through
53 Writes are permitted only while the process is in the
55 state and only to user addresses or registers.
59 file contains the kernel per-process
61 Its main use is to recover the kernel stack and program counter
69 hold representations of the user-level registers, floating-point registers,
70 and kernel registers in machine-dependent form.
77 file lists the open file descriptors of the process.
78 The first line of the file is its current directory; subsequent lines list, one per line,
79 the open files, giving the decimal file descriptor number; whether the file is open for read
85 the type, device number, and qid of the file; its I/O unit (the amount of data
86 that may be transferred on the file as a contiguous piece; see
88 its I/O offset; and its name at the time it was opened.
92 file contains a textual representation of the process's file name space, in the format of
98 The last line of the file identifies the current working directory of the process, in the form of a
103 The information in this file is based on the names files had when the name space was assembled,
104 so the names it contains may be inaccessible if the files have been subsequently renamed or rearranged.
108 file contains a textual display of the memory segments
109 attached to the process. Each line has multiple fields:
110 the type of segment (\c
115 etc.); one-letter flags such as
117 for read-only, if any;
118 starting virtual address, in hexadecimal;
119 ending virtual address, and reference count.
123 file contains a string with twelve fields, each followed by a space.
126 the process name and user name, each 27 characters left justified
128 the process state, 11 characters left justified (see
131 the six 11-character numbers also held in the process's
135 the amount of memory used by the process in units of 1024 bytes
137 the base and current scheduling priority, each 11 character numbers
141 file contains the arguments of the program when it was created by
143 If the program was not created by
150 The format of the file is a list of quoted strings suitable for
157 file is a pseudonym for the file
158 from which the process was executed;
159 its main use is to recover the symbol table of the process.
163 file may be read to recover
164 records from the exiting children of the process in the format of
168 If the process has no extant children, living or exited,
172 It is an error for a process to attempt to read its own
174 file when it has no children.
178 the process will draw an error
181 system call; similarly, if a process is in an
185 file cannot be read by any process.
189 file contains the instruction frequency count information used for multiprocess profiling; see
193 The information is gleaned by sampling the program's user-level program counter
196 Strings written to the
198 file will be posted as a note to the process
201 The note should be less than
204 the last character is reserved for a terminating NUL character.
207 characters will retrieve the oldest note posted to the
208 process and prevent its delivery to the process.
211 file is similar, but the note will be delivered to all the
212 processes in the target process's
216 However, if the process doing the write is in the group,
217 it will not receive the note.
224 file may be read to recover an integer identifying the note group of the process
229 The file may be written to cause the process to change to another note group,
230 provided the group exists and is owned by the same user.
234 can be opened once and read to see trace events from processes that have
240 Each event produces, in native machine format, the
247 .B /sys/include/trace.h
249 .BR /sys/src/cmd/trace.c ).
252 Textual messages written to the
254 file control the execution of the process.
255 Some require that the process is in a particular state
256 and return an error if it is not.
259 Suspend execution of the process, putting it in the
264 Resume execution of a
269 Do not affect the process directly but, like all other messages ending with
271 block the process writing the
273 file until the target process is in the
279 if the target process would receive a note while the message is pending,
280 it is instead stopped and the debugging process is resumed.
285 process to resume, and then do a
290 Set a bit in the process so that,
293 system call, it will enter the
295 state before returning to user mode.
296 This bit is inherited across
302 Close file descriptor
307 Close all open file descriptors in the process.
313 Don't allow this process to be swapped out. This should
314 be used carefully and sparingly or the system could run
315 out of memory. It is meant for processes that can't be
316 swapped, like the ones implementing the swap device and for
317 processes containing sensitive data.
320 Kill the process the next time it crosses the user/kernel boundary.
323 Make it impossible to read the process's user memory.
324 This property is inherited on fork, cleared on
326 and is not otherwise resettable.
329 Set the base priority for the process to the integer
333 Wire the process to processor
337 Without an argument, toggle trace event generation for this process into
340 With a zero argument, tracing for the proc is turned off, with a non-zero numeric
341 argument, it is turned on.
344 Interrupt a blocking system call. If no blocking call was in progress,
345 the interrupt will be pending and the next attempt to block will be interrupted.
346 This is similar to posting a note but, unlike notes, a pending interrupt is not
347 cleared when crossing the user/kernel boundary.
350 Clear a pending interrupt.
353 Set the real-time scheduling period of the process to
357 is an optionally signed number containing an optional decimal point and
366 empty. The time is interpreted, respectively, as
372 or, in the case of an absent units specifier, as
374 If the time specifier is signed, it is interpreted as an increment or decrement
375 from a previously set value. See also the
380 Set the real-time deadline interval of the process to
386 are interpreted as for
391 Set the real-time cost (maximum CPU time per period) of the process to
397 are interpreted as for
402 Use sporadic scheduling for the real-time process. The description of the
404 command below contains further details.
407 Make the real-time process yield on blocking I/O.
408 The description of the
410 command below contains further details.
424 perform a schedulability test and start scheduling the process as a real-time
425 process if the test succeeds. If the test fails, the
427 will fail with error set to the reason for failure.
430 Add a user event to the
435 .SS Real-time scheduling
437 processes are periodically
439 giving them a higher priority than non-real-time processes until they either
440 give up the processor voluntarily, they exhaust their CPU allocation, or they reach their
442 The moment of release is dictated by the
444 and whether the process is
447 Non-sporadic processes are called
449 and they are released precisely at intervals of their period (but periods can be skipped
450 if the process blocks on I/O).
451 Sporadic processes are released whenever they become
452 runnable (after being blocked by
454 or I/O), but always at least an interval of
456 after the previous release.
460 of a real-time process specifies that the process must complete within the first
464 The dealine must be less than or equal to the period.
465 If it is not specified, it is set to the period.
469 of a real-time process describes the maximum CPU time the process may use per period.
471 A real-time process can give up the CPU before its deadline is reached
472 or its allocation is exhausted.
473 It does this by calling
477 is specified, it also does it by executing any blocking system call.
483 Of the released processes,
484 the one with the earliest deadline has the highest priority.
485 Care should be taken using spin locks (see
487 because a real-time process spinning on a lock will not give up the processor until
488 its CPU allocation is exhausted; this is unlikely to be the desired behavior.
490 When a real-time process reaches its deadline or exhausts its CPU allocation, it remains
491 schedulable, but at a very low priority.
493 The priority is interpreted by Plan 9's multilevel process scheduler.
494 Priorities run from 0 to 19, with higher
495 numbers representing higher priorities.
496 A process has a base priority and
497 a running priority which is less than or equal to the base priority.
498 As a process uses up more of its allocated time, its priority is lowered.
500 explicitly set, user processes have base priority 10, kernel processes
502 Children inherit the parent's base priority.
505 .B /sys/src/9/*/mem.h
506 .B /sys/src/9/*/dat.h
507 .B /sys/include/trace.h
515 .B /sys/src/9/port/devproc.c