Memory management.

Slides:



Advertisements
Similar presentations
MEMORY MANAGEMENT Y. Colette Lemard. MEMORY MANAGEMENT The management of memory is one of the functions of the Operating System MEMORY = MAIN MEMORY =
Advertisements

Background Virtual memory – separation of user logical memory from physical memory. Only part of the program needs to be in memory for execution. Logical.
Paging: Design Issues. Readings r Silbershatz et al: ,
Part IV: Memory Management
Chapter 6: Memory Management
Computer Basics Dayton Metro Library Place photo here May 20, 2015.
Memory Management 2010.
Memory Organization.
Chapter 3.2 : Virtual Memory
Chapter 9 Virtual Memory Produced by Lemlem Kebede Monday, July 16, 2001.
Computer Organization and Architecture
Computer Memory.
CS364 CH08 Operating System Support TECH Computer Science Operating System Overview Scheduling Memory Management Pentium II and PowerPC Memory Management.
Layers and Views of a Computer System Operating System Services Program creation Program execution Access to I/O devices Controlled access to files System.
Tutorial 6 Memory Management
Memory Main memory consists of a number of storage locations, each of which is identified by a unique address The ability of the CPU to identify each location.
Chapter 3 Memory Management: Virtual Memory
Computing Hardware Starter.
Computers in the real world Objectives Understand what is meant by memory Difference between RAM and ROM Look at how memory affects the performance of.
Random access memory.
Computing hardware CPU.
Tutorial 7 Memory Management presented by: Antonio Maiorano Paul Di Marco.
Review of Memory Management, Virtual Memory CS448.
Memory Management From Chapter 4, Modern Operating Systems, Andrew S. Tanenbaum.
Operating Systems. Without an operating system your computer would be useless! A computer contains an Operating System on its Hard Drive. This is loaded.
Cosc 2150: Computer Organization Chapter 6, Part 2 Virtual Memory.
1 Chapter 3.2 : Virtual Memory What is virtual memory? What is virtual memory? Virtual memory management schemes Virtual memory management schemes Paging.
Chapter 4 Storage Management (Memory Management).
IT253: Computer Organization
Chapter 9: Virtual Memory Background Demand Paging Copy-on-Write Page Replacement Allocation of Frames Thrashing Memory-Mapped Files Allocating Kernel.
Memory Management – Page 1 of 49CSCI 4717 – Computer Architecture Memory Management Uni-program – memory split into two parts –One for Operating System.
VIRTUAL MEMORY By Thi Nguyen. Motivation  In early time, the main memory was not large enough to store and execute complex program as higher level languages.
OPERATING SYSTEMS Lecture 3: we will explore the role of the operating system in a computer Networks and Communication Department 1.
Damian Gordon. HARD DISK (MAIN MEMORY) (SECONDARY MEMORY) 2 CACHE 1.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Memory: Relocation.
Chapter 4 Memory Management Virtual Memory.
Ch7d- 2 EE/CS/CPE Computer Organization  Seattle Pacific University Individual Space Every process wants its own space Ideally, it would like.
Computer Systems Week 14: Memory Management Amanda Oddie.
© GCSE Computing Computing Hardware Starter. Creating a spreadsheet to demonstrate the size of memory. 1 byte = 1 character or about 1 pixel of information.
CS.305 Computer Architecture Memory: Virtual Adapted from Computer Organization and Design, Patterson & Hennessy, © 2005, and from slides kindly made available.
Memory Management OS Fazal Rehman Shamil. swapping Swapping concept comes in terms of process scheduling. Swapping is basically implemented by Medium.
Virtual Memory Pranav Shah CS147 - Sin Min Lee. Concept of Virtual Memory Purpose of Virtual Memory - to use hard disk as an extension of RAM. Personal.
Virtual Memory From course notes University of Waikato. Some material by Tony McGregor Other material from: The Architecture.
Chapter 7 Memory Management Eighth Edition William Stallings Operating Systems: Internals and Design Principles.
Memory Management Chapter 5 Advanced Operating System.
Memory management The main purpose of a computer system is to execute programs. These programs, together with the data they access, must be in main memory.
F453 Module 8: Low Level Languages 8.1: Use of Computer Architecture.
Operating Systems c. define and explain the purpose of scheduling, job queues, priorities and how they are used to manage job throughput; d. explain how.
Virtual Memory (Section 9.3). The Need For Virtual Memory Many computers don’t have enough memory in RAM to accommodate all the programs a user wants.
Lesson Objectives Aims Key Words Paging, Segmentation, Virtual Memory
Memory Miss Elliott.
Chapter 2 Memory and process management
Understanding Operating Systems Seventh Edition
ITEC 202 Operating Systems
Memory Main memory consists of a number of storage locations, each of which is identified by a unique address The ability of the CPU to identify each location.
Memory Main memory consists of a number of storage locations, each of which is identified by a unique address The ability of the CPU to identify each location.
William Stallings Computer Organization and Architecture
I/O Resource Management: Software
Swapping Segmented paging allows us to have non-contiguous allocations
CSI 400/500 Operating Systems Spring 2009
14/11/2018 RAM and ROM.
O.S Lecture 13 Virtual Memory.
Module IV Memory Organization.
2.C Memory GCSE Computing Langley Park School for Boys.
Memory management Explain how memory is managed in a typical modern computer system (virtual memory, paging and segmentation should be described.
Management From the memory view, we can list four important tasks that the OS is responsible for ; To know the used and unused memory partitions To allocate.
Year 10 Computer Science Hardware - CPU and RAM.
Objectives Describe the difference between RAM and ROM
COMP755 Advanced Operating Systems
Operating Systems: Internals and Design Principles, 6/E
Presentation transcript:

Memory management

Memory Management - explain how memory is managed in a typical modern computer system, (virtual memory, paging and segmentation should be described along with some of the problems which could occur such as disk thrashing)

Memory Management – Virtual Memory Primary memory has a limit i.e. how many RAM chips you have in the computer. But there is a trick that the memory manager can use to fool the operating system into thinking that there is more primary memory than is actually physically present. This trick is called virtual memory. As has been mentioned, all executing software needs to run in primary memory and is temporarily stored in segments. When the computer is running short of physical primary memory e.g. too many applications open, the memory manager has a choice. It can either shut down applications (very inconvenient) or it can try and scrounge some more memory from somewhere else. This is where virtual memory comes in. The memory manager will begin to use parts of secondary memory such as the hard disk or a Flash USB drive as primary memory.

Memory Management – Virtual Memory Pages that have not been used for a while will be stored on the hard disk as virtual memory. This means that the pages are still available but will take some time to restore into primary memory. The benefit of doing this is to allow more applications to run than would be physically possible if you were only using RAM. While virtual memory will allow more applications to be open, it should be appreciated that a physical hard disk is being used and so applications will run far slower than if they were stored completely in RAM. In an examination question it is essential to remember the following: Virtual memory is making use of secondary memory (backing store) as if it were main memory. Virtual memory acts as an extended form of primary memory.

Memory Management - Paging Paging is where relatively inactive pages are temporarily removed from physical memory and placed into virtual memory. In Windows 8, paging and virtual memory is still a controlled feature, although adjustment is now six layers deep within the relevant option menus. The screen capture below is for Windows XP, but the principle remains just the same even with the latest operating system versions. Paging happens when main memory is getting a bit full. The memory manager will look at the pages in main memory and identify those which haven't been used for a while. They will be moved into virtual memory. When an application needs data held on a page in virtual memory it will be swapped back into main memory and another inactive page may take its place. In order to manage these pages a 'page table' is created by the memory manager which stores the starting address of each page. The starting address is where the first byte of each page is physically located in memory.

Memory Management - Paging Paging is possible because the memory manager divides primary memory into sections of equal size - called pages. The pages are efficiently set to be the same size as the sectors on the hard disk. To demonstrate why setting the page size to be the same size as a hard disk sector is efficient, consider a hard disk with a sector size of 4kb, but the memory manager has been set to have a page size of 6kb. When a page of data needs to be stored, it will have to occupy 2 sectors, and wastes the 2kb left over. So it is much more efficient for pages and hard disk sectors to be the same size. A page can be as little as 512 bytes or as large as 64kb or more.

Memory Management - Segmentation 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 here: 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.

Memory Management - Segmentation 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 here.

Memory Management - Threshing Disk Thrashing is a problem that may occur when virtual memory is being used. As main memory fills up, then more and more pages need to be swapped in and out of virtual memory. This swapping leads to a very high rate of hard disk access. Compared to RAM, moving a hard disk head takes thousands of times longer. And so eventually more time is spent swapping the pages than on processing the data. If disk thrashing continues then most likely program will lock-up or not run.

Memory Management - Threshing It doesn't do the hard disk any good either as it is being accessed rapidly (thousands of times per second) by the memory manager. Sometimes you can hear the disk whirring away when disk thrashing occurs. Usually the operating system will warn the user of 'Low virtual memory' to encourage them to shut down a few applications before everything grinds to a halt.

Task… Page sizes are traditionally 4Kb, but modern systems offer the option of significantly larger page sizes. Discuss what the advantages and disadvantages might be of larger page sizes. Describe what is meant by disk thrashing Explain why adding RAM to a computer system can improve its performance. Create a 20 question exam paper on Memory Management. Include 1,2 and 3 marks questions and remember the answers!!