DIRECTORY DragOps USING [Word, ZerosWord]; Process: CEDAR DEFINITIONS = BEGIN Word: TYPE = DragOps.Word; Queue: TYPE = LONG POINTER TO QueueRep; QueueRep: TYPE = RECORD [ busy: Process, -- a GSL that protects the chain chain: Process -- points to the tail of a circular process queue ]; MetaQueue: TYPE = LONG POINTER TO Process; MetaQueueRep: TYPE = Process; MonitorLock: TYPE = LONG POINTER TO MonitorLockRep; MonitorLockRep: TYPE = RECORD [ queue: QueueRep, -- the GQ of waiting processes owner: Process -- the process owning the lock ]; InitializeMonitorLock: PROC [monitorLock: MonitorLock] = TRUSTED INLINE {monitorLock^ _ [queue: [NIL, NIL], owner: NIL]}; Condition: TYPE = LONG POINTER TO ConditionRep; ConditionRep: TYPE = RECORD [ queue: QueueRep, -- the GQ of waiting processes timeout: Ticks, -- the timeout initialization flags: CondFlags -- option flags ]; Ticks: TYPE = CARD; NoTimeout: Ticks = 0; Milliseconds: TYPE = CARD; Seconds: TYPE = CARD; CondFlags: TYPE = Word; abortEnableBit: NAT = 31; condRequestBit: NAT = 30; InitializeCondition: PROC [condition: Condition, ticks: Ticks] = TRUSTED INLINE { condition^ _ [queue: [NIL, NIL], timeout: NoTimeout, flags: DragOps.ZerosWord] }; MsecToTicks: SAFE PROC [Milliseconds] RETURNS [Ticks]; SecondsToTicks: SAFE PROC [Seconds] RETURNS [Ticks]; TicksToMsec: SAFE PROC [Ticks] RETURNS [Milliseconds]; SetTimeout: PROC [condition: Condition, ticks: Ticks] = TRUSTED INLINE {condition.timeout _ IF ticks = NoTimeout THEN NoTimeout+1 ELSE ticks}; DisableTimeout: PROC [condition: Condition] = TRUSTED INLINE {condition.timeout _ NoTimeout}; InterruptCondition: TYPE = LONG POINTER TO InterruptConditionRep; InterruptConditionRep: TYPE = RECORD [queue: QueueRep, timeout: Word, requests: Word]; ProcessPtr: TYPE = LONG POINTER TO Process; Process: TYPE = LONG POINTER TO ProcessRep; ProcessRep: TYPE = RECORD [ queue: Queue, -- pointer to queue that this process is waiting for next: Process, -- next process in above circular queue meta: Process, -- next process in ready queue, timeout queue or page fault queue when: Word, -- when timeout will occur OR page number for fault priority: Priority, -- priority of this process abort: AbortState, -- aborting state state: ProcessState, -- process state euState: EUstate -- useful registers in EU ]; Priority: TYPE = MACHINE DEPENDENT { slothful (0), -- user-level deep background processing (idle) sluggish (1), -- user-level background processing normal (2), -- user-level normal processing perky (3), -- user-level foreground processing nervous (4), -- system-level ?? processing jumpy (5), -- system-level ?? processing excited (6), -- system-level real-time processing hyper (7) -- system-level emergency processing }; ProcessState: TYPE = MACHINE DEPENDENT { free (0), -- process is on free list running (1), -- process is running (assigned to a processor) ready (2), -- process is ready to run (on ready queue) waitingPage (3), -- process is waiting for page fault (on page fault queue) waitingCV (4), -- process is waiting for CV waitingML (5), -- process is waiting for ML waitingICV (6), -- process is waiting for ICV done (7) -- process is done (waiting for Join) }; AbortState: TYPE = MACHINE DEPENDENT { none (0), -- process not requested to abort requested (1), -- process abort requested inhibited (2), -- process abort not allowed & not requested delayed (3) -- process abort requested but not allowed }; EUstateIndex: TYPE = MACHINE DEPENDENT { carry (0), -- the carry bit (not really a register) field (1), -- shifter control hook (2), -- pointer to the youngest frame saved to memory (a nacho) framesLeft (3), -- frames left before fault occurs temp0 (4), -- user aux reg 0 temp1 (5), -- user aux reg 1 temp2 (6), -- user aux reg 2 temp3 (7) -- user aux reg 3 }; EUstate: TYPE = ARRAY EUstateIndex OF Word; Detach: PROC [PROCESS]; SetPriority: SAFE PROC [p: Priority] = TRUSTED INLINE { }; Abort: PROC [Process]; CheckForAbort: SAFE PROC; DisableAborts: PROC [condition: Condition] = TRUSTED INLINE {condition^.flags[abortEnableBit] _ FALSE}; EnableAborts: PROC [condition: Condition] = TRUSTED INLINE {condition^.flags[abortEnableBit] _ TRUE}; Pause: SAFE PROC [ticks: Ticks]; Yield: SAFE PROC = TRUSTED INLINE{ DirectedYield[] }; DirectedYield: UNSAFE PROC [nextState: ProcessState _ ready, nextProcess: Process _ NIL, when: Ticks _ 0]; SetTimeSlice: SAFE PROC [ticks: Ticks]; ValidateProcess: PROC [Process]; InvalidProcess: ERROR [process: Process]; Processor: TYPE = LONG POINTER TO ProcessorRep; ProcessorRep: TYPE = RECORD [ next: Processor, -- next processor in ring orders: ProcessorOrders, -- orders for what to do after reschedule switchTo: Process, -- if orders = switchToGiven, then this is the one to switch to running: Process -- the process currently being run ]; ProcessorOrders: TYPE = MACHINE DEPENDENT { reset (0), -- useful during system init (?) noChange (1), -- ignore the reschedule switchToGiven (2), -- switch to process given by processor.switchTo (NIL => to best) panicStop (3), -- save current process, then spin on these orders stopped (4) -- stopped in response to panicStop }; RequestKind: TYPE = [0..31]; RequestWordPtr: TYPE = LONG POINTER TO RequestWord; RequestWord: TYPE = PACKED ARRAY RequestKind OF BOOL; NullRequestWord: RequestWord = LOOPHOLE[LONG[0]]; END. vProcess.mesa Copyright c 1984, 1985, 1986 by Xerox Corporation. All rights reserved. Russ Atkinson (RRA) September 11, 1986 1:40:57 pm PDT Carl Hauser, March 31, 1987 4:08:44 pm PST Data Types for Process machinery (wizards only) Locks Timeouts Detaching processes Identity of the currently executing process GetCurrent: SAFE PROC RETURNS [Process] = TRUSTED INLINE { }; Priorities of processes GetPriority: SAFE PROC RETURNS [Priority] = TRUSTED INLINE { }; Aborting a process Requests that the indicated process be aborted. Checks for the current process being asked to abort by Abort. Raises ABORTED if such a request has been made. Otherwise CheckForAbort is a null operation. Control of Scheduling Process validation Processor data Processors are chained together in a circular queue that is not modified after initialization. Processor data is, of course, pinned. Κ˜codešœ ™ Kšœ Οmœ=™HK™5K™*—K˜K˜šΟk ˜ Kšœžœ˜ K˜—KšΟnœžœž œžœ˜#˜Kšœžœ˜—K˜™0K™Kšœžœž œžœ ˜(–1.6 in tabStopsšœ žœžœ˜K–1.6 in tabStopsšœΟc ˜/K–1.6 in tabStopsšœ 1˜@K–1.6 in tabStopsšœ˜K˜—Kšœ žœž œžœ ˜*šœžœ ˜K˜—Ihead™Kšœ žœž œžœ˜3–1.6 in tabStopsšœžœžœ˜K–1.6 in tabStopsšœ ˜/K–1.6 in tabStopsšœ ˜-K–1.6 in tabStopsšœ˜K–1.6 in tabStops˜—–1.6 in tabStopsšŸœžœ˜6Kš œžœžœžœžœ žœ˜BK˜—Kšœ žœž œžœ˜/K˜–1.6 in tabStopsšœžœžœ˜K–1.6 in tabStopsšœ ˜/K–1.6 in tabStopsšœ ˜-K–1.6 in tabStopsšœ ˜ K–1.6 in tabStopsšœ˜K–1.6 in tabStops˜—–1.6 in tabStopsšœžœžœ˜K–1.6 in tabStops˜K–1.6 in tabStops˜—K–1.6 in tabStopsšœžœžœ˜K–1.6 in tabStopsšœ žœžœ˜K–1.6 in tabStops˜–1.6 in tabStopsšœ žœ˜K–1.6 in tabStopsšœžœ˜K–1.6 in tabStopsšœžœ˜K–1.6 in tabStops˜—–1.6 in tabStopsšŸœžœ%˜>Kšœžœ˜Kšœžœžœ0˜NKšœ˜K˜—KšŸ œžœžœžœ ˜6KšŸœžœžœ žœ ˜4KšŸ œžœžœ žœ˜6K˜šœ™šŸ œžœ%˜5Kš œžœžœžœ žœ˜YK˜—šŸœžœ žœ ˜+Kšœžœ!˜1K˜——K˜˜K–1.6 in tabStops˜—Kšœžœž œžœ˜Ašœžœžœ2˜VK˜—Kšœ žœž œžœ ˜+Kšœ žœž œžœ ˜+–24 sp tabStopsšœ žœžœ˜K–24 sp tabStopsšœ 5˜CK–24 sp tabStopsšœ '˜6K–24 sp tabStopsšœ A˜PK–24 sp tabStopsšœ  3˜?K–24 sp tabStopsšœ ˜/K–1.6 in tabStopsšœ ˜$K–24 sp tabStopsšœ ˜%K–24 sp tabStopsšœ ˜*K–24 sp tabStopsšœ˜K–24 sp tabStops˜—–24 sp tabStopsšœ žœžœž œ˜$K–24 sp tabStopsšœ /˜=K–24 sp tabStopsšœ #˜1K–24 sp tabStopsšœ  ˜+K–24 sp tabStopsšœ  #˜.K–24 sp tabStopsšœ  ˜*K–24 sp tabStopsšœ  ˜(K–24 sp tabStopsšœ  $˜1K–24 sp tabStopsšœ  $˜.K–24 sp tabStopsšœ˜K–24 sp tabStops˜—–24 sp tabStopsšœžœžœž œ˜(K–24 sp tabStopsšœ  ˜$K–24 sp tabStopsšœ  /˜