+#if VAX780
+ /*
+ * On 780's, impelement a fast UBA watcher,
+ * to make sure uba's don't get stuck.
+ */
+ if (cpu == VAX_780 && panicstr == 0 && !BASEPRI(ps))
+ unhang();
+#endif
+ /*
+ * Schedule a software interrupt for the rest
+ * of clock activities.
+ */
+ setsoftclock();
+}
+
+/*
+ * The digital decay cpu usage priority assignment is scaled to run in
+ * time as expanded by the 1 minute load average. Each second we
+ * multiply the the previous cpu usage estimate by
+ * nrscale*avenrun[0]
+ * The following relates the load average to the period over which
+ * cpu usage is 90% forgotten:
+ * loadav 1 5 seconds
+ * loadav 5 24 seconds
+ * loadav 10 47 seconds
+ * loadav 20 93 seconds
+ * This is a great improvement on the previous algorithm which
+ * decayed the priorities by a constant, and decayed away all knowledge
+ * of previous activity in about 20 seconds. Under heavy load,
+ * the previous algorithm degenerated to round-robin with poor response
+ * time when there was a high load average.
+ */
+#undef ave
+#define ave(a,b) ((int)(((int)(a*b))/(b+1)))
+int nrscale = 2;
+double avenrun[];
+
+/*
+ * Constant for decay filter for cpu usage field
+ * in process table (used by ps au).
+ */
+double ccpu = 0.95122942450071400909; /* exp(-1/20) */
+
+/*
+ * Software clock interrupt.
+ * This routine runs at lower priority than device interrupts.
+ */
+/*ARGSUSED*/
+softclock(pc, ps)
+ caddr_t pc;
+{
+ register struct callout *p1;
+ register struct proc *pp;
+ register int a, s;
+ caddr_t arg;
+ int (*func)();
+
+ /*
+ * Perform callouts (but not after panic's!)
+ */
+ if (panicstr == 0) {
+ for (;;) {
+ s = spl7();
+ if ((p1 = calltodo.c_next) == 0 || p1->c_time > 0) {
+ splx(s);
+ break;
+ }
+ calltodo.c_next = p1->c_next;
+ arg = p1->c_arg;
+ func = p1->c_func;
+ p1->c_next = callfree;
+ callfree = p1;
+ (void) splx(s);
+ (*func)(arg);
+ }
+ }
+
+ /*
+ * Drain silos.
+ */
+#if NDH > 0
+ s = spl5(); dhtimer(); splx(s);
+#endif
+#if NDZ > 0
+ s = spl5(); dztimer(); splx(s);
+#endif
+
+ /*
+ * If idling and processes are waiting to swap in,
+ * check on them.
+ */
+ if (noproc && runin) {
+ runin = 0;
+ wakeup((caddr_t)&runin);
+ }
+
+ /*
+ * Run paging daemon every 1/4 sec.
+ */
+ if (lbolt % (hz/4) == 0) {