Skip to main content
33 votes
Accepted

How do computers remember where they store things?

I'd suggest you look into the wonderful world of Compiler Construction! The answer is that it's a bit of a complicated process. To try to give you an intuition, remember that variable names are ...
Joey Eremondi's user avatar
27 votes
Accepted

If the virtual address space can be larger than the physical address space, how are the address mappings stored in memory?

The trick to making this work is "paging." When bringing data from a hard disk into physical memory, you don't just bring a few bytes. You bring an entire page. 4k bytes is a very common page size. ...
Cort Ammon's user avatar
  • 3,359
24 votes

How do computers remember where they store things?

When a computer stores a variable, when a program needs to get the variable's value, how does the computer know where to look in memory for that variable's value? The program tells it. Computers do ...
user20574's user avatar
  • 1,845
7 votes
Accepted

RAM can be accessed hundreds of times faster than a hard drive. Explain How?

Wikipedia has great information on this topic, but as a brief, simplified explanation, know that it boils down mainly to the involvement of mechanical moving parts in a traditional Hard Disk Drive (...
oranja's user avatar
  • 188
6 votes
Accepted

Relevance of memory reads while calculating the time complexity of an algorithm

For a memory read to be relevant to the algorithm, the information read in must be processed in some way. If the information is never compared or used as input to any operator, it will not affect the ...
Wildcard's user avatar
  • 335
6 votes

Why sequential access is faster than random access?

They are talking about two different things. One is about a medium that supports sequential access versus random access. The other is about reading data that is arranged sequentially or spread out ...
Derek Elkins left SE's user avatar
6 votes
Accepted

What are pointers in low-level language like C

In general, a pointer is a variable which holds the address of a variable. You can use https://godbolt.org/ to find out the assembly equivalent of a pointer. For example, ...
user123's user avatar
  • 1,132
6 votes

How to allocate memory in NASM without C functions (x64)?

On Linux you can use the brk syscall to extend you data segment. First call brk(0) to find the break point and then extend your ...
Knogger's user avatar
  • 1,549
5 votes

Are constants faster than variables?

Some machine instruction sets include instructions for which 'small' constants are part of the instruction, either explicitly or implicitly. E.g the set of 'add' instructions can include 'add ...
PMar's user avatar
  • 51
5 votes
Accepted

Cache effective access time calculation

This is the kind of case where all you need to do is to find and follow the definitions. There is nothing more you need to know semantically. What is actually happening in the physically world should ...
John L.'s user avatar
  • 39.1k
5 votes

Why don't integer multiplication algorithms use lookup tables?

If you want to use lookup tables, and you have 4GB of memory, you'll only be able to use a lookup table with about $2^{32}$ entries or fewer, so you'll only be able to handle multiplication of numbers ...
D.W.'s user avatar
  • 164k
5 votes
Accepted

How does a TLB lookup compare all keys simultaneously?

Computer hardware is fundamentally parallel. Even a modern single CPU core is pipelined, meaning that at the same instant in time, one physical part of the CPU is initiating a fetch of an instruction,...
andy_fingerhut's user avatar
4 votes

How does RAM is shared in multi core environment?

Memory access is not fully independent. As long as the cores work on different memory ranges (with distance considerably larger than the size of a "cache line", which caches consecutive memory values)...
jvb's user avatar
  • 221
4 votes

Understanding non-faulting and faulting software prefetches

It's unclear what you mean. A prefetch is faulting exactly when the actual access to the same data would be faulting. On the other hand, hardware that allows pre-fetches might not actually ...
gnasher729's user avatar
  • 31.4k
4 votes
Accepted

Does word addressable memory have more bytes than byte addressable memory?

If you had a byte addressable architecture where pointers have a fixed size, and every or almost every bit pattern is a valid pointer to a distinct byte address, and a word addressable architecture ...
gnasher729's user avatar
  • 31.4k
4 votes
Accepted

Row Major Vs Column Major Order: 2D arrays access in programming languages

The way you access the array affects performance. It depends on how the matrix is represented and stored in memory. Often a matrix is stored in row-major order, so that consecutive elements of a row ...
D.W.'s user avatar
  • 164k
4 votes

Exactly why the time taken by 'memory reads', is not considered while calculating time complexity of an algorithm?

People don't usually refer to the hard drive as "memory" though the term "external memory" is common in this area of the literature. As far as disk accesses are concerned, they are taken into account ...
Derek Elkins left SE's user avatar
4 votes
Accepted

Question on "Hitting the memory wall, implications of the obvious"

You have it backwards. $t_m$ is what's growing exponentially relative to $t_c$. Or rather, $t_c$ is decreasing exponentially at a rate faster than $t_m$. $t_c$ and $t_m$ are the times the accesses ...
Derek Elkins left SE's user avatar
4 votes
Accepted

Valid bit incoherence between TLB and Page Table

The typical scenario where this kind of incoherence can occur is when the page table has been changed. In this case, an invalid PTE has become valid; perhaps the area of address space has been ...
Pseudonym's user avatar
  • 23.1k
4 votes
Accepted

Why don't integer multiplication algorithms use lookup tables?

Some integer multiplication algorithms do use lookup tables. The IBM 1620 Model I "CADET" lacked a conventional ALU: addition and subtraction used a 100 digit table; multiplication used a ...
David Cary's user avatar
4 votes

In a DBMS what are the implementation details that make set operations faster than cursors?

Set-based operations are iterative at a "low level", and are not necessarily any faster to execute than cursors under all circumstances. The main advantage with set-based operations is that ...
Steve's user avatar
  • 592
4 votes
Accepted

Are there absolute reasons to prefer row/column-major memory ordering?

Whether row-major or column-major order is more efficient, depends on the storage access patterns of a specific application. The underlying principle of computing is that accessing storage in ...
Steve's user avatar
  • 592
4 votes
Accepted

How are processor instructions stored in RAM?

Some processors - generally, 32-bit RISC ones - make sure that all instructions fit in one location in memory. This works for them because 32 bits is enough to fit plenty of instructions, and it makes ...
user20574's user avatar
  • 1,845
3 votes

Does word addressable memory have more bytes than byte addressable memory?

How is it possible that tha same ram, i.e given the ram size is 4 GB, would contain different number of bytes depending on byte/ word addressable memory? It isn't. a 4GB amount of ram would either ...
Tom van der Zanden's user avatar
3 votes
Accepted

How does RAM is shared in multi core environment?

I learnt that multi core processors have more than one processing units Well having more than one processing unit is something present even outside multi-code processors. Processors which are able ...
AProgrammer's user avatar
  • 3,099
3 votes

How does a computer determine the data type of a byte?

Datatypes are not a hardware feature. The CPU knows a couple (well, a lot) of different commands. Those are called the instruction set of a CPU. One of the best known ones is the x86 instruction set. ...
Martin Thoma's user avatar
  • 2,360
3 votes

Relevance of memory reads while calculating the time complexity of an algorithm

If you follow D.W.'s definition, a "memory read operation" is an operation and can read only one item from memory, so from that definition alone the number of operations must be the same or larger ...
gnasher729's user avatar
  • 31.4k
3 votes

Is PREFETCH an asynchronous operation?

If it is implemented in hardware, prefetching is typically done asynchronously. It's also possible for a compiler to insert extra prefetch instructions into the code. Thus, the initiation of the ...
D.W.'s user avatar
  • 164k

Only top scored, non community-wiki answers of a minimum length are eligible