An introduction into memory.
By reading this slide, you'll learn:
The four different types of memory
Memory Management
Garbage Collection
Threads
Stack
Heap
and a few more key things on the subject.
3. 4 types of Memory
Internal Memory
Main Memory
Online Mass Storage
Offline Mass Storage
4.
5. Internal Memory
- Process Registers - Small Amounts of information to be consumed (do calculations on)
- L0 - L4 Cache - Large Amounts of information to be broken down
- Abstracted out in most languages
6. Main Memory
R.A.M (Random Access Memory)
The memory is Volatile
Programs store information (variables, files, and etc)
Ram is where the HEAP lives
7. Online Mass Storage
No this is not Dropbox or Google Drive.
This is referring to the Hard Drive inside your
computer.
The reason why it is online is because it is attached to
your computer using a cable
This is a non-volatile type of memory (means stores it
even after power it removed)
8. Offline Bulk Storage
This can mean things like Dropbox, Google Drive, and
others.
Databases also fall into the category of Offline Bulk
Storage
What defines offline bulk storage is that the computer
must leave its own physical machine to access the
information.
9. Memory Management
Higher level languages like Javascript, Python, PHP, Ruby, and others have abstracted Memory management
to be handled for you.
C and C++ are lower level languages that need to be manually told to allocate memory when running their
programs.
10.
11. Garbage Collection
A form of automatic memory management that tries
to reclaim memory by objects that are no longer
being used.
Takes a significant amount of processing power
Runs every 16ms
Invented by John McCarthy around 1959.
12. Threads
a thread of execution is the smallest sequence of programmed instructions that can be
managed independently by a scheduler
Multiple threads can exist in a process which can share resources like memory. Often
referred to as Multi-threaded.
Javascript, Ruby, and Python don’t start off as multi-threaded, while other languages like
Swift and Objective-C rely heavily on multi-thread for performance reasons.
13.
14. Stacks
Memory set aside as scratch space for a thread of
execution.
Function is called, a stack is created to allocate space
for variables and some bookkeeping data. Once the
function is finished executing the stack releases the
memory to be used again by the next function.
LIFO (last in first out)
15. Heap
Memory set aside for dynamic allocation.
There is no enforced pattern for Allocation or
Deallocation.
Makes it difficult to keep track of
25. Non - Destructive
Doesn’t alter the original array in anyway but rather makes a new copy and returns that.
we use up more space but can ignore state
26. Bonus
Where are we using non-destructive methods in a REACT REDUX project?
***HINT****
Think of what pure functions are.