Page 1 of 1
Multitasking
Posted: Tue Oct 27, 2015 6:19 am
by Awe2K
Hello, it's me again and I have been searching the internet for some tutorials on multitasking, but I haven't found, old links on osdev forums are pointing to removed pages.
I've tried JamesM, but it's buggy as erm... you know. Also, I've already implemented paging and page allocation (one method allocates from start, and one allocates pages from end for stack (stack grows to bottom, as far as I know)). I've tried to implement multitasking by myself, but it doesn't seem to work normally (only for 2 tasks).
Could you please give me some advice on how to go and from what to start, or give some links on tutorials?
I'd be very glad.
Thanks, Awe2K.
Re: Multitasking
Posted: Tue Oct 27, 2015 6:52 am
by Muazzam
I found CS401 from VU, Pakistan very helpful. A few lectures are about multitasking that may help. They're in Urdu but the slides are in English.
You can watch lecture #30:
www.youtube.com/watch?v=m8SNm3VVOVw.
Re: Multitasking
Posted: Tue Oct 27, 2015 6:54 am
by Muazzam
I found CS401 from VU, Pakistan very helpful. A few lectures are about multitasking that may help. They're in Urdu but the slides are in English.
You might like to watch lecture 30 to lecture 32:
http://www.youtube.com/watch?v=m8SNm3VVOVw.
Re: Multitasking
Posted: Tue Oct 27, 2015 7:05 am
by Awe2K
Thanks, I'll try it out. Are there other things I have to implement before making multitasking?
Re: Multitasking
Posted: Tue Oct 27, 2015 7:11 am
by Awe2K
Also, this seems a tutorial for real mode, because it still uses
segment:offset addresses. I've already switched to protected mode, so many things may not suit. Instead of seg:off I have
paging enabled (just identity-mapped all memory). Now I'm able to allocate pages for stack and heap. In fact, here's screenshot of my kernel working, but as far as I know, it needs some way of executing programs (I can load and jump to ELF, but can't return).
(That white thing is a cursor
)
Re: Multitasking
Posted: Tue Oct 27, 2015 7:15 am
by Muazzam
Awe2K wrote:Thanks, I'll try it out. Are there other things I have to implement before making multitasking?
No. I've even implemented multi-tasking (though poor one) in a bootsector program. Which is, of course, 16-bit.
EDIT: [...]
Re: Multitasking
Posted: Tue Oct 27, 2015 7:19 am
by Muazzam
Awe2K wrote:Also, this seems a tutorial for real mode, because it still uses
segment:offset addresses. I've already switched to protected mode, so many things may not suit. Instead of seg:off I have
paging enabled (just identity-mapped all memory). Now I'm able to allocate pages for stack and heap. In fact, here's screenshot of my kernel working, but as far as I know, it needs some way of executing programs (I can load and jump to ELF, but can't return).
(That white thing is a cursor
)
Oh. By the way, if you've not ever tried multi-tasking, writing a task-switching program in real mode won't hurt.
Re: Multitasking
Posted: Tue Oct 27, 2015 7:25 am
by Awe2K
muazzam wrote:Oh. By the way, if you've not ever tried multi-tasking, writing a task-switching program in real mode won't hurt.
Actually, I've tried both in real mode and protected mode. In real mode it was kinda easier, but now I'm in protected mode, and there's no more segments,
I'm using paging which is quite different (segments are non-fixed, whereas pages are 4kbytes).
Re: Multitasking
Posted: Tue Oct 27, 2015 7:29 am
by Muazzam
Awe2K wrote:
Actually, I've tried both in real mode and protected mode. In real mode it was kinda easier, but now I'm in protected mode, and there's no more segments,
I'm using paging which is quite different (segments are non-fixed, whereas pages are 4kbytes).
I'm sorry. I assumed that you were quite beginner but you are not.
Re: Multitasking
Posted: Tue Oct 27, 2015 7:36 am
by Awe2K
muazzam wrote:Awe2K wrote:
Actually, I've tried both in real mode and protected mode. In real mode it was kinda easier, but now I'm in protected mode, and there's no more segments,
I'm using paging which is quite different (segments are non-fixed, whereas pages are 4kbytes).
I'm sorry. I assumed that you were quite beginner but you are not.
If it's about multitasking or loading executables, I am. I'm trying to create OS with console terminal, and I need multitasking just to run some daemons/services in background.
But I think I know other things needed to begin developing OS (paging, interrupts, some protected mode stuff).
Re: Multitasking
Posted: Tue Oct 27, 2015 7:46 am
by Muazzam
Have you tried
http://geezer.osdevbrasil.net/osd/tasks/index.htm? (Caution: I *haven't tried it personally.)
EDIT: I didn't notice. I have four stars now!
Re: Multitasking
Posted: Tue Oct 27, 2015 7:55 am
by Awe2K
No, I haven't yet, now I'm steps from implementing ELF loader
I think, that after I load ELF I should give it virtual address space (page, or something like that) and jump to it.
That way almost worked for me, but the one problem is program doesn't know where to return (after execution my kernel just hangs or throws interrupt about invalid opcode).
After I solve that problem, I think I would be able to start some services from initial ramdisk (loaded by grub2).