May 5, 1988 2:53:57 pm PDT

  See /palain/local/src/lib/cedar/threads

  Specification of SetProcessReady is no good.  It should never switch, but just
  return a hint which processor ought to reschedule.
  CHANGE THIS EVERYWHERE!


  TODO: Check whether PSem ever gets interrupted! (May 9, 1988 7:24:21 pm PDT)

  TODO: Think about the IDLE/FREE distinction.  (May 9, 1988 7:24:28 pm PDT)

  TODO: I could fix SWSTAT so computation of p_swStat could be by an increment
    from 'fromIntHandler' rather than a conditional expression ...

May 20, 1988 9:59:31 am PDT

  Check on the order handling stuff in XR_FinishSwitch.

May 21, 1988 5:30:32 pm PDT

  There may be performance problems with the SIGALRM stuff now.  Note request
  resched with killpg makes everybody jump for metalock at once.  Also, when
  a process times out on condition variable, are we sure it wakes up if it's
  at higher priority than some running process?

May 25, 1988 5:33:56 am PDT

  fix XR_numDoTimeouts, XR_numDoTimeoutsFailures, and TIMESLICE.

May 31, 1988 9:32:49 am PDT

  Orders need fixing -- see p. 75 ff in 19 Feb 88 lab book.

June 3, 1988 4:22:47 pm PDT

  The argument/result situation with IOP orders is messy.
  The mechanism for returning errno's is glitchy.

June 27, 1988 6:29:43 pm PDT

  TODO: arrange to start a new process to invoke a trap handler.
  TODO: think about what happens when various Unix trap/signal - generating
    events happen in client thread code.

LONG BREAK -- I went to Potsdam over July, and then PODC

August 18, 1988 (approximately)

  Found a major bug: there's a window in the Sun _longjmp code (a few
    instructions between setting the FP and setting the SP) where a Unix
    process switch will trash the stack of the thread being _longjmp'd away
    from.  I fixed this by adding XR_setjmp/XR_longjmp, in ThreadsMachDep.s.

August 22, 1988 10:12:29 am PDT

  Threads1.c.Switch: "/* kill the thread ... */ (*((int *)(0))) = 0;"
    This should be a macro defined somewhere, because it's not guaranteed
    that 0 is an invalid address on all machines.

August 22, 1988 11:15:38 am PDT

  vpe_doSwitch is a problem.  Should it be set by XR_ReschedSigHandler if it
    returns without calling XR_Switch?  I conjecture so ...


September 30, 1988 2:12:22 pm PDT

  How do I fix things so handler threads get aborted properly?
  The easy way is to add:
    (1) a test in switch: if this is a handler, and it's waiting on a cv,
    then there's a loop looking for an abort.  This can be heavyweight, since
    it hardly ever happens.
    (2) But this still doesn't help abort -- because you may abort the handlee
    while the handler is waiting.  This is in fact the case I'm worried about.
    In this case, the abort proc must notice that its target is being handled,
    
    Perhaps the best thing is to let the handler be the same thread, but run
    in a new stack, "stolen" from some other thread descriptor.  (!)

October 3, 1988 4:19:40 pm PDT

  In Threads1.c: XR_CallHandler pauses waiting for a free process slot; but
  XR_Fork waits on a condition that's specific to this
  ((XR_sysArea->sa_threadAvail).  This is a misfeature.

  The handler starting sequence seems nearly okay, even for the new world
  in which the thread id doesn't change.  We need to separate ForkInner from
  the code that prepares a handler for running -- note we need to be careful
  in the case of stack overflow -- Switch may be called from interrup stack?

  CURRENT STATE:
    Done: XR_Exit interprets handlees and replaces them on free list
    ToDo: ForkInner should be folded into Fork
    ToDo: interrupt handlers for memerr and trap need to create child
      correctly
    ToDo: CallHandler must be fixed.  Note the int handlers and CallHandler
      are very similar; presumably they need to be combined into one proc.
    ToDo: XR_RestartHandlee gets changed to (atomically) swap stacks back
      and continue somehow.  This will be hard -- may need to be done from
      inside Switch.  Bletch.


November 14, 1988 6:22:35 pm PST

  I have changed ThreadsBackdoor.h to define IOPO_Result as a type.  NONE of
  the affected procs have actually been changed to use it.  This has to be done;
  mostly it's in the UIO things.  Worry about the GC, though.
  
  ThreadsOrders.c has been changed so IssueIOPOrder returns the right code.
  
  Need to change DoWithFDEandFDC?  it still returns 0 or -1, but can set errno to ETIMEDOUT.  DONE.
  
  Added SetGetTimeout and SetPutTimeout.
  
  
November 23, 1988 10:07:25 am PST

  Remarks on mapping files ...
