Khushboo raipur
Khushboo raipur

Reputation: 11

Assembly language programming segmentation

In assembly language when we declare like ds:data,cs:code,es:extra,ss:stack and likewise. I'm little bit confused that these segmens gets created in RAM or in Hard Disk memory.

Upvotes: 1

Views: 117

Answers (1)

Netch
Netch

Reputation: 4562

For your program, it is always in RAM. If it runs on bare hardware, it is also true for hardware.

But, if the program runs under a typical modern OS, you don't know whether and when some data are moved to disk. It is possible that on access attempt your program will be stopped, and then resumed when OS returns data to RAM. See Paging for details.

And, you should take care who and how "creates" segments. If you use x86 in real mode, then, memory shall be allocated and data put there first in 1MB address space. Only then you can load segment address to a segment register and declare what is this used for.

Upvotes: 1

Related Questions