Should I implement paging if my kernel is single-tasking?

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
osdf_1
Posts: 20
Joined: Sun Nov 25, 2007 7:55 pm

Should I implement paging if my kernel is single-tasking?

Post by osdf_1 »

Hi, so should I implement paging if I'm planning to make a single-task kernel? If not, should my next step be a file system?

Thanks
User avatar
suthers
Member
Member
Posts: 672
Joined: Tue Feb 20, 2007 3:00 pm
Location: London UK
Contact:

Re: Should I implement paging if my kernel is single-tasking?

Post by suthers »

My opinion is yes, because even if it is single tasking, if you run a powerful app, you might need to swap stuff out of memory...
Jules
Uranium
Posts: 16
Joined: Fri Jul 04, 2008 8:00 am

Re: Should I implement paging if my kernel is single-tasking?

Post by Uranium »

This question seems rather silly?

You could do either first depending on your to-do list layout.

In fact, you should probably put both to the very top of your to-do list.
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Re: Should I implement paging if my kernel is single-tasking?

Post by AJ »

Hi,

I agree with Suthers - implement paging. Even if you are single tasking, do you have a kernel providing the application with services? If so, paging will offer you page-level memory protection - just because you only have one app doesn't necessarily mean that the app will behave itself :)
Uranium wrote:This question seems rather silly?
You could do either first depending on your to-do list layout.
This answer seems rather silly.

I think that even if you decide to implement paging next, you should still design your filesystem now. The reason? Whenever you design software, you always design the interface before implementing. The VFS will have quite a bearing on how your application "sees" your kernel and may have a bearing on how you want to implement paging (swapping and so on) - so by all means implement paging next, but design your kernel <--> user interfaces first.

HTH,
Adam
DeletedAccount
Member
Member
Posts: 566
Joined: Tue Jun 20, 2006 9:17 am

Re: Should I implement paging if my kernel is single-tasking?

Post by DeletedAccount »

It's your choice :)
binarysemaphore
Posts: 11
Joined: Thu Jul 03, 2008 12:37 am

Re: Should I implement paging if my kernel is single-tasking?

Post by binarysemaphore »

osdf_1 wrote:Hi, so should I implement paging if I'm planning to make a single-task kernel? If not, should my next step be a file system?

Thanks
So if you don't implement paging, how do you plan to accomodate applications which might require more than available memory ?

Tejas Kokje
User avatar
suthers
Member
Member
Posts: 672
Joined: Tue Feb 20, 2007 3:00 pm
Location: London UK
Contact:

Re: Should I implement paging if my kernel is single-tasking?

Post by suthers »

binarysemaphore wrote:
osdf_1 wrote:Hi, so should I implement paging if I'm planning to make a single-task kernel? If not, should my next step be a file system?

Thanks
So if you don't implement paging, how do you plan to accomodate applications which might require more than available memory ?

Tejas Kokje
That's what I was pointing out, the answer is with a lot of difficulty... you'd need to make a malloc function that 'emulates' the page swap ability...

Jules
User avatar
Dex
Member
Member
Posts: 1444
Joined: Fri Jan 27, 2006 12:00 am
Contact:

Re: Should I implement paging if my kernel is single-tasking?

Post by Dex »

Get real, this is such a crap argument, how much ram do most moden PC have, the old xbox run some big game, much bigger than anything that will run on a hobby OS and that was single-tasking without paging, there are so many advantages to not using paging, in a single-tasking OS.
I would say stay away from paging (if your coding a single-tasking OS).
User avatar
inflater
Member
Member
Posts: 1309
Joined: Thu Sep 28, 2006 10:32 am
Location: Slovakia
Contact:

Re: Should I implement paging if my kernel is single-tasking?

Post by inflater »

I have to agree with Dex though. In a simple OS you don't need paging and all that stuff. Makes your life easier from handling pagefaults and learning a completely new way of handling memory.

Segmentation (with PAE to access >4GB RAM) for the win. :)
My web site: http://inflater.wz.cz (Slovak)
Derrick operating system: http://derrick.xf.cz (Slovak and English :P)
binarysemaphore
Posts: 11
Joined: Thu Jul 03, 2008 12:37 am

Re: Should I implement paging if my kernel is single-tasking?

Post by binarysemaphore »

Dex wrote:Get real, this is such a crap argument, how much ram do most moden PC have, the old xbox run some big game, much bigger than anything that will run on a hobby OS and that was single-tasking without paging, there are so many advantages to not using paging, in a single-tasking OS.
I would say stay away from paging (if your coding a single-tasking OS).
Ok..if it is a simple OS which will run on a architecture with fixed amount of main memory, you can skip paging for single tasking kernel. But it is unfair for general purpose OS to assume that every computer will have at least X amount of main memory.

Other way would be for application developers to specify minimum memory requirement for your single tasking OS.

Tejas Kokje
User avatar
Telgin
Member
Member
Posts: 72
Joined: Thu Dec 20, 2007 1:45 pm

Re: Should I implement paging if my kernel is single-tasking?

Post by Telgin »

I'm inclined to agree with Dex as well. It's going to depend a lot on what you want to accomplish with the OS. If you want the OS to be as simple as possible, and will only run a single application at a time (or the same application all of the time), then it may not be necessary. You can probably assume that any modern desktop PC is going to have at least 512MB of RAM, and not many programs need more than that, even taking the OS into account (it's simple, right?).

If you suspect that an application running on it might need more RAM than that, it's going to be very difficult to deal with it, but you could emulate paging if it's needed. Swap out large chunks of memory or something if needed, and keep track of it in the kernel.

The other important feature of paging, as has been said, is memory protection. Not sure how you're going to deal with that though. You need to keep the application from writing to kernel memory, accessing hardware directly, or using priviledged instructions. That's harder to deal with without priviledge levels and all, and isn't that linked to paging? (seriously, I'm not sure, I haven't made it this far myself)
Post Reply