Link to home
Start Free TrialLog in
Avatar of heyhey84
heyhey84

asked on

Theory Question about MM

what it mean by - different memory management scheme in different OS?
Avatar of xRalf
xRalf

Hi heyhey84,
here is quite good explanation of memory managment http://webfuse.cqu.edu.au/Courses/aut2001/85349/Resources/Lectures/8/
Avatar of heyhey84

ASKER

So the 2 scheme is Paging and segmentation? Does it say what is the rational or motive for those operating system using these scheme?
Avatar of noci
nope, different issues....

swapping/paging provide virtual memory by making place in real memory
through offloading contents to disk. (program as a whole or part).
The CPU needs to support this through lookup tables some how and signal if a bit
there tells the CPU to fetch a block of data from somewhere else)
CPU's like 8080, z80, 8086 don't have this support
CPU's like VAX, ALPHA, 80386, 80486, pentium* etc do have this support
(Also called demand paging). The main difference:
swapping moves whole programs, whereas paging only moves needed parts.

segmentation is a way to enlarge address space  without needing a whole new system
like 8080,Z80 are 8bit with 16bit addresses, the 8086 was a 16bit system with 20 bit addresses. At the time 1MB of memory was huge, indeed systems mostly had 16KB tops.
and to save money only 16 bit register are used,with a simple translater to enlarge this to 20 bits (shift left by 4 and add an offset).

If segmentation goes through a lookuptable like on the 80286 then you can again do
virtualisation. But the overhead in an OS is too big to handle variably sized chunks of memory, any time spent there managing is a waste. ==> pages are more or less comparable to fixed size segments. The main difference is that segments are visible to a program where pages are not.

try to read and understand the preiously given link.
All the slides too, not just the index
Also try to lookup on specs of CPU's they tell you the detailed story about what hardware can do.

Start looking from wikipedia "Computer Architecture"and go from there.
I would add that most of those slides are commented with audio.
I am reading the slides now and trying to understand it.
From what u had posted,
Those it mean that segmentation of less efficiency than paging? If so why are there OS still using it?
Ehm, because hardware needs it? it's an architecture thing decided upon by the CPU designer[-team]. Maybe try to get a hold on the book 'the soul of a new machine'
of tracy kidder, might give some insight how cpu design works...
http://www.amazon.com/Soul-New-Machine-Tracy-Kidder/dp/0316491977


You can't just pull a 80286 from a motherboard and putback a pentium pro etc.

Also when some systems come into existance they might become popular/important
widely used(think embedded), you can't call back all say less then 7 year old cars in the world to change their motor-management system processors.
Segmentation has also some advantages: No internal fragmentation, LAS (logical address space) is not divided implicitly into segments (it is the task of compiler).

The aim is to join the advantages of both mechanisms. Segmentation is used for various protections and sharing. The disadvante of placing the whole segments of various sizes into memory is eliminated with paging of individual segments. (e.g. Intel Pentium uses the combination of segmentation and paging.)
Hi xRalf

where can i find more information on what u have post?
Please also look into alpha, vax , itanium, sparc, ppc etc. architectures there the protection is page bound btw also in a pentium. In most x86 based designs paging is used solely. (OS/2 and old windows are the only exceptions I think i know of).
The problem being you have to do pagemanagement anyway so segmentation management needs to be done on top of that. Pagemanagment it's relative cheap because of the fixed size chunks it uses.
With variable sized chunks (segments) you need lookup lists and decide on first-fit/best-fit etc.
during "segment/page not-present" interrupt handling.
i am confuse about page in MM.

Let me say how i interpret it and can someone tell me am i wrong?

A page is like a piece of paper with a with tables in it.

So when a memory is needed, it look into the page and fetch the data from the main memory. (1 Level)

I read that 2 level or multi level is much faster. Somehow i dont understand why is it faster as it need more time to look for more pages.

I am quite confuse and somehow cannot visualize MM of a operating system. If somone can explained in real life concept, i would really appreciates it.
And what is meant by memory protection?
Seperation between user/kernel mode (or user,supervisor,executive & kernel mode for vax, alpha, itanium).
Separation between processes.

That means one process can't corrupt another process and can't corrupt/compromise the system (kernel)

But please read the pointed to materials & followup on leads there.
ASKER CERTIFIED SOLUTION
Avatar of xRalf
xRalf

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial


>>> So when a memory is needed, it look into the page and fetch the data from the main memory. (1 Level)

>When a memory is needed, OS looks into the page table (PT). This table has two columns (number of page, number >of frame) and determines in which frame a certain page is placed. To get the particilar address OS has to add to >the "number of frame" the offset (displacement) value.
>Page table is usually placed in RAM (for quick manipulation).

The CPU checks the a translation buffer (TLB) if there is nothing in that buffer the CPU consults the Pagetable.
In the page table there is a bit that sais Pageis valid (if not set => pagefault and the OS assists in filling that buffer, if page not valid the OS may use the other fields in the PTE (page table entry) for locating the
page in a different place.
For VMS there is a very good book "OpenVMS internals and datastructures", Ruth Goldenberg, everything is explained, including the code needed to manage stuff.

In stead of directly using a memory address, you have the overhead of looking it up in the TLB, then possibly in the PT and if not present it causes severalhundreds of thousands of instructions to be executed for load ding the page from disk. (Of course those instruction need to be in an area that is non-pagable).

You confuse caching of memory with memory management. Caching uses level1/level caching of parts of physical memory.