What is a page from Linux point of view ?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers What is a page from Linux point of view ?
# 1  
Old 11-21-2015
What is a page from Linux point of view ?

Versions : RHEL 6.xx /OL 6.xx

I am trying to understand what a page is in Linux? The concept should be same in Unix as well, I guess

The below doc says "A page is a block of virtual memory. A typical block size on Linux operating system is 4KB "

https://github.com/angrave/SystemPro...Virtual-Memory

Is 'Page' a hard disk based memory or Physical RAM based memory or both ? Because I know that you can install Linux OS with no Swap partition at all. In such a machine a 'page' should reside entirely on Physical RAM. Right ?
# 2  
Old 11-21-2015
Hi kraljic...

'Memory Paging' is an art in its own right.
I would suggest this as a starting point:-

https://en.wikipedia.org/wiki/Paging...x-like_systems

It is a deep science and part of OS design, but, from the shell scripting and most other high level languages POV is transparent to the coder.

If however you intend to create an operating system you will need some serious knowledge of the hardware and how the MMU, 'Memory Management Unit', works.

There are plenty of links in the article for closely related stuff...

Have fun. ;o)
This User Gave Thanks to wisecracker For This Post:
# 3  
Old 11-22-2015
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
This User Gave Thanks to bakunin For This Post:
# 4  
Old 11-22-2015
As an addendum to bakunin's post as he has pointed to the history of _memory_management_ of the Intel 8088 and above it might be of interest to have a browse of, note not just swap files but '*.TMP' and '*.OVL' files too:-

(Intel Architecture.)
Bottom 64KB usage, where interrupt vectors reside inside the bottom 1024 bytes.
ROM at the top 64KB of 1MB address space, (shadowed by RAM).
Conventional Memory.
HMA, High Memory Area.
UMB, Upper Memory Blocks.
EMS, Expanded Memory Specification. LIM 4.x - Lotus, Intel, Microsoft Specifiaction 4.x
XMS, Extended Memory Specification.
DOS Extenders.
The '.OVL' file extension.
The use of '.TMP' files.

These are all related...

And as a subdivision:-
VCPI, Virtual Control Program Interface.
DPMI, Dos Protected Mode Interface - Superceded VCPI.
Unreal Mode of running.

There is much more and all this is of historic interest but shows how we have gotten to where we are now, especially in the Intel architecture arena...
# 5  
Old 11-23-2015
The doc should say "A typical block size on a standard x86 computer is 4KB ". This is because the MMU hardware supports 4k.
(Example Sparc: the Ultra-III hardware supports 8k, 64k, 512k, 4m pages)
A new page is always in RAM. If RAM becomes too full, old pages are moved to swap.
The virtual memory is RAM + swap (provided that enough pages are swap-able).
The more swap is in use, the more likely the system becomes slow. Therefore the OS tries to avoid swap. (Some people configure no swap to have the system always fast. But the less virtual memory means it runs sooner (and faster!) out of memory and becomes stuck.)
This User Gave Thanks to MadeInGermany For This Post:
 
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Using PHP to view syslog in private web page

I am trying to extract data from syslog and view it on a web page. I'm using a php script. This line works from command line tail -n 11 /var/log/_gateway-syslog.log | grep -a iWiSP-Out | awk '{print $8, $9,$10,$11" ",$19," " $15, $16,$17," " $18,$21, $22}' when I put it into... (4 Replies)
Discussion started by: ae4ml
4 Replies

2. Red Hat

Increase mount point size after linux installation !

Dear Friends , I have to install Redhat Ent Linux 5.0 (RHEL 5) in my machine . My HDD space is total 40 GB . During installation , I give three partitions , '/' = 30GB, 'swap'=2GB, 'home' =1GB. Now my HDD remaining space is 7 GB . After installation , I need to increase the home... (4 Replies)
Discussion started by: shipon_97
4 Replies

3. Shell Programming and Scripting

View an html page inside zenity

Hi! :) Inside a bash script, I have an html page: "example.html" I need: - read "example.html. - print and view the result for example with dillo (or another light browser) inside zenity with clickable images and links. Some stuff like: zenity --html-info --filename=example.html Is... (0 Replies)
Discussion started by: aspire
0 Replies

4. UNIX for Dummies Questions & Answers

floating point error in linux + C

Here's a program and its pretty simple .It requires file handling and some calculations but on running it I am not getting the required result.It seems that the code outside the file read's outer while loop is not executing e.g the print statement is not being printed.Plz Help! #include<stdio.h>... (1 Reply)
Discussion started by: headrush
1 Replies

5. UNIX for Advanced & Expert Users

view remote linux desktop on my windows machine

Hi, is there anyway i can view a remote linux desktop on my windows desktop? i am aware that X11 can see 'certain screens'. For eg if i type 'xclock &' and i have a client running on my windows, i can see the clock. If i am interested to see the entire desktop of my linux, how can i do it? (4 Replies)
Discussion started by: new2ss
4 Replies

6. Programming

how to view loaded shared libraries by running processes in linux

anybody knows how to view loaded shared libraries by running processes in linux enviornment? any command or tool ? thanks a lot (3 Replies)
Discussion started by: princelinux
3 Replies

7. UNIX for Dummies Questions & Answers

View Files In Linux/Windows

I have a bunch of text files that currently reside on a red hat linux machine. I'd like to zip them up and copy them to a windows machine. I'm not sure about how to do this though since I believe zipping files up creates a totally different format that will be unreadable on windows. Is there any... (3 Replies)
Discussion started by: doublek321
3 Replies

8. UNIX for Dummies Questions & Answers

view page command?

Hi All, When I run a command on any shell, many times the output is longer than the screen can hold, so I only can see parts of the output. Is there a command that will show me page by page the results of each command? Thanks, Jared (3 Replies)
Discussion started by: JaredsNew
3 Replies
Login or Register to Ask a Question