• Aucun résultat trouvé

Monitoring usage

Dans le document Series DAP (Page 138-143)

Controlling multi-programming on the DAP

7.3 Monitoring usage

A record is kept in a file on the host of all programs submitted to the DAP along with details of their execution times. This file, /usr/adm/dapsyslog, is opened and written to by the dapboot process, and entries are made in it each time a program is unloaded from the DAP.

The following information is recorded in the file:

• The user name

• The DAP program name

• The time the system loaded the program

• The time the system unloaded the program

• The total DAP milltime used by the program

• The priority that was current when the program was unloaded

In addition, entries are also made in the file whenever the value of timeslice is changed.

All users have read access to this file and each time dapboot is invoked it opens the file in append mode. If you are a system manager, you may find it useful to reduce the size of the file periodically by editing out some of the earlier entries, to save disk space.

728 manOO3.04 AMT

7.3: Monitoring usage 729

7.3.1 Facilities available

The low-level library supplied with the DAP basic software provides the system manager and users with routines to:

• Suspend a DAP process.

• Restart a DAP process.

• Print information about one particular DAP process, or about all DAP processes.

• Kill a DAP process.

• Set the priority of a DAP process.

• Set the value of the system timeslice.

The routines use a reserved channel to communicate with the DAP, so there is no danger of their being unable to gain access to the DAP, even when the DAP is being heavily used. You access these routines via a suitable interface that you can tailor to your own requirements; dapoipis a program which includes a simple example of an AMT-written interface, and is described in section 7.3.3 on page 131.

Any number of interface programs using these routines can be running at the same time, but an error will be reported it the dapboot process is not already running when a routine is called.

7.3.2 Specification of the routines

The low-level routines provided for you to control your multi-programming environment are held in the file /usr/lth/dap/dapcontrol.o.

The specifications of the routines are:

• void priority(proc-id, prior) short proc-id, prior;

The priority of process proc-id is set to prior, providing the current effective user (as defined by normal UNIX practice) is either the owner of proc-id, or is root.

• void timeslicefts)

mt

ts;

If ts=0, then the current value of the timeslice is sent to your standard output channel (usually the host screen);

otherwise the timeslice is set to ts.

• void list(proc-id) short proc-id;

If proc-id= 0, then information on all DAP processes is sent to standard output, otherwise information on process proc-id is sent. The current value of the system timesl ice is also sent.

DAP Series: Program Development under UNIX manOO3.04 729

The information is given under the following headings:

DAPID The DAP process ID

EPID The associated host process ID

Dev The minor device number the process has open Status Oneof:

Idle Queued Loading

Sus’d (for suspended) Running

Unloading Unloaded Pri’ty The priority of the process

Milltime The total DAP militime used by the process, in milliseconds

S_state If the process is suspended (or if it will be as soon as it is fully loaded), S_state will be some combination of:

R returned to the host program

P paused (or is in some diagnostic mode) B halted and dumping after a signal S suspended byroot

s suspended by the owner W awaiting the next timeslice a opening a host file

1 seeking within a host file

t establishing current position within a host file d transferring data to or from a host file r closing a host file

F using the fast input and output channel (I/O) V using the VME

Only when nothing is set in this S_state field is a program actually executing

Username The owner of the process

Dofname The name of the DOF file containing the DAP program

• void dapkill(proc-id) short proc-id;

If the current effective user either is the owner of DAP process proc-id, or is root, then that process and its associated host program are killed.

730 manOO3.04 AMT

7.3: Monitoring usage 731

• void suspend(proc-id) short proc-id;

If the current effective user either is the owner of DAP process proc-id, or is root, then that process will become suspended by the owner or by root respectively.

• void restart(proc-id) short proc-id;

If the current effective user either is the owner of DAP process proc-id, or is root, and that process has been suspended by that user, then the suspension is lifted.

7.3.3 Example interface

The command dapoip invokes a simple example interface built onto the routines described above. Once invoked, it continually asks for commands by displaying its prompt:

dapoip:

The commands available are:

h Print this help text.

k n Kill process n.

1 [n] List the status of process n, or of all DAP processes if n is absent.

p n m Set priority of process n to m. The command is only valid ititis issued by the owner of the DAP process n (who can set priority to a value within the range 1—5), or root (who can set priority within the range 1-10).

q Leave dapoip.

r n Resume process n.

s n Suspend processn.

t [n] Set system timeslice to n. If n is 0 or absent, show the current value of timeslice. t can only be changed by root, who can set it to a value in the range 1-255.

To illustrate the sort of display you might get, the simple example program used in chapter 4 was run on DAP hardware (on which two otherDAPprograms were already running), and dapoipstarted. The display produced was:

host%

dapoip: 1

DPID HPID 0ev Status Pri’ty Militime S_state Username Dofname

510 26209 3 Sus’d 5 299633 RW djh rippledap

517 26233 2 Queued 5 0 sjh testmat7

518 26291 4 Sus’d 5 0 PW asb dapobj

Timeslice: 10 dapoip:

DAP Series: Program Development under UNIX man003.04 137

.

.

132 manOO3.04 AMT

733

Appendix A

Dans le document Series DAP (Page 138-143)