Multitasking Issues

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Post by AJ »

Same kind of thing here. Because I'm trying to achieve some degree of modularity, I set up a Device Manager (from a separate binary) and the kernel itself as the first tasks. Once I have got the device manager up to a reasonable state I will hope to remove the kernel from scheduling or give it minimal runtime...
User avatar
XCHG
Member
Member
Posts: 416
Joined: Sat Nov 25, 2006 3:55 am
Location: Wisconsin
Contact:

Post by XCHG »

Thank you guys. What I did was that I initiated kernel's process like this:

Code: Select all

  INVOKE  __DisableIRQPulse , IRQ_PULSE_IRQ0
  INVOKE  __CreateKernelProcess, OFFSET .KernelStartPointofProcess
  INVOKE  __EnableIRQPulse, IRQ_PULSE_IRQ0
  JMP     $
The label .KernelStartPointofProcess is where the kernel will have its process running. The little JMP at the end of the above code will actually end the unscheduled process of the kernel so from that point it will run from the specified label.

I coded a function called [__CreateKernelProcess] that adds the kernel to the process queue but with these flags:

Code: Select all

PROCESS_FLAG_KERNELPROCESS | PROCESS_FLAG_NOTSCHEDULED | PROCESS_PRIORITY_KERNEL
The PROCESS_FLAG_NOTSCHEDULED will cause the kernel not to be scheduled by the scheduler and only run where the CPU is in an idle mode. Cutting the story short, WOOOOHOOOO finally my context switching mechanism is working.

I really want to thank you, everyone: mystran, urxae, Aali, Frank, AJ and anyone who I forgot. Thank you.
On the field with sword and shield amidst the din of dying of men's wails. War is waged and the battle will rage until only the righteous prevails.
Post Reply