Primary memory: Difference between revisions

From Computer Science Wiki
No edit summary
No edit summary
 
(26 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[[File:binary.png|frame|right|This is a basic concept in computer science]]
[[File:binary.png|frame|right|This is a basic concept in computer science]]


The primary memory stores the program instructions and the data in binary machine code. The Control Unit deals with the instructions and the Arithmetic and Logic unit handles calculations and comparisons with the data. Data and instructions are moved by buses.
The primary memory stores instructions. It is important to understand primary memory generally holds currently executing instructions.  


There are two types of memory in primary memory (also known as the Immediate Access Store ) of the computer, RAM and ROM:
There are two types of memory in primary memory, RAM and ROM<ref>http://www.ib-computing.net/program/core/memories.html</ref>.


* RAM is Random Access Memory which loses its contents when the computer is switched off (it is volatile ). This memory can be written to, instructions and data can be loaded into it.
* RAM is Random Access Memory which loses its contents when the computer is switched off (it is volatile ). This memory can be written to, instructions and data can be loaded into it.
Line 9: Line 9:
* ROM , or Read Only Memory is non-volatile and is used to store programs permanently (the start-up or " boot " instructions, for example), the computer cannot store anything in this type of memory.
* ROM , or Read Only Memory is non-volatile and is used to store programs permanently (the start-up or " boot " instructions, for example), the computer cannot store anything in this type of memory.


When the programs and data files (known as the software ) are not in RAM, they are stored on [[secondary memory]] (also known as backing store ) such as tapes or discs. The tape or disc drives and any input and output devices connected to the CPU are known collectively as peripherals<ref>http://www.ib-computing.net/program/core/memories.html</ref> .
When the programs and data files (known as the software) are not in RAM, they are stored on secondary storage (also known as backing store) such as tapes or discs. The tape or disc drives and any input and output devices connected to the CPU are known collectively as peripherals.


== Primary Memory ==
'''RAM – Random Access Memory'''<ref>http://dis-dpcs.wikispaces.com/2.1.2+Primary+Memory+and+2.1.3+Cache+Memory</ref>
* The RAM is where instructions, values are stored at runtime
* The RAM can be accessed a lot faster than secondary storage
* All data and instructions are lost when the power is turned off (volatile)
* Allows storage and random access to data and instructions
* Each instruction & piece of data in the RAM has a unique address (see also: [[Operating Systems management techniques]])


'''RAM – Random Access Memory'''
== ROM ==
* The RAM is where programs, instructions, values are stored at runtime
* The RAM can be accessed a lot faster than the hard disk
* All information is lost when the power is turned off
* Allows storage and random access of the data
* Each program instruction & piece of data in the RAM has a unique address
 
'''ROM – Read Only Memory'''
'''ROM – Read Only Memory'''
* Can not be written to easily or at all (often times once only, then never again)
* Can not be written to easily or at all (often times once only, then never again)
Line 24: Line 25:
* Many ROM modules are replaced with Flash modules nowadays (ex. BIOS, firmware modules) to allow easier updating
* Many ROM modules are replaced with Flash modules nowadays (ex. BIOS, firmware modules) to allow easier updating
* In devices like keyboards, etc. which aren’t designed for firmware updates ROM might still be used
* In devices like keyboards, etc. which aren’t designed for firmware updates ROM might still be used
* Stores code for interrupter<ref>http://dis-dpcs.wikispaces.com/2.1.2+Primary+Memory+and+2.1.3+Cache+Memory</ref>
* Stores code for interrupter
 
 
'''Virtual memory'''
To expand memory usable by the CPU it is possible to use something called virtual memory where the most important instructions for the program are stored in the RAM and the less necessary information is stored in secondary memory (usally the HDD) and then the data is switched between RAM and virtual memory as it is needed (to swap).
 
Advantages:
* Bulleted list item
More memory to work with.
 
Disadvantages:
* It is very slow compared to the primary memory
* Thrashing can occur. Thrashing is a condition when there is too much data that needs to be swapped between RAM and virtual memory, and the computer's response time is compromised.
 
 
 
== Other resources ==
 
* [[Media:Persistant storage.pdf | This is an excellent PDF by the Dartford Grammar School Computer Science Department]]
* [http://www.bbc.co.uk/education/guides/zxgkxnb/revision/6 A excellent resource by the BBC to understand volatile and non-volatile storage]


== Do you understand this topic? ==  
== Video ==
<html>
<iframe width="560" height="315" src="https://www.youtube.com/embed/bkJx-URsnyc" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</html>


* Identify the need for persistent storage
== Speed of primary memory ==
[https://colin-scott.github.io/personal_website/research/interactive_latency.html Please use this interactive latency tool] to understand latency. Don't forget to move the slider to the right for the most current data.
{| class="wikitable"
|+ Time comparison
|-
! unit of time !! Definition !! Some examples
|-
| 1 nanosecond || Nanosecond is one billionth of a second. || 1 ns: Time to execute one machine cycle by an Intel Pentium 4 1 GHz microprocessor, 1 ns: Light travels 12 inches (30 cm)
|-
| 1 microsecond µs || Microsecond is one millionth of a second. || 1 µs: Time to execute one machine cycle by an Intel 80186 microprocessor
|-
| 1 millisecond ms || Millisecond is one thousandth of a second. || 50-80 ms: The time taken to blink an eye
|-
|  1 second || 1 second is 1 second || "One Mississippi" said aloud
|}


== Do you have an advanced understanding about this topic? ==
== Standard ==  
* Describe primary memory.


* Is a disk-based swap file the same thing as persistent storage?


== References ==
== References ==

Latest revision as of 12:42, 1 October 2024

This is a basic concept in computer science

The primary memory stores instructions. It is important to understand primary memory generally holds currently executing instructions.

There are two types of memory in primary memory, RAM and ROM[1].

  • RAM is Random Access Memory which loses its contents when the computer is switched off (it is volatile ). This memory can be written to, instructions and data can be loaded into it.
  • ROM , or Read Only Memory is non-volatile and is used to store programs permanently (the start-up or " boot " instructions, for example), the computer cannot store anything in this type of memory.

When the programs and data files (known as the software) are not in RAM, they are stored on secondary storage (also known as backing store) such as tapes or discs. The tape or disc drives and any input and output devices connected to the CPU are known collectively as peripherals.

Primary Memory[edit]

RAM – Random Access Memory[2]

  • The RAM is where instructions, values are stored at runtime
  • The RAM can be accessed a lot faster than secondary storage
  • All data and instructions are lost when the power is turned off (volatile)
  • Allows storage and random access to data and instructions
  • Each instruction & piece of data in the RAM has a unique address (see also: Operating Systems management techniques)

ROM[edit]

ROM – Read Only Memory

  • Can not be written to easily or at all (often times once only, then never again)
  • In modern PCs usually used for firmware in CPU, Graphics card, hard disks, etc.
  • Many ROM modules are replaced with Flash modules nowadays (ex. BIOS, firmware modules) to allow easier updating
  • In devices like keyboards, etc. which aren’t designed for firmware updates ROM might still be used
  • Stores code for interrupter

Video[edit]

Speed of primary memory[edit]

Please use this interactive latency tool to understand latency. Don't forget to move the slider to the right for the most current data.

Time comparison
unit of time Definition Some examples
1 nanosecond Nanosecond is one billionth of a second. 1 ns: Time to execute one machine cycle by an Intel Pentium 4 1 GHz microprocessor, 1 ns: Light travels 12 inches (30 cm)
1 microsecond µs Microsecond is one millionth of a second. 1 µs: Time to execute one machine cycle by an Intel 80186 microprocessor
1 millisecond ms Millisecond is one thousandth of a second. 50-80 ms: The time taken to blink an eye
1 second 1 second is 1 second "One Mississippi" said aloud

Standard[edit]

  • Describe primary memory.


References[edit]