Optimize Virtual Memory by Normalizing Columns in a 1024x1024 Array

In summary, if we have a 1024x1024 array of 32 bits numbers and we need to normalize by columns, it would be wise to store the pages by column. This is because if it is done by rows, there will be 3 page faults for each column, resulting in a need for 4MB of memory. However, if the data is stored by column, there will be no need for paging to the swap file unless the computer's memory is heavily used by other processes. Performance may also be affected by the cache size and the algorithm used for accessing the data in main memory.
  • #1
rootX
479
4
If there is a 1024x1024 array of 32 bits numbers and we need to normalize by columns.

Algorithm goes through each column, finds max and divide all numbers by the max.
It would be certainly wise to store the pages by column?

My rationale:
1M (2^20) main memory is allocated and each page is 4K bytes as provided.

Because if it is done by rows, 256 rows will be stored. So, for each column there will be 3 page faults when reading numbers and 3 page faults when writing back the normalized numbers.
 
Technology news on Phys.org
  • #2
You'd need 4MB of memory to hold all the data. Unless other processes were consuming nearly all of you computers memory, then none of that 4MB of data would be paged out to the swap file.

Performance issues would be related to the cache size and algorithm implemented on your computer. Dram is normally optimized for sequential access.
 

1. What is virtual memory?

Virtual memory is a computer system's ability to temporarily store data and program instructions on the hard drive, allowing programs to use more memory than is physically available in the computer's RAM.

2. Why is virtual memory important?

Virtual memory is important because it allows a computer to run larger programs or multiple programs simultaneously, without running out of physical memory. It also allows for more efficient use of memory, as not all data and instructions need to be stored in RAM at all times.

3. How does virtual memory work?

Virtual memory works by creating a virtual address space that is larger than the physical memory available. When a program needs to access data or instructions that are not currently in RAM, the operating system will temporarily transfer them from the hard drive to the RAM. This process is known as swapping or paging.

4. What are the drawbacks of using virtual memory?

One of the drawbacks of virtual memory is that it can slow down the computer's performance, as data must be constantly swapped between the hard drive and RAM. It also requires a certain amount of hard drive space to be reserved for virtual memory, which can take up valuable storage space.

5. How can virtual memory be optimized?

Virtual memory can be optimized by increasing the amount of RAM in the computer, reducing the amount of virtual memory being used, or adjusting the size of the virtual memory file. It is also important to regularly clean up unused programs and files to free up space for virtual memory to use.

Similar threads

  • Programming and Computer Science
Replies
4
Views
3K
  • Programming and Computer Science
Replies
30
Views
4K
  • Engineering and Comp Sci Homework Help
Replies
7
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
3
Views
661
  • Programming and Computer Science
Replies
4
Views
5K
  • Programming and Computer Science
Replies
4
Views
11K
  • Programming and Computer Science
Replies
17
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
4
Views
1K
  • Computing and Technology
Replies
14
Views
3K
Replies
7
Views
7K
Back
Top