flat assembler
Message board for the users of flat assembler.

Index > OS Construction > Paging

Author
Thread Post new topic Reply to topic
BOTOKILLER



Joined: 07 Jan 2011
Posts: 154
Location: Ukraine
BOTOKILLER 23 Jul 2011, 14:24
Hi everyone!
The question is: Is paging worth of implementing???

_________________
_______________________________
NSOS
Post 23 Jul 2011, 14:24
View user's profile Send private message Reply with quote
cod3b453



Joined: 25 Aug 2004
Posts: 618
cod3b453 23 Jul 2011, 14:55
If you're writing a 64 bit OS then you have to use paging, however, it is optional for 16/32bit.

The question of whether paging is worth it depends on your design goals; the ultimate goal of paging is to map more virtual memory than there is physical memory. You can simply check the physical memory limit and operate within that and it should work fine but there are certain regions in memory that are occupied with other things (PCI devices etc).

One useful property of paging is that you can map a linear virtual address range to a set of physically fragmented memory regions and map the remaining regions on the end. This makes the page table creation more complex but the memory allocation/management far simpler.

Some other useful properties of paging are caching properties, execution protection and the ability to "double map" physical regions but these are quite specific. Paging also allows you you to implement page swapping to disk using the present flag and page fault interrupt to manage which pages are copied out of-/back to- memory (this allows more memory than just the physical limit); again, this is optional.

Hope that helps.
Post 23 Jul 2011, 14:55
View user's profile Send private message Reply with quote
BOTOKILLER



Joined: 07 Jan 2011
Posts: 154
Location: Ukraine
BOTOKILLER 23 Jul 2011, 15:23
If i'm not going to swap memory, but just for convinience of memory managment - it will work faster than just segmentation???
and what sizes of page can i select???
Post 23 Jul 2011, 15:23
View user's profile Send private message Reply with quote
cod3b453



Joined: 25 Aug 2004
Posts: 618
cod3b453 23 Jul 2011, 16:34
Segments are only available in 16bit. In 32bit protected mode, non-paged memory should be faster than paged (though I'm not sure this is noticeable). Pages sizes for 32bit are 4k and either 2M or 4M; in 64bit you can also have 1G pages.
Post 23 Jul 2011, 16:34
View user's profile Send private message Reply with quote
BOTOKILLER



Joined: 07 Jan 2011
Posts: 154
Location: Ukraine
BOTOKILLER 23 Jul 2011, 16:49
I wanted 64K pages Crying or Very sad
Very Happy Very Happy Very Happy
Well, are you sure that non-paged is faster than paged, cuz I think that many years passed since paging got popular and intel guys would optimize it as much as possible...

_________________
_______________________________
NSOS
Post 23 Jul 2011, 16:49
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 23 Jul 2011, 17:44
Paging is needed for more than just swapping: Protection, Auto-growing stack, memory mapped files, etc.
Post 23 Jul 2011, 17:44
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
BOTOKILLER



Joined: 07 Jan 2011
Posts: 154
Location: Ukraine
BOTOKILLER 26 Jul 2011, 10:38
Also, how do I address memory in paging???

_________________
_______________________________
NSOS
Post 26 Jul 2011, 10:38
View user's profile Send private message Reply with quote
DJ Mauretto



Joined: 14 Mar 2007
Posts: 464
Location: Rome,Italy
DJ Mauretto 26 Jul 2011, 10:41
Quote:
Also, how do I address memory in paging???


There's all written in the intel manuals Wink

_________________
Nil Volentibus Arduum Razz
Post 26 Jul 2011, 10:41
View user's profile Send private message Reply with quote
BOTOKILLER



Joined: 07 Jan 2011
Posts: 154
Location: Ukraine
BOTOKILLER 26 Jul 2011, 13:28
Do I need GDT in paging??? If yes, then how do pages interact with GDT???
Post 26 Jul 2011, 13:28
View user's profile Send private message Reply with quote
DJ Mauretto



Joined: 14 Mar 2007
Posts: 464
Location: Rome,Italy
DJ Mauretto 26 Jul 2011, 14:35
Quote:
Do I need GDT in paging??? If yes, then how do pages interact with GDT???


Intel Manuals please Wink

_________________
Nil Volentibus Arduum Razz
Post 26 Jul 2011, 14:35
View user's profile Send private message Reply with quote
BOTOKILLER



Joined: 07 Jan 2011
Posts: 154
Location: Ukraine
BOTOKILLER 26 Jul 2011, 14:43
DJ Mauretto wrote:
Quote:
Do I need GDT in paging??? If yes, then how do pages interact with GDT???


Intel Manuals please Wink

Argh.... Laughing Those manuals are looooong :lazy:

_________________
_______________________________
NSOS
Post 26 Jul 2011, 14:43
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 26 Jul 2011, 16:48
They are just as long as paging is complicated Razz
Post 26 Jul 2011, 16:48
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4330
Location: Now
edfed 26 Jul 2011, 18:16
if you want, you can simulate some paging in real mode.

for that, you need something like an interruption to update the paged memory.

then, you need 3 segments:
DS is the segment used to point to the paged memory.
another segment to contain the real memory
another to contain the paging structure, constituted of pointers. a sort of lut.

periodically, the interrupt updates the DS segment accordinglly to the LUT, and the real memory.

an entry in the put is used to tell where the data comes from in the real memory segment, for each place in the paging structure.


in real mode, it will give the possibility to build 2 bytes pages.
then, 32 kpages.
when you will have a simple paging like this working, you will understand the big hardware pm paging that uses directlly the adress decoder in the process of effective to physical adress translation.

as there are 32k words in a segment, you can translate every single words anywhere else, on an even adress in the DS segment.
this is a sort of simulated paging.
Post 26 Jul 2011, 18:16
View user's profile Send private message Visit poster's website Reply with quote
BOTOKILLER



Joined: 07 Jan 2011
Posts: 154
Location: Ukraine
BOTOKILLER 26 Jul 2011, 19:02
vid wrote:
They are just as long as paging is complicated Razz

Smile Still, Does paging interact with segments in GDT and if yes how???
P.S.: I just need at least aproximate picture to plan what I'm gonna do, when, and how...

_________________
_______________________________
NSOS
Post 26 Jul 2011, 19:02
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
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 vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.