multitasking and locking the kernel

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.
Post Reply
kubeos
Member
Member
Posts: 138
Joined: Tue Jan 30, 2007 2:31 pm
Location: Kamloops BC, CANADA
Contact:

multitasking and locking the kernel

Post by kubeos »

Hi,

I am getting around to fixing my multitasking but I'm not sure of the best way to lock my kernel during critical operations. I've tried just setting a flag so the timer keeps firing but I don't think this is working for me. My critical operations are a few vm86 routines which I think are causing a problem with my timer/scheduler.

Should I mask off the timer irq? Or should I just do a cli?

Any suggestions would be appreciated.
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: multitasking and locking the kernel

Post by Brendan »

Hi,
kubeos wrote:Any suggestions would be appreciated.
Sure - fix your code so that you can handle any/all interrupts while VM86 code is running, and so that your scheduler can preempt VM86 code.

The only problem you should have is when 2 or more threads try to use crusty old BIOS functions at the same time. In this case you'd just use a mutex or something so that only one thread can use the BIOS at a time.


Cheers,

Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
kubeos
Member
Member
Posts: 138
Joined: Tue Jan 30, 2007 2:31 pm
Location: Kamloops BC, CANADA
Contact:

Re: multitasking and locking the kernel

Post by kubeos »

Hmmm, maybe I should just use REAL floppy and hdd drivers and stop relying on BIOS. :lol:
Post Reply