Quote:
Originally Posted by
kraljic
The below doc says "A page is a block of virtual memory. A typical block size on Linux operating system is 4KB "
Is 'Page' a hard disk based memory or Physical RAM based memory or both ?
There are several (different) uses of the word "page", but within the context of your quote i suppose it refers to
memory pages. A "memory page" is just a part of memory of a fixed sized by which memory (any memory - UNIX does in principle not differentiate between real memory [RAM] and virtual memory [RAM+paging space] ) is organized. It is a similar concept to "disk blocks" (which themselves are sometimes called "pages").
Historically there were processors which had more memory than they could really address: an 8-bit processor like the 8080 (the great-great-granduncle of todays Intel-/AMD-processors) or the 6502 (the "Commodore C64" basis) could natively address only 256 bytes of memory, which was not enough for even basic programs. To overcome this the address was split into two parts, one byte each, so that 65535 (=64k) bytes could be addressed. All addresses with a common "first part" (i.e. all addresses within a certain 256-byte range) were called a "page" and the first 256 byte of memory (which was called "zero-page", because the "page number" was 0) held special routines which were of core importance to the operating system.
Other processors (like the 8086) were 16-bit and had 16-bit addresses but that would have resulted in only 64k addressable memory. The PC (which the 8086 powered) was built with 1M (=16x64k) memory and for that one needs 20bit addresses. This was done by introducing 16-bit "segment registers", which held the upper 16 bit of the address whereas the real address register held the lower 16 bit. These two where added, so that a "segment" could only start at every 16th byte but span a range of 64k each. The real address register was treated as an offset to the segment register.
You might remember (if you are old enough) that in DOS "COM"-programs could only be 64k in size whereas "EXE" programs could be bigger. The reason was this segmented memory approach: a COm program had to fit into exactly one such segment, which made memory handling easier and the programs faster but since the segment registers never got changed during the programs run it was confined to the size of one segment.
In UNIX in most cases a memory page size of 4k is in place, but this is not necessarily so. In AIX one could configure the system to use memory pages of 4k or/and 64M in parallel and for large (memorywise) applications like databases (which need to hold indexes and similar data in memory for speed) this is sometimes done.
So, as a conclusion: a memory page is an organisational unit by which memory is allocated, similar to disk blocks in a filesystem. The size of a memory page can vary, even within the same OS, but 4k is the most common size.
I hope this helps.
bakunin