howh does DMA work in operating system?

Jincuteguy

Senior member
Apr 25, 2003
380
0
0
Hi guys, I just wonder what is DMA stands for and how does DMA transfer work in operating system? thx.
 

dawks

Diamond Member
Oct 9, 1999
5,071
2
81
DMA is Direct Memory Access, and its more of a hardware 'feature' then Operating system, although your OS must support it for it to work.

DMA allows IDE devices (mostly) to have direct access to system memory or ram. It allows them to by-pass the CPU, and supposedly increase performance by transferring data directly between the two, ie harddrive to ram or cd-rom to ram.

I think thats correct :D
 

Jincuteguy

Senior member
Apr 25, 2003
380
0
0
thx man. I also have another question.

Cycle stealing occurs when the CPU cannot access RAM due to a DMA transfer using the bus path. this blocks the CPU from fetching instructions or reading/writing data. Under what circumstances would cycle stealing not have a negative impact on performance?
 

CTho9305

Elite Member
Jul 26, 2000
9,214
1
81
Originally posted by: Jincuteguy
thx man. I also have another question.

Cycle stealing occurs when the CPU cannot access RAM due to a DMA transfer using the bus path. this blocks the CPU from fetching instructions or reading/writing data. Under what circumstances would cycle stealing not have a negative impact on performance?

DMA is good. Basically, there are 2 ways to get data from/to the hard drive. One is for the CPU to send a command to the drive, wait, then send another command. This makes your system crawl. It's PIO. The other is to have the CPU send a command, go do something else, and be interrupted upon completion. This is DMA. Even if the memory accesses are a little slower with DMA, with PIO, not only would the memory be busy, the CPU would be idling and doing NOTHING, instead of doing work a little slower.

if thats incoherent, i'm tired...sorry
 

CTho9305

Elite Member
Jul 26, 2000
9,214
1
81
Ok. Well, your program wants to read a file. The OS gets the request from the program, and then sends it off to the hard drive, and tells it where to store the data. Then, it switches tasks to run some other program for a while. After a few milliseconds, the hard drive completes its transfer, and an interrupt is sent to the CPU. The CPU then starts executing OS code, which copies the data to where your program wants it, and then continues executing your program.

Or what are you asking?
 

Jincuteguy

Senior member
Apr 25, 2003
380
0
0
Cycle stealing occurs when the CPU cannot access RAM due to a DMA transfer using the bus path. this blocks the CPU from fetching instructions or reading/writing data. Under what circumstances would cycle stealing not have a negative impact on performance?
 

CTho9305

Elite Member
Jul 26, 2000
9,214
1
81
Originally posted by: Jincuteguy
Cycle stealing occurs when the CPU cannot access RAM due to a DMA transfer using the bus path. this blocks the CPU from fetching instructions or reading/writing data. Under what circumstances would cycle stealing not have a negative impact on performance?

It has a negative impact, bu the thing is... the alternative is worse. With DMA, the CPU can do some work, even if it takes longer to access ram. Without DMA, the CPU doesn't do ANY work at all - it just sits there polling the device over and over. Of course, if your data/app fit into cache, the CPU wouldn't need to hit the RAM>
 

Jincuteguy

Senior member
Apr 25, 2003
380
0
0
Im asking when does cycle stealing not have a negative impact on the performance? Because the CPU cannot access RAM since DMA is using the bus patch to access the RAM.
 

CTho9305

Elite Member
Jul 26, 2000
9,214
1
81
If the CPU doesn't need to hit the ram... e.g. it has all it needs in cache, then it shouldn't be affected.
 

CTho9305

Elite Member
Jul 26, 2000
9,214
1
81
just tell us it's a homework question. and word your question smore clearly - but this one and the acrylic case thread were really confusing.