DMA and Paging question

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
raevin
Member
Member
Posts: 33
Joined: Tue Dec 28, 2004 12:00 am

DMA and Paging question

Post by raevin »

This is kind of one question rolled into one...

What exactly is the point of DMA and paging?

I know DMA is direct media(?) access...and I can see this being useful for CD & DVD drives, and possibly floppy...but say you're only wanting to access the hard drive...would it still be necessary (if it even is with the above casese) to implement DMA?

Pretty much, same thing with paging...if you're developing a DOS clone for example, without support for multitasking and the such...then, would paging even be useful, since there'd be no need to really have two types of memory?

I've read through tutorials and posts on osdev.org, osdever.net, and various other places on the web...but, perhaps the concept is still a lil' sketchy to me.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Post by Combuster »

I know DMA is direct media(?) access..
That's kind of contradictory to say. If you have indeed bothered to look it up you should have known that it stands for Direct Memory Access.

DMA is meant to allow devices to write data to memory without intervention of the CPU, which should give the processor more time and in the end result in a speedup of the system.
would it still be necessary
Necessary? in most cases, no. Recommended? yes.
Pretty much, same thing with paging...
Paging is just to map virtual addresses to different physical addresses. (So is segmentation) Wether it helps you, is something you should be able to figure for yourself. Ask your conciousness the standard questions: what are the advantages, what are the disadvantages, and are the advantages larger than the disadvantages.

If it helps, make it your homework :wink:
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
raevin
Member
Member
Posts: 33
Joined: Tue Dec 28, 2004 12:00 am

Post by raevin »

Combuster wrote:
I know DMA is direct media(?) access..
That's kind of contradictory to say. If you have indeed bothered to look it up you should have known that it stands for Direct Memory Access.
I resent that...just because I mis-typed what the "M" stood for in DMA doesn't mean I didn't do research before hand...thus why I put a "(?)" next to it, because I wasn't sure if that was the right word.
Combuster wrote: DMA is meant to allow devices to write data to memory without intervention of the CPU, which should give the processor more time and in the end result in a speedup of the system.
would it still be necessary
Necessary? in most cases, no. Recommended? yes.
Hmmm....well then...time to find some (better) tutorials on the matter.
Pretty much, same thing with paging...
Paging is just to map virtual addresses to different physical addresses. (So is segmentation) Wether it helps you, is something you should be able to figure for yourself. Ask your conciousness the standard questions: what are the advantages, what are the disadvantages, and are the advantages larger than the disadvantages.
So, basically it creates a "force field" of sorts so that the program doesn't do anything "dangerous" in Kernel-Land?
vhg119
Member
Member
Posts: 71
Joined: Fri Aug 24, 2007 5:56 pm
Location: CA, USA

Post by vhg119 »

raevin wrote: So, basically it creates a "force field" of sorts so that the program doesn't do anything "dangerous" in Kernel-Land?
What it allows you to do is create different linear->physical address mappings for each process.

Since each process can have their addresses mapped to different physical locations, they can stay out of each others way without paying attention to which addresses they should avoid. For instance, process A can have its virtual address 0x0 mapped to 0x100000 in physical memory. Process B can have its virtual address 0x0 mapped to 0x200000 in physical memory. Each process can access it's own 0x0 and will not even know of the other process' existence.

You can also set access restrictions on individual pages so that even though the process can see a specific page, it can't access it. This is useful in the case of the kernel, which needs to be mapped into the address space of all processes.

Paging will protect not only the kernel, but also other processes from each other.
vhg119
Member
Member
Posts: 71
Joined: Fri Aug 24, 2007 5:56 pm
Location: CA, USA

Post by vhg119 »

How is it that you joined in '04 but only have 12 posts?
raevin
Member
Member
Posts: 33
Joined: Tue Dec 28, 2004 12:00 am

Post by raevin »

vhg119 wrote:
raevin wrote: So, basically it creates a "force field" of sorts so that the program doesn't do anything "dangerous" in Kernel-Land?
What it allows you to do is create different linear->physical address mappings for each process.

Since each process can have their addresses mapped to different physical locations, they can stay out of each others way without paying attention to which addresses they should avoid. For instance, process A can have its virtual address 0x0 mapped to 0x100000 in physical memory. Process B can have its virtual address 0x0 mapped to 0x200000 in physical memory. Each process can access it's own 0x0 and will not even know of the other process' existence.

You can also set access restrictions on individual pages so that even though the process can see a specific page, it can't access it. This is useful in the case of the kernel, which needs to be mapped into the address space of all processes.

Paging will protect not only the kernel, but also other processes from each other.
Ahhh...alrighty. Makes more sense, thanks for the clarification. :)
How is it that you joined in '04 but only have 12 posts?
Easy...didn't post for about 2 years or so.
Post Reply