Theory Question about MM

what it mean by - different memory management scheme in different OS?
heyhey84Asked:
Who is Participating?
 
xRalfConnect With a Mentor Commented:
>> A page is like a piece of paper with tables in it.

A page is like a piece of paper with data and instructions (ones and zeros). Every page is placed in physical memory in certain frame.

>> 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).

>> Somehow i dont understand why is it faster as it need more time to look for more pages.

Yes. OS has to first go into the page table and this is slowdown. But the gain is elimination of external fragmentation.
Bigger problem is to solve external fragmentation. So we have to choose "the less evil".

>> I am quite confuse and somehow cannot visualize MM of a operating system.

look at this picture http://webfuse.cqu.edu.au/Courses/aut2001/85349/Resources/Lectures/8/17/
0
 
xRalfCommented:
Hi heyhey84,
here is quite good explanation of memory managment http://webfuse.cqu.edu.au/Courses/aut2001/85349/Resources/Lectures/8/
0
 
heyhey84Author Commented:
So the 2 scheme is Paging and segmentation? Does it say what is the rational or motive for those operating system using these scheme?
0
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

 
nociSoftware EngineerCommented:
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.
0
 
xRalfCommented:
I would add that most of those slides are commented with audio.
0
 
heyhey84Author Commented:
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?
0
 
nociSoftware EngineerCommented:
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.
0
 
xRalfCommented:
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.)
0
 
heyhey84Author Commented:
Hi xRalf

where can i find more information on what u have post?
0
 
nociSoftware EngineerCommented:
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.
0
 
heyhey84Author Commented:
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.
0
 
heyhey84Author Commented:
And what is meant by memory protection?
0
 
nociSoftware EngineerCommented:
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.
0
 
nociSoftware EngineerCommented:


>>> 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.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.