little study about memory

mayurvashishth

Honorable
Oct 17, 2013
58
0
10,640
hello...recently i've been started learning about how does memory works and i came up with alot of questions.....
1)does ram and processor cache also swap data like ram and virtual memory does

2) why can't ram access hdd directly and instead uses pagefile

3) is it possible to run a computer entirely with hdd(without neglecting horrible performance)..if no then why as hdd is also a type of memory..

please answer them as simply as possible...thank you
 
Solution
1. Yes.

2. RAM does access the HDD directly too, the pagefile only becomes of use if the RAM is to full for the data that the running apps need to have.

3. No, its not possible. Even if you could force it, it would be slow as hell.

HDDs is a MOVING storage device that is much much much slower than RAM, which is stationary and only keeps data as long as it has power too it.
HDDs saves data in PHYSICAL form with magnets.
1. Yes.

2. RAM does access the HDD directly too, the pagefile only becomes of use if the RAM is to full for the data that the running apps need to have.

3. No, its not possible. Even if you could force it, it would be slow as hell.

HDDs is a MOVING storage device that is much much much slower than RAM, which is stationary and only keeps data as long as it has power too it.
HDDs saves data in PHYSICAL form with magnets.
 
Solution


1. Sort of. The microprocessor cache architecture is coherent with respect to the contents of the system's address space. This means that the contents of the cache will always be a subset of the main memory. Whenever the value at some memory address is changed it is first changed in the microprocessor's local copy (in the cache), and this change is then written back to the memory some time later when it is appropriate to do so. It also means that whenever the value at some address is loaded into the microprocessor from memory, the value is first copied into the cache.

Problems can occur when the value at a memory location is changed outside the scope of a running task. A good example of this is when an interrupt occurs and changes a value. The running task which was interrupted is not made aware that the value has changed and while any cached copies of the address will be updated, any copies of that data that's stored in CPU registers or on the program stack will not be. This problem occurs quite often in parallel programming.

2. The RAM does not access the HDD directly, but a program (such as GPU and storage drivers) can take advantage of the platform's DMA controller to offload data movement operations between primary memory and peripherals, or between primary memory and secondary storage. The DMA controller is a non-turing-complete co-processor which is purpose built to offload data transfer operations from the CPU. The DMA controller is given control of the necessary system buses when the CPU is busy doing other things, which allows for bulk data transfers to occur between peripherals and system memory without taking up valuable CPU time.

3. It depends. There is little about most microprocessors that explicitly require SDRAM to operate. In fact, one of the reasons why system firmware (usually conforming to the BIOS or UEFI specifications) is so minimalist and compact is that it has to fit on a small EEPROM chip and has to be able to fit the necessary elements entirely in the CPU cache until the SDRAM has been configured and initialized. Early PCs had the firmware on a floppy disk instead, which was eventually moved to the EEPROM and Flash chips that we have now. So it's only a small stretch to believe that a PC could run all program code from a slow secondary storage device such as a hard disk without any sort of primary memory except the CPU cache. While it may be possible, it would be extremely ill advised as hard disks are cripplingly slow compared to SDRAM. Furthermore, it may not be possible to put x86 CPUs from Intel or AMD into higher modes of operation without SDRAM ; this is not the case universally however.