Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Multitasking! #39

Open
plankp opened this issue Nov 19, 2015 · 24 comments
Open

Adding Multitasking! #39

plankp opened this issue Nov 19, 2015 · 24 comments

Comments

@plankp
Copy link
Collaborator

plankp commented Nov 19, 2015

I am having trouble figuring this one out... Maybe a Unix fork execve like style or a brand new one be implemented?

@raphydaphy
Copy link
Owner

Nuuuuu not unix stuff ): Q is meant to be from scratch 👍

But shouldn't we make the current things work better before thinking about multitasking because multitasking is pretty hard 😞

@raphydaphy raphydaphy assigned raphydaphy and plankp and unassigned raphydaphy and plankp Nov 19, 2015
@Barteks2x
Copy link
Collaborator

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.

@raphydaphy raphydaphy assigned Barteks2x and unassigned raphydaphy Nov 20, 2015
@plankp
Copy link
Collaborator Author

plankp commented Nov 20, 2015

good enough

@raphydaphy
Copy link
Owner

ok den

sounds cool

@Barteks2x
Copy link
Collaborator

I will try to make "writer" and "cat" separate processes (so that I'm sure it works).

@plankp
Copy link
Collaborator Author

plankp commented Nov 20, 2015

👍

1 similar comment
@raphydaphy
Copy link
Owner

👍

@Barteks2x
Copy link
Collaborator

Somehow I stop getting interrupts when I add second thread/task/process.

@Barteks2x
Copy link
Collaborator

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?

@raphydaphy
Copy link
Owner

You can debug the booting process using Debug Mode in the OS selection on grub, but idk about after you have booted the OS..

@plankp
Copy link
Collaborator Author

plankp commented Nov 21, 2015

Moving it to ready

@plankp plankp added the ready label Nov 21, 2015
@plankp
Copy link
Collaborator Author

plankp commented Nov 24, 2015

Anyone know what's going on with this multitasking?

@raphydaphy
Copy link
Owner

Did Barteks2x quit?

@plankp
Copy link
Collaborator Author

plankp commented Nov 24, 2015

I don't think so?

@Barteks2x
Copy link
Collaborator

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.

@plankp
Copy link
Collaborator Author

plankp commented Nov 25, 2015

Maybe NOP a couple times instead of int i = 0?

@Barteks2x
Copy link
Collaborator

*edited my comment - added what if I use nop.

@Barteks2x
Copy link
Collaborator

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.

@Barteks2x
Copy link
Collaborator

I tried adding a few NOPs - the same as with only one.

@raphydaphy
Copy link
Owner

gl 👍

Your code looks pretty good so far

@plankp
Copy link
Collaborator Author

plankp commented Nov 25, 2015

Maybe push some value?

@plankp
Copy link
Collaborator Author

plankp commented Nov 25, 2015

What if you don't hlt and just loop?

@Barteks2x
Copy link
Collaborator

Bad things happen (but that's because for some reason I can't force it to use different stack yet).

@plankp
Copy link
Collaborator Author

plankp commented Nov 25, 2015

oh. ok

plankp added a commit that referenced this issue Dec 2, 2015
@Pvanduyse Pvanduyse added ready and removed ready labels Dec 2, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants