New answers tagged

0

The text / code you are looking at on your display right now is a view of the underlying voltages residing on Memory ; therefore, if it’s not a voltage on memory, it’s never on screen. Text/code is a view of voltages To compile source code means cover underlying voltages to different voltages and view the resulted voltages as compiled code/text


3

The phrase "The Ackermann function isn't implementable with for-loops" is shorthand for "The Ackermann function $A(m,n)$ cannot be implemented using bounded for-loops where an upper bound on the number of iterations in each loop is determined in advance from the values of the parameters $m$ and $n$". In other words the Ackermann function is not primitive ...


1

Using a stack for function calls does not require any special support from the processor. It's up to the compiler to decide where to put the data relative to a function call (return address, parameters, possibly reserved space for the return value). A common convention is to designate one particular register as the stack pointer. This does not require any ...


0

I have an answer by demonstration; here's what x86-64 gcc 4.8.5 has to say on the issue. Here's the C code: int ackermann(int m, int n) { if (m == 0) { return n + 1; } else if (m > 0 && n == 0) { return ackermann(m - 1, 1); } else if (m > 0 && n > 0) { return ackermann(m - 1, ackermann(m, ...


4

Real machines have access to a stack, and so can implement recursion. This is all that is needed to implement the Ackermann function. However, the Ackermann function grows very fast, so you would only be able to calculate a few of its values given realistic time and space constraints.


0

Ram used to load a program because ram is a volatile memory i.e. after. Power cut or after the task is over the data in ram is lost so all the data is saved in. Our hard disk Here. Copying and loading are equivalent in this case


0

Adding to other answers: Modern CPU's can mark memory regions as "do not execute" or "do not modify", and the operating system will instruct them to do so. So if you start a program, the operating system should know which part of memory is instructions, and which is data. It will then mark the data as "do not execute" (because you really don't want the CPU ...


2

In current architectures, the CPU does not need to distinguish. Whatever is pointed by the program counter register will be interpreted as an instruction and executed. Everything else can be manipulated as "data". For example, you can have a program modify its own code (in fact, some computer viruses do this, with the aim of avoiding detection).


2

It doesn't. The CPU executes instructions beginning at the program's start address. After each instruction, the CPU either jumps to the address specified by that instruction or, if it's not a jump, moves on to the next instruction in memory. The start address is known to contain executable code because the program was just loaded there. The correctness of ...


3

A full answer to this question depends on the underlying computer architecture, as well as on layers of protection that the operating system may add on top of the basic architecture. In the Harvard architecture instructions and read/write data are held in physically separate memory stores accessed by separate data pathways (buses). It is physically ...


2

The computer doesn't know, just as it has no idea whether the information at a certain memory cell should be interpreted as a character, integer or floating point number. When executing code, the CPU reads the code byte by byte. Each instruction is composed of an opcode followed by relevant information, such as constants (immediates) and addresses. In ...


4

LSB (least significant bit) and MSB (most significant bit) apply purely to the values of an integer. The least significant bit is the bit with value 1, the second least significant bit is the bit with value 2, and so on. "Little endian" and "Big endian" are just artefacts from the fact that the bytes of a number can be accessed individually as they are ...


2

$01100 \Rightarrow +12$, not $+24$. And it is $+12$ because $32-20=12$. With $5$ bits and $2$s complement you can only represent numbers in the range $-16$ to $+15$. You have overflowed this range and, in effect, "run around" to the other end and into the positive number range.


1

Textbooks don’t have to include everything. There should be room for you to figure out things yourself. Otherwise, how would we ever create things not found in today’s textbooks? Maintaining the TLB is a tiny bit of code in the operating system. But every single instruction accessing memory relies on the TLB. Do you think the TLB does NOT save enormous ...


Top 50 recent answers are included