Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What manages RAM?

When an assembly program is compiled and run on a machine without an operating system, how is a starting address in RAM chosen so that variables declared with data directives are allocated properly?

like image 929
TheResolute Avatar asked Feb 03 '12 16:02

TheResolute


People also ask

What controls RAM in a computer?

The transistor acts as a switch that lets the control circuitry on the memory chip read the capacitor or change its state. A capacitor is like a small bucket that can store electrons. To store a 1 in the memory cell, the bucket is filled with electrons.

Do operating systems manage RAM?

When a computer runs out of RAM, the operating system (OS) will move idle or unwanted pages of memory to secondary memory to free up RAM for other processes and brings them back when needed by the program.

How is RAM memory stored?

RAM is physically small and stored in microchips. It's also small in terms of the amount of data it can hold. A typical laptop computer may come with 8 gigabytes of RAM, while a hard disk can hold 10 terabytes. A hard drive, on the other hand, stores data on the magnetized surface of what looks like a vinyl record.

How does RAM work with CPU?

A CPU works by processing and decoding instructions received from RAM. After an operation is performed, the CPU quickly fetches the next set of instructions. A processor will repeat this cycle to perform complex functions like running a game, program, or even your operating system.


1 Answers

As said, the address under which the CPU expects the starting program to be is usually hardwired. It's probably programmable in the case of some very specific CPUs or such, but in the case of x86, it's FFFF0, or - to be more exact - FFFFFFF0, so 16 bytes below the CPU's uppermost physical address. The motherboard usually maps these addresses to the ROM, which contains (most probably) a jump to the BIOS code, which in turn boots up the computer.

When it comes to operating systems themselves, they choose where to load the program, then they do the actual loading, and transfer the execution to it. In the case of DOS, for example, simple small applications (those distributed as COM files) were loaded at address 100, and then the command prompt executed a jump to that address, effectively beginning execution of the code loaded at that address. With more advanced systems which employ virtual memory, the issue is of course more complicated.

like image 181
Daniel Kamil Kozar Avatar answered Sep 29 '22 06:09

Daniel Kamil Kozar