(This is the older material - click here - for current specification content)

5. Segmentation

As we have seen, hard disks can be partitioned into different drives. However, primary (main) memory can also be split up. This is done in a completely different way to partitioning a hard disk. Make sure that you don't get confused between disk partitioning and memory partitioning.

The memory manager is the part of the operating system that deals with memory.

All applications need to be loaded into main memory before they can be executed. In order to do so, a temporary 'segment' is created by the memory manager.

Every loaded application will have some instructions or program code for the CPU to execute. The loaded application will need a data area to hold its variables. It will also need a special area called 'the stack' to handle sub-routines and interrupts. It will also need some free memory within the segment to allow the stack to grow and shrink.

A typical segment is shown below:

typical memory segment

The example segment above is 64kb in overall size but by no means is this a fixed size. You could have a segment smaller or larger than this.

To summarise:

  • Code segment, where the program code is stored
  • Data segment, where variables defined by the code are stored whilst the application is running.
  • Stack segment, starts from the top of the segment and grows downwards. The stack is used by sub-routines and interrupt service routines to hold temporary data and addresses.

There can be many segments in memory at the same time. Each one is a separate process or application and each may be a different size. As shown below.

memory managment


Challenge see if you can find out one extra fact on this topic that we haven't already told you

Click on this link: Memory Segmentation



Copyright © www.teach-ict.com