Do I have to know RAM architecture to learn C & Java?
Posted: Wed Jun 08, 2011 10:08 am
Nipuna asked me this question over a PM so I thought it could be helpful to answer over the forum.
C/C++ and Pointers - It is better if you know about memory architecture. Basically types of memory (RAM, ROM, EEPROM, FLASH) you have on-board (on PC only RAM), Starting address of each memory & size, restricted & special areas (Such as BIOS & DMA) on them, etc...
But don't worry too much on them for now. Unless you are doing embedded development on Microcontrollers or DSPs, you don't have to worry to much.
There is something called Dynamic Memory Allocation in C/C++ which involves pointers. The simply theory is whenever you allocate dynamic memory (an array we create at runtime), you need to deallocate them when you no longer use it or at program exit by yourself. Otherwise your RAM will become wasted with dangling pointers (unused but unusable memory).
Java doesn't have either pointers or dynamic memory allocation. It simplifies the complexities (however less control) by allowing the user to define classes/arrays at any point and removing unused memory (used for classes/arrays) using an automatic background task. All unused and no longer needed memory are deallocated and return to the Operating System by this. This is called Garbage Collection.
I strongly believe that every programmer should refer the book Computer Architecture: A Quantitative Approach by Hennessy and Patterson. Everybody should have at least some knowledge in this subject and be able write a few lines in Assembly code (Symbolic instruction set of machine code). I found few youngsters who believe the objects are identified at the CPU level. No joking. This is the truth and the result of "Thinking in objects" without having even a simple idea on 1 0s that do the actual thing.
C/C++ and Pointers - It is better if you know about memory architecture. Basically types of memory (RAM, ROM, EEPROM, FLASH) you have on-board (on PC only RAM), Starting address of each memory & size, restricted & special areas (Such as BIOS & DMA) on them, etc...
But don't worry too much on them for now. Unless you are doing embedded development on Microcontrollers or DSPs, you don't have to worry to much.
There is something called Dynamic Memory Allocation in C/C++ which involves pointers. The simply theory is whenever you allocate dynamic memory (an array we create at runtime), you need to deallocate them when you no longer use it or at program exit by yourself. Otherwise your RAM will become wasted with dangling pointers (unused but unusable memory).
Java doesn't have either pointers or dynamic memory allocation. It simplifies the complexities (however less control) by allowing the user to define classes/arrays at any point and removing unused memory (used for classes/arrays) using an automatic background task. All unused and no longer needed memory are deallocated and return to the Operating System by this. This is called Garbage Collection.
I strongly believe that every programmer should refer the book Computer Architecture: A Quantitative Approach by Hennessy and Patterson. Everybody should have at least some knowledge in this subject and be able write a few lines in Assembly code (Symbolic instruction set of machine code). I found few youngsters who believe the objects are identified at the CPU level. No joking. This is the truth and the result of "Thinking in objects" without having even a simple idea on 1 0s that do the actual thing.