Presentation on theme: "Lesson Objectives Aims Key Words Paging, Segmentation, Virtual Memory"— Presentation transcript:
1 Lesson Objectives Aims Key Words Paging, Segmentation, Virtual Memory Be able to describe how memory is managed in an operating systemUnderstand the following terms:PagingSegmentationVirtual memoryKey Words Paging, Segmentation, Virtual Memory
2 Remember our history lesson… Early computers and micro computers usually ran one task only until completionThis meant memory management was simple – why?
3 Single contiguous allocation Sounds complex, but all this means is:There will be a small amount of memory reserved for the operating system/system useThe rest is for the single task loaded/programmed/running on the system
4 Multi-tasking, Multi-programming Any system that allows multiple programs/processes/tasks to run at the same time must make use of some form of memory management.There are three main typesPagingSegmentationVirtual memory
5 When is memory not memory? When it’s storage…Storage (hard drives, SSD’s) can be used as working memoryDedicated memory such as RAM is referred to as “Primary Memory”Any other store used as memory is referred to as “Secondary Memory”
6 Paging, Segmentation, Virtual Memory TaskFor each type of memory management, do the following:Draw and label a detailed diagram explaining how it works and highlighting any key termsGive a short description of what it is/entailsExtra info – any advantages or disadvantages, operating system overheads, examples of where it is usedPaging, Segmentation, Virtual Memory
7 Paging In simple terms… A page is a unit of logical memory of a programA frame is a unit of physical memoryAll pages are of the same sizeAll frames are of the same size
9 PagingPaging – Also called swapping – is the process of moving data between RAM and virtual memory.It moves data out of RAM that is not immediately needed and replaces it with ones that are.This process is slower than using just using primary memory alone since secondary storage is slower and the data has to move around more.It achieves this by using a page table to keep track of where data resides.
11 Segmentation Memory segments are NOT of fixed width Each program is split in to component parts – Code, Variables, Stacks, Libraries etcEach part does not need to be stored contiguously in memoryThis means we can SHARE memory segments
12 SegmentationWhen programs are loaded up into memory, segmentation allows the primary memory to store only the bit it needs at that particular time.For example, Dynamic Link Libraries can be stored on the hard disk until called by main memory by a program.Segmentation allows programs to be broken up into smaller address spaces and each can have its own type of protection and can be shared amongst other processes.
13 Virtual MemoryRAM is a finite resourceIt is quite possible to open more programs than there is memory available to useVirtual memory uses paging to allocate sections of Secondary Memory to enable this to happen
14 Virtual MemoryUses secondary storage (such as the hard disk) as an extension of physical memory (RAM).The memory manager can trick the operating system into thinking that it has more physical memory than it actually does by making use of secondary storage such as the hard disk or flash drives
15 Virtual MemoryO/S can page out idle tasks in to virtual memory to free up Primary MemoryPaging to Secondary Memory takes LOTS of time and therefore isn’t an ideal solution
16 SummaryComputer memory consists of primary memory (random-access memory [RAM]) for running programs and secondary memory (Hard Disk Drive [HDD] and other storage media).The memory manager allocates primary memory to running processes.Segments are blocks of memory that can vary in size. A segmentation table keeps track of the addresses of segments used by each process.Pages are fixed-size blocks of memory that are smaller in size than segments. Details of the mapping of logical addresses to physical addresses are stored in the page table.Pages can be swapped out to a virtual memory page file on the HDD. A flag in the page file indicates that this has happened.If too many pages are being swapped in and out of virtual memory, the system can slow down and become unresponsive, which is known as disc thrashing
17 Review/Success Criteria You should understand:The need for memory managementThree memory management techniquesWhat a Page, Frame and Segment are