OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 5:30 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: In what order should I work on memory?
PostPosted: Tue Jun 02, 2020 2:39 pm 
Offline
Member
Member
User avatar

Joined: Sun Jul 21, 2019 7:34 am
Posts: 293
Hi.
I fully understand the order in which to implement some parts in my 32-bit core.
My goal now is to add multitasking.
I found the article "kernel multitasking"

The requirements have page paging.
But I don't know if I have everything I need before implementing paging.
I don't have any virtual memory right now.

At the moment I manage my physical memory like this:
I divide all physical memory into 4096-byte pages. And I make them out if I have to.
Now I need to make a virtual memory? Only then do you start multitasking?
In what order do I need to implement something?

Thanks.


Top
 Profile  
 
 Post subject: Re: In what order should I work on memory?
PostPosted: Wed Jun 03, 2020 12:44 am 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5099
It's a good idea to have virtual memory management working before you try to implement multitasking.


Top
 Profile  
 
 Post subject: Re: In what order should I work on memory?
PostPosted: Wed Jun 03, 2020 11:29 am 
Offline
Member
Member
User avatar

Joined: Fri Aug 07, 2015 6:13 am
Posts: 1134
mrjbom wrote:
I found the article "kernel multitasking"


That article is crap! Don't use it, also never do assembly task switching in C code like shown in that tutorial!
Here is a proper one: https://wiki.osdev.org/Brendan%27s_Multi-tasking_Tutorial

_________________
OS: Basic OS
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader


Top
 Profile  
 
 Post subject: Re: In what order should I work on memory?
PostPosted: Wed Jun 03, 2020 11:54 am 
Offline
Member
Member

Joined: Tue Apr 03, 2018 2:44 am
Posts: 401
mrjbom wrote:
Hi.
I fully understand the order in which to implement some parts in my 32-bit core.
My goal now is to add multitasking.
I found the article "kernel multitasking"

The requirements have page paging.
But I don't know if I have everything I need before implementing paging.
I don't have any virtual memory right now.

At the moment I manage my physical memory like this:
I divide all physical memory into 4096-byte pages. And I make them out if I have to.
Now I need to make a virtual memory? Only then do you start multitasking?
In what order do I need to implement something?

Thanks.


You don't need virtual memory to implement multi-tasking. Lots of kernels have only a single address space with multiple threads of execution.

But, paging does enable a whole host of other features, not least the ability to have multiple address spaces, to provide a protection domain to allow independent, isolated processes, as well as releasing you from the shackles of physical memory layout and size.

Paging is just the mapping from a linear virtual address space to a potentially non-linear physical address space. Virtual memory can be facilitated by paging, but you can also implement paging without having virtual memory, and indeed, UNIX/32V (the port of V7 UNIX to the DEC VAX) is an example of an OS using the paging hardware, but not using paging to implement virtual memory.


Top
 Profile  
 
 Post subject: Re: In what order should I work on memory?
PostPosted: Wed Jun 03, 2020 1:29 pm 
Offline
Member
Member

Joined: Sun Apr 05, 2020 1:01 pm
Posts: 182
Octacone wrote:
mrjbom wrote:
I found the article "kernel multitasking"


That article is crap! Don't use it, also never do assembly task switching in C code like shown in that tutorial!
Here is a proper one: https://wiki.osdev.org/Brendan%27s_Multi-tasking_Tutorial


How do I find more hidden gems like this one? Searching the wiki yields nothing useful at all...


Top
 Profile  
 
 Post subject: Re: In what order should I work on memory?
PostPosted: Thu Jun 04, 2020 2:29 am 
Offline
Member
Member
User avatar

Joined: Sun Jul 21, 2019 7:34 am
Posts: 293
Octacone wrote:
mrjbom wrote:
I found the article "kernel multitasking"


That article is crap! Don't use it, also never do assembly task switching in C code like shown in that tutorial!
Here is a proper one: https://wiki.osdev.org/Brendan%27s_Multi-tasking_Tutorial


Wow, it looks much better. It's too bad I haven't seen him before! Thanks!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: SemrushBot [Bot] and 22 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group