Path: utzoo!attcan!uunet!fernwood!apple!brutus.cs.uiuc.edu!zaphod.mps.ohio-state.edu!rpi!uupsi!sunic!bmc.uu.se!kuling!jonasf From: jonasf@kuling.UUCP (Jonas "flax" Flygare) Newsgroups: comp.sys.apollo Subject: Context switch on timer interrupt.. Message-ID: <1579@kuling.UUCP> Date: 2 Jul 90 22:09:53 GMT Sender: news@kuling.UUCP Organization: Dep. of Computer Systems, Upsala University, Sweden Lines: 20 I'm working on a little project that might become an assignment this fall... My hopes is to write a small OS-kernel using lightweight processes or some mutation thereof and timer interrupts. The first step was to get 'user controlled' context switches using a hacked variant of setjmp/longjmp worked just fine. (I had to make sure no check was made as to which direction I moved on the stack + allocate space on the stack for each process + make things Look Good before exiting or I would have 'Stack frame corrupted etc etc..') I then set up a timer to generate interrupts and a scheduler to be installed using signal(...) and it works fine, for one turn in the scheduler (each process executes once) but when I go from process N to the first again my program dies. I suspect there is some check on the stack in the signalhandler, but I have no idea how to get around this problem.. (I'd prefer _not_ to have to set the stack pointer manually each time I make a context switch just to fool the system I'm not doing anything Bad..) Any help appreciated.. :-) -- jonasf@kuling.docs.uu.se : "Doedth eddydthig dthrike you adth dthrayge Jonas (flax) Flygare : aboud dthidth houdth?" -- Dirk Gently