Hello,
Like in topic, is it possible? Every one guide that I see on osdev-oriented websites describe it but with paging already implemented. My goal is to first implement multitasking and then maybe in future implement paging.
Multitasking without paging
-
- Posts: 9
- Joined: Mon Nov 30, 2020 6:24 pm
- Libera.chat IRC: verynewbienoob
Re: Multitasking without paging
Shouldn't be a problem. Just treat all your tasks just as you would treat threads of a single process. The thing is that you lose address space separation, so one misbehaving task can break others.
In the code, 2 major differences would be that
In the code, 2 major differences would be that
- You have to be able to load any executable (and library) anywhere in the address space
- You never swap address spaces (reload CR3 on x86)
Re: Multitasking without paging
Absolutely yes. Read viewtopic.php?f=15&t=37283 too.verynewbienoob wrote:Hello,
Like in topic, is it possible?
Because that's simpler. Most implementations also switch address spaces, because it's easier to create tasks with separate address spaces (no task-specific addresses needed).verynewbienoob wrote:Every one guide that I see on osdev-oriented websites describe it but with paging already implemented.
That could be tricky, but doable. You can make shortcuts if you implement paging first; and you can develop bad practices if not. The main difference is, without paging all tasks must use different addresses for their code segments, while with paging all tasks use the same address for their code.verynewbienoob wrote:My goal is to first implement multitasking and then maybe in future implement paging.
Cheers,
bzt
Re: Multitasking without paging
My OS doesn’t use memory protection or paging. Feel free to browse the source code on GitHub and ask questions if you need pointers about how to do it.
CuriOS: A single address space GUI based operating system built upon a fairly pure Microkernel/Nanokernel. Download latest bootable x86 Disk Image: https://github.com/h5n1xp/CuriOS/blob/main/disk.img.zip
Discord:https://discord.gg/zn2vV2Su
Discord:https://discord.gg/zn2vV2Su
-
- Member
- Posts: 426
- Joined: Tue Apr 03, 2018 2:44 am
Re: Multitasking without paging
If you're just doing threading in kernel space, such as you might do with an embedded platform, multitasking without paging is not only desirable, but also mandatory for embedded processors that don't have paged MMU.verynewbienoob wrote:Hello,
Like in topic, is it possible? Every one guide that I see on osdev-oriented websites describe it but with paging already implemented. My goal is to first implement multitasking and then maybe in future implement paging.
One of the benefits of doing multitasking before paging is you can do so entirely in user space in a hosted process, and use regular host debugging tools to work on your multitasking implementation to get to grips with the details. Essentially, it allows you to model it as a user space threading library, then once you're comfortable, move the code you've written to bare metal.
Paging, however, is so fundamental to general purpose operating systems that it is worth understanding and implementing early. Apart from anything else, it makes management of free memory much easier, as you don't have to deal with external fragmentation, and once you move to user space with potentially multiple address spaces, it's the only sensible way of protecting those address spaces from each other (other protection mechanism exist, such as base/limit segmentation, but they're not portable.)
-
- Member
- Posts: 70
- Joined: Tue Jul 14, 2020 4:01 am
- Libera.chat IRC: clementttttttttt
Re: Multitasking without paging
Well LDT exists so it shouldn't be that hard.