Q-Operating-System
Q-Operating-System copied to clipboard
Adding Multitasking!
I am having trouble figuring this one out... Maybe a Unix fork
execve
like style or a brand new one be implemented?
Nuuuuu not unix stuff ): Q is meant to be from scratch :+1:
But shouldn't we make the current things work better before thinking about multitasking because multitasking is pretty hard :disappointed:
I was actually able to get simple scheduler working (but I only tested it with one task/thread/process). And I can't load executab;e files so I don't think it really counts as multitasking.
good enough
ok den
sounds cool
I will try to make "writer" and "cat" separate processes (so that I'm sure it works).
:+1:
:+1:
Somehow I stop getting interrupts when I add second thread/task/process.
I partially got it working with multiple kernel tasks. Trying to figure out why it sets stack pointer to wrong but accidentally "correct" value. Is there some way to actually debug it other than adding a bunch of prints?
You can debug the booting process using Debug Mode in the OS selection on grub, but idk about after you have booted the OS..
Moving it to ready
Anyone know what's going on with this multitasking?
Did Barteks2x quit?
I don't think so?
For last few days I didn't have enough free time. I will try to do something this weekend.
I have a few problems with multitasking. I need to do some changes to isr and irq handlers.
I want to save thread state on it's stack. And I actually need to create separate stack for it.
And I have weird issue (probably caused by not using separate stack, but when I try setting different stack - it magically resets itself to what it was before).
I have this function:
https://github.com/Barteks2x/Q-OS/blob/8888ddc936f7152c204d72f20641cdd8e5b8ef6a/kernel/inc/thread.c#L86
And without the int i = 0
it doesn't work (a lot of illegal opcodes). When I replace it with nop (__asm__ __volatile__("nop")
) I get page faults instead.
Maybe NOP
a couple times instead of int i = 0
?
*edited my comment - added what if I use nop.
What is even more weird - if I move that int i = 0;
before the loop - it still works. But it I remove it - it breaks.
I tried adding a few NOPs - the same as with only one.
gl :+1:
Your code looks pretty good so far
Maybe push some value?
What if you don't hlt
and just loop?
Bad things happen (but that's because for some reason I can't force it to use different stack yet).
oh. ok