Memory Management. 3. What two registers can be used to provide a simple form of memory protection? Base register Limit Register

Size: px
Start display at page:

Download "Memory Management. 3. What two registers can be used to provide a simple form of memory protection? Base register Limit Register"

Transcription

1 Memory Management 1. Describe the sequence of instruction-execution life cycle? A typical instruction-execution life cycle: Fetches (load) an instruction from specific memory address. Decode the instruction and fetch operands from specific memory address. Execute the instruction on the operands. Store the results back in memory. 2. Memory unit only sees a stream of addresses + read requests during READ Operation and A stream of address + data and write requests during Write Operation. 3. What two registers can be used to provide a simple form of memory protection? Base register Limit Register 4. List the three different times at which address binding may occur. - Compile Time - Load Time - Execution Time 5. Compare between logical address and physical address? Logical address Does not refer to an actual existing address. it refers to an abstract address A logical address is generated by the CPU Physical address Refers to an actual physical address in memory. Physical addresses are generated by the MMU. 6. Consider a system in which a program can be separated into two parts: code and data. The CPU knows whether it wants an instruction (instruction fetch) or data (data fetch or store). Therefore, two base-limit register pairs are provided: one for instructions and one for data. The instruction base limit register pair is automatically read-only, so programs can be shared among different users. Discuss the advantages and disadvantages of this scheme. Answer: Advantages An effective mechanism for code and data sharing. For example, only one copy of an editor or a compiler needs to be kept in memory, and this code can be shared by all processes needing access to the editor or compiler code. Protection of code against modification Disadvantages the code and data must be separated 7. Why memory page sizes are always powers of 2? It is most efficient to break the address into X page bits and Y offset bits, rather than perform arithmetic on the address to calculate the page number and offset. Because each bit position represents a power of 2, splitting an address between bits results in a page size that is a power of 2.

2 8. Consider a logical address space of 64 pages of 1024 words each, mapped onto a physical memory of 32 frames. a. How many bits are there in the logical address? b. How many bits are there in the physical address? Answer: a. Logical address: 16 bits b. Physical address: 15 bits 9. Describe a mechanism by which one segment could belong to the address space of two different processes. Answer: Since segment tables are a collection of base limit registers, segments can be shared when entries in the segment table of two different jobs point to the same physical location. The two segment tables must have identical base pointers, and the shared segment number must be the same in the two processes. 10. In a multiprogramming environment, many processes may be active. What are the tasks that the OS must accomplish in order to manage the memory requirements of active processes? The OS must keep track of where and how a program resides in memory and convert logical program addresses into actual memory addresses. 11. Distinguish between logical addresses and physical addresses. A physical address is an actual address in the computer's main memory device. A logical address is an address relative to the program. A logical address is sometimes called a relative address for obvious reasons. 12. What is address binding? Address binding is the mapping of a logical address into a physical address. 13. Name two memory management techniques and give the general approach taken in each? Single contiguous memory management: - Only the OS and one application program are loaded into memory at the same time. Paging: - Main memory is divided into fixed-sized blocks called frames and processes are divided into fixed-sized blocks called pages. Any number of programs can be loaded with the OS, but a process does not necessarily have to be in contiguous memory and not all of a process need be in memory at the same time. 14. When is a logical address assigned to a variable? When the program is compiled. 15. When does address binding occur? When the program is loaded into memory. 16. How is memory divided in the single contiguous memory management approach? Memory is divided into two sections, one for the operating system and one for the application program.

3 17. When a program is compiled, where is it assumed that the program will be loaded into memory? That is, where are logical addresses assumed to begin? At location In a single contiguous memory management approach, if the logical address of a variable is L and the beginning of the application program is A, what is the formula for binding the logical address to the physical address? L + A 19. If, in a single contiguous memory management system, the program is loaded at address 30215, compute the physical addresses (in decimal) that correspond to the following logical addresses: A ( ) B ( ) C ( ) 20. If, in a fixed partition memory management system, the current value of the base register is and the current value of the limit register is 2031, compute the physical addresses that correspond to the following logical addresses: A B C Address out of bounds of partition. Because the generated address is greater than Base + limit. 21. Examples of allocating partitions in memory some requests 22. For the following state of memory. Operating System Process 1

4 Empty 60 blocks Process 2 Process 3 Empty 52 blocks Empty 100 blocks If the partitions are fixed and a new job arrives requiring 52 blocks of main memory, show memory after using each of the following partition selection approaches: A. First fit B. Best fit C. Worst fit First Fit Best Fit Worst Fit Operating System Process 1 New Process Process 2 Process 3 Empty 52 blocks Empty 100 blocks Operating System Process 1 Empty 60 blocks Process 2 Process 3 New Process Empty 100 blocks Operating System Process 1 Empty 60 blocks Process 2 Process 3 Empty 52 blocks New process 23. If a logical address in a paged memory management system is <2, 133>, what do the values mean? This address means the 133 byte on page For the following page table ( assume frame size=1024): Page Frame a. What is the physical address associated with the logical address <2, 85>? From the table Page 2 is mapped to frame 7 (7 frame No. * 1024 Frame size ) + 85 offset = 7253

5 b. What is the physical address associated with the logical address <3,555>? 3627 (the same as the previous question) c. What is the physical address associated with the logical address <3, 1555>? If the frame size of 1024, Illegal address. The offset is larger than the page size. 25. What is virtual memory and how does it apply to demand paging? Virtual memory is the illusion that memory is limitless and thus there is no limit on the size of a program. Demand paging is the technique where pages are brought into memory only when they are referenced (needed). Demand paging allows programs of any size, thus giving the illusion of infinite memory. /////////////////////////////////////////////////////// 26. Explain the difference between internal and external fragmentation. Internal Fragmentation is the area in a region or a page that is not used by the job occupying that region or page. This space is unavailable for use by the system until that job is finished and the page or region is released. The main difference is the allocation: internal fragmentation is allocated area and unused but external fragmentation is unallocated area and unused. 27. Given five memory partitions of 100 KB, 500 KB, 200 KB, 300 KB, and 600 KB (in order), how would each of the first-fit, best-fit, and worst-fit algorithms place processes of 212 KB, 417 KB, 112 KB, and 426 KB (in order)?which algorithm makes the most efficient use of memory? Let p1, p2, p3 & p4 are the names of the processes a. First-fit: P1>>> 100, 500, 200, 300, 600 P2>>> 100, 288, 200, 300, 600 P3>>> 100, 288, 200, 300, , 116, 200, 300, 183 <<<<< final set of hole P4 (426K) must wait b. Best-fit: P1>>> 100, 500, 200, 300, 600 P2>>> 100, 500, 200, 88, 600 P3>>> 100, 83, 200, 88, 600 P4>>> 100, 83, 88, 88, , 83, 88, 88, 174 <<<<< final set of hole c. Worst-fit: P1>>> 100, 500, 200, 300, 600 P2>>> 100, 500, 200, 300, 388 P3>>> 100, 83, 200, 300, , 83, 200, 300, 276 <<<<< final set of hole P4 (426K) must wait In this example, Best-fit turns out to be the best because there is no wait processes. 28. Consider a logical address space of 64 pages of 1024 words each, mapped onto a physical memory of 32 frames. a. How many bits are there in the logical address? m =???

6 Size of logical address space = 2 m = # of pages page size 2 m = m = m =2 16»» m=16 bit b. How many bits are there in the physical address? Let (x) is number of bits in the physical address x =??? Size of physical address space = 2 x Size of physical address space = # of frames frame size (frame size = page size ) Size of physical address space = x = x = 2 15»» number of required bits in the physical address=x =15 bit 29. Consider a logical address space of 32 pages of 1024 words per page, mapped onto a physical memory of 16 frames. a. How many bits are required in the logical address? m =??? Size of logical address space = 2 m = # of pages page size = = 2 15»» m=15 bit How many bits are required in the physical address? Size of physical address space = # of frames frame size (frame size = page size ) Size of physical address space = = 2 14»» number of required bits in the physical address =14 bit 30. Assuming a 1-KB page size, what are the page numbers and offsets for the following address references (provided as decimal numbers) 2375, 256, 30000, 19366, Answer: Page size =2 n =1024 B= 2 10 B # of bits in offset part (n) =10 Solution steps : 1. Convert logical address: Decimal Binary 2. Split binary address to 2 parts (page #, Offset), offset : n digits 3. Convert offset & page# : Binary Decimal Logical address (decimal) Logical address (binary) Page # (6 bits) (binary) Offset (10 bits) (binary) Page # (decimal) Offset (decimal)

7 Consider the following segment table: Segment Base Length >> there is a typing error in this row in book What are the physical addresses for the following logical addresses? a. 0,430 a = 649 b. 1,10 b = 2310 c. 2,500 c. illegal reference, trap to operating system d. 3,400 d = 1727 e. 4,112 e. illegal reference, trap to operating system 32. Compare the main memory organization schemes of contiguous-memory allocation, pure segmentation, and pure paging with respect to the following issues: External fragmentation, internal fragmentation and ability to share code across processes Answer: Internal Method External fragmentation ability to share code contiguous-memory allocation (variable size method) There is external fragmentation (as address spaces are allocated contiguously and holes develop as finished processes release its space and new processes are allocated and the size of the new process is almost smaller than the old one) fragmentation There is no internal fragmentation pure paging There is no external fragmentation There is internal fragmentation (it appears in the last frame because the process size almost not a multiplex of page size ) It does not allow processes to share code. Able to share code between processes

8 pure segmentation There is external fragmentation (fragmentation would occur as segments of finished processes are replaced by segments of new processes. and the size of the new process is almost smaller than the old one) There is no internal fragmentation Able to share code between processes 33. Given the following stream of page references by an application, calculate the number of page faults the application would incur with the following page replacement algorithms. Assume that all pages are initially free. Reference Stream: A B C D A B E A B C D E B A B a. FIFO page replacement with 3 physical pages available b. LRU page replacement with 3 physical pages available. c. OPT page replacement with 3 physical pages available.

9 True or False? 1. An address generated by the CPU is also referred to as a physical address. 2. Fragmentation can still occur in paging systems 3. A program does not need to be stored in memory in its entirety. 4. A physical address space is at least as large as a virtual address space. 5. In a pure demand paged system a page is never brought into memory until it is needed. 6. Approximation algorithms are almost always used when implementing LRU. 7. What is the hardware device that maps virtual to physical addresses? 8. What are the three strategies for selecting a free hole from the set of available holes? 9. What are the two forms of fragmentation? 10. List at least two possible parts of a program that may be assigned separate segments. 11. What are the two parts of an address generated by the CPU? 12. What does each entry in the page table contain? 13. What is the term that describes when a page number is not present in the TLB? 14. If a page offset is 13 bits, how large (in bytes) is the page? 15. How many entries are in a two-level page table with a 20-bit page number? 16. When does a page fault occur? 17. What is the simplest page replacement algorithm? 18. What is the name of the page replacement algorithm that operates by 19. Replacing the page that will not be used for the longest period of time? 20. What page replacement algorithm could be implemented using a stack or counters? 21. Name two differences between logical and physical addresses. Some Solved Questions on Process Management 1. What are the conceptual stages through which a process moves while being managed by the operating system?

10 New, ready, running, waiting, and terminated 2. Describe how a process might move through the various process states. Create specific reasons why this process moves from one state to another. A new process begins in the new state. When the process has no bars to its execution, it moves into the ready state. It waits in the ready state until it gets time in the running state. It runs for a while and issues a command for file input. The process is moved into the waiting state until the I/O has been completed, at which time it moves into the ready state to await another turn in the running state. Eventually it gets back to the CPU and runs until it needs access to a part of the program that is on secondary storage. It moves into the waiting state until the needed pages are brought in; then it moves back to the ready state. It gets its third shot at the CPU and finishes, and moves into the terminated state. 3. What is a process control block? A process control block (PCB) is a data structure that contains information about a process. A PCB is created for each new process. When a process moves from one state to another, its PCB is moved with it. 4. How is each conceptual stage represented in the OS? Each conceptual stage is represented by a list of the PCBs in that stage. 5. What is a context switch? When a process is moved out of the CPU, the current contents of the registers including the program counter must be saved in the process's PCB. When a new process moves into the CPU, the contents of the registers from this process's PCB are restored. This process of saving and restoring registers is called a context switch. 6. Distinguish between preemptive scheduling and non-preemptive scheduling. With non-preemptive scheduling, once a process is in the running state it remains there until it voluntarily leaves. With preemptive scheduling, the OS can move a process from the running state to the waiting state or ready state. 7. Name and describe three CPU scheduling algorithms. First-come, first-served: The processes are moved into the running state in the order in which they arrive in the ready. Shortest job First: When the CPU is ready for another job, the process in the ready state that takes the shortest time is moved into the running state. The estimated length of time that a process needs the CPU may or may not be accurate. Round robin: Each process stays in the running state for a predetermined amount of time, called a time slice. When a process's time slice is over, it is moved back into the ready state, where it stays until it is its turn again for the CPU. 8. Use the following table of processes and service time for Exercises 69 through 71. Process P1 P2 P3 P4 P5

11 Service time c a b Draw a Gantt chart that shows the completion times for each process using first-come, first served CPU scheduling P1 P2 P3 P 4 P5 Draw a Gantt chart that shows the completion times for each process using shortest-job-next CPU scheduling P4 P2 P1 P3 P5 Draw a Gantt chart that shows the completion times for each process using round-robin CPU scheduling with a time slice of 60.

12

For The following Exercises, mark the answers True and False

For The following Exercises, mark the answers True and False 1 For The following Exercises, mark the answers True and False 1. An operating system is an example of application software. False 2. 3. 4. 6. 7. 9. 10. 12. 13. 14. 15. 16. 17. 18. An operating system

More information

ANSWERS OF SELECTED EXERCISES Memory Management Strategies

ANSWERS OF SELECTED EXERCISES Memory Management Strategies ANSWERS OF SELECTED EXERCISES Memory Management Strategies 8.1 Explain the difference between internal and external. The main deference is the allocation operation External : memory space is NOT allocated

More information

Addresses in the source program are generally symbolic. A compiler will typically bind these symbolic addresses to re-locatable addresses.

Addresses in the source program are generally symbolic. A compiler will typically bind these symbolic addresses to re-locatable addresses. 1 Memory Management Address Binding The normal procedures is to select one of the processes in the input queue and to load that process into memory. As the process executed, it accesses instructions and

More information

Operating Systems Comprehensive Exam. Spring Student ID # 3/16/2006

Operating Systems Comprehensive Exam. Spring Student ID # 3/16/2006 Operating Systems Comprehensive Exam Spring 2006 Student ID # 3/16/2006 You must complete all of part I (60%) You must complete two of the three sections in part II (20% each) In Part I, circle or select

More information

Operating Systems. Designed and Presented by Dr. Ayman Elshenawy Elsefy

Operating Systems. Designed and Presented by Dr. Ayman Elshenawy Elsefy Operating Systems Designed and Presented by Dr. Ayman Elshenawy Elsefy Dept. of Systems & Computer Eng.. AL-AZHAR University Website : eaymanelshenawy.wordpress.com Email : eaymanelshenawy@yahoo.com Reference

More information

Chapter 8 & Chapter 9 Main Memory & Virtual Memory

Chapter 8 & Chapter 9 Main Memory & Virtual Memory Chapter 8 & Chapter 9 Main Memory & Virtual Memory 1. Various ways of organizing memory hardware. 2. Memory-management techniques: 1. Paging 2. Segmentation. Introduction Memory consists of a large array

More information

Performance of Various Levels of Storage. Movement between levels of storage hierarchy can be explicit or implicit

Performance of Various Levels of Storage. Movement between levels of storage hierarchy can be explicit or implicit Memory Management All data in memory before and after processing All instructions in memory in order to execute Memory management determines what is to be in memory Memory management activities Keeping

More information

1. a. Show that the four necessary conditions for deadlock indeed hold in this example.

1. a. Show that the four necessary conditions for deadlock indeed hold in this example. Tutorial 7 (Deadlocks) 1. a. Show that the four necessary conditions for deadlock indeed hold in this example. b. State a simple rule for avoiding deadlocks in this system. a. The four necessary conditions

More information

stack Two-dimensional logical addresses Fixed Allocation Binary Page Table

stack Two-dimensional logical addresses Fixed Allocation Binary Page Table Question # 1 of 10 ( Start time: 07:24:13 AM ) Total Marks: 1 LRU page replacement algorithm can be implemented by counter stack linked list all of the given options Question # 2 of 10 ( Start time: 07:25:28

More information

Memory Management (1) Memory Management

Memory Management (1) Memory Management EECS 3221 Operating System Fundamentals No.8 Memory Management (1) Prof. Hui Jiang Dept of Electrical Engineering and Computer Science, York University Memory Management A program usually resides on a

More information

Memory Management (1) Memory Management. CPU vs. memory. No.8. Prof. Hui Jiang Dept of Electrical Engineering and Computer Science, York University

Memory Management (1) Memory Management. CPU vs. memory. No.8. Prof. Hui Jiang Dept of Electrical Engineering and Computer Science, York University EECS 3221 Operating System Fundamentals No.8 Memory Management (1) Prof. Hui Jiang Dept of Electrical Engineering and Computer Science, York University Memory Management A program usually resides on a

More information

Memory Management. Reading: Silberschatz chapter 9 Reading: Stallings. chapter 7 EEL 358

Memory Management. Reading: Silberschatz chapter 9 Reading: Stallings. chapter 7 EEL 358 Memory Management Reading: Silberschatz chapter 9 Reading: Stallings chapter 7 1 Outline Background Issues in Memory Management Logical Vs Physical address, MMU Dynamic Loading Memory Partitioning Placement

More information

Virtual Memory. CSCI 315 Operating Systems Design Department of Computer Science

Virtual Memory. CSCI 315 Operating Systems Design Department of Computer Science Virtual Memory CSCI 315 Operating Systems Design Department of Computer Science Notice: The slides for this lecture have been largely based on those from an earlier edition of the course text Operating

More information

B. V. Patel Institute of Business Management, Computer &Information Technology, UTU

B. V. Patel Institute of Business Management, Computer &Information Technology, UTU BCA-3 rd Semester 030010304-Fundamentals Of Operating Systems Unit: 1 Introduction Short Answer Questions : 1. State two ways of process communication. 2. State any two uses of operating system according

More information

Memory Management. Dr. Yingwu Zhu

Memory Management. Dr. Yingwu Zhu Memory Management Dr. Yingwu Zhu Big picture Main memory is a resource A process/thread is being executing, the instructions & data must be in memory Assumption: Main memory is infinite Allocation of memory

More information

Chapter 9 Memory Management Main Memory Operating system concepts. Sixth Edition. Silberschatz, Galvin, and Gagne 8.1

Chapter 9 Memory Management Main Memory Operating system concepts. Sixth Edition. Silberschatz, Galvin, and Gagne 8.1 Chapter 9 Memory Management Main Memory Operating system concepts. Sixth Edition. Silberschatz, Galvin, and Gagne 8.1 Chapter 9: Memory Management Background Swapping Contiguous Memory Allocation Segmentation

More information

Operating Systems Unit 6. Memory Management

Operating Systems Unit 6. Memory Management Unit 6 Memory Management Structure 6.1 Introduction Objectives 6.2 Logical versus Physical Address Space 6.3 Swapping 6.4 Contiguous Allocation Single partition Allocation Multiple Partition Allocation

More information

Memory Management. Dr. Yingwu Zhu

Memory Management. Dr. Yingwu Zhu Memory Management Dr. Yingwu Zhu Big picture Main memory is a resource A process/thread is being executing, the instructions & data must be in memory Assumption: Main memory is super big to hold a program

More information

CS399 New Beginnings. Jonathan Walpole

CS399 New Beginnings. Jonathan Walpole CS399 New Beginnings Jonathan Walpole Memory Management Memory Management Memory a linear array of bytes - Holds O.S. and programs (processes) - Each cell (byte) is named by a unique memory address Recall,

More information

Operating Systems Memory Management. Mathieu Delalandre University of Tours, Tours city, France

Operating Systems Memory Management. Mathieu Delalandre University of Tours, Tours city, France Operating Systems Memory Management Mathieu Delalandre University of Tours, Tours city, France mathieu.delalandre@univ-tours.fr 1 Operating Systems Memory Management 1. Introduction 2. Contiguous memory

More information

Main Memory CHAPTER. Exercises. 7.9 Explain the difference between internal and external fragmentation. Answer:

Main Memory CHAPTER. Exercises. 7.9 Explain the difference between internal and external fragmentation. Answer: 7 CHAPTER Main Memory Exercises 7.9 Explain the difference between internal and external fragmentation. a. Internal fragmentation is the area in a region or a page that is not used by the job occupying

More information

Chapter 8: Memory Management. Operating System Concepts with Java 8 th Edition

Chapter 8: Memory Management. Operating System Concepts with Java 8 th Edition Chapter 8: Memory Management 8.1 Silberschatz, Galvin and Gagne 2009 Background Program must be brought (from disk) into memory and placed within a process for it to be run Main memory and registers are

More information

Chapter 9: Virtual Memory

Chapter 9: Virtual Memory Chapter 9: Virtual Memory Multiprogramming Memory Management so far 1. Dynamic Loading The main Program gets loaded into memory Routines are stored in Relocatable Load format on disk As main program (or

More information

Operating Systems. Instructor: Dmitri A. Gusev. Spring Lecture 16, April 17, CSC : Introduction to Computer Science

Operating Systems. Instructor: Dmitri A. Gusev. Spring Lecture 16, April 17, CSC : Introduction to Computer Science Operating Systems Instructor: Dmitri A. Gusev Spring 2007 CSC 120.02: Introduction to Computer Science Lecture 16, April 17, 2007 Functions of an Operating System The operating system (OS) is the core

More information

Operating Systems Comprehensive Exam. Spring Student ID # 3/20/2013

Operating Systems Comprehensive Exam. Spring Student ID # 3/20/2013 Operating Systems Comprehensive Exam Spring 2013 Student ID # 3/20/2013 You must complete all of Section I You must complete two of the problems in Section II If you need more space to answer a question,

More information

Operating Systems Comprehensive Exam. Spring Student ID # 2/17/2011

Operating Systems Comprehensive Exam. Spring Student ID # 2/17/2011 Operating Systems Comprehensive Exam Spring 2011 Student ID # 2/17/2011 You must complete all of Section I You must complete two of the problems in Section II If you need more space to answer a question,

More information

Preview. Memory Management

Preview. Memory Management Preview Memory Management With Mono-Process With Multi-Processes Multi-process with Fixed Partitions Modeling Multiprogramming Swapping Memory Management with Bitmaps Memory Management with Free-List Virtual

More information

Memory management. Requirements. Relocation: program loading. Terms. Relocation. Protection. Sharing. Logical organization. Physical organization

Memory management. Requirements. Relocation: program loading. Terms. Relocation. Protection. Sharing. Logical organization. Physical organization Requirements Relocation Memory management ability to change process image position Protection ability to avoid unwanted memory accesses Sharing ability to share memory portions among processes Logical

More information

12: Memory Management

12: Memory Management 12: Memory Management Mark Handley Address Binding Program goes through multiple steps from compilation to execution. At some stage, addresses in the program must be bound to physical memory addresses:

More information

6 - Main Memory EECE 315 (101) ECE UBC 2013 W2

6 - Main Memory EECE 315 (101) ECE UBC 2013 W2 6 - Main Memory EECE 315 (101) ECE UBC 2013 W2 Acknowledgement: This set of slides is partly based on the PPTs provided by the Wiley s companion website (including textbook images, when not explicitly

More information

(b) External fragmentation can happen in a virtual memory paging system.

(b) External fragmentation can happen in a virtual memory paging system. Alexandria University Faculty of Engineering Electrical Engineering - Communications Spring 2015 Final Exam CS333: Operating Systems Wednesday, June 17, 2015 Allowed Time: 3 Hours Maximum: 75 points Note:

More information

COSC Operating Systems Design, Fall 2001, Byunggu Yu. Chapter 9 Memory Management (Lecture Note #8) 1. Background

COSC Operating Systems Design, Fall 2001, Byunggu Yu. Chapter 9 Memory Management (Lecture Note #8) 1. Background COSC4740 01 Operating Systems Design, Fall 2001, Byunggu Yu Chapter 9 Memory Management (Lecture Note #8) 1. Background The computer programs, together with the data they access, must be in main memory

More information

Introduction to Virtual Memory Management

Introduction to Virtual Memory Management Introduction to Virtual Memory Management Minsoo Ryu Department of Computer Science and Engineering Virtual Memory Management Page X Demand Paging Page X Q & A Page X Memory Allocation Three ways of memory

More information

Course: Operating Systems Instructor: M Umair. M Umair

Course: Operating Systems Instructor: M Umair. M Umair Course: Operating Systems Instructor: M Umair Memory Management Introduction { Ref: Operating System Concepts 8th Edition Abraham Silberschatz, Greg Gagne, Peter B. Galvin } Address Binding Addresses in

More information

Memory Management Cache Base and Limit Registers base limit Binding of Instructions and Data to Memory Compile time absolute code Load time

Memory Management Cache Base and Limit Registers base limit Binding of Instructions and Data to Memory Compile time absolute code Load time Memory Management To provide a detailed description of various ways of organizing memory hardware To discuss various memory-management techniques, including paging and segmentation To provide a detailed

More information

9.1 Background. In Chapter 6, we showed how the CPU can be shared by a set of processes. As a result of

9.1 Background. In Chapter 6, we showed how the CPU can be shared by a set of processes. As a result of Chapter 9 MEMORY MANAGEMENT In Chapter 6, we showed how the CPU can be shared by a set of processes. As a result of CPU scheduling, we can improve both the utilization of the CPU and the speed of the computer's

More information

CS307: Operating Systems

CS307: Operating Systems CS307: Operating Systems Chentao Wu 吴晨涛 Associate Professor Dept. of Computer Science and Engineering Shanghai Jiao Tong University SEIEE Building 3-513 wuct@cs.sjtu.edu.cn Download Lectures ftp://public.sjtu.edu.cn

More information

Week 2: Tiina Niklander

Week 2: Tiina Niklander Virtual memory Operations and policies Chapters 3.4. 3.6 Week 2: 17.9.2009 Tiina Niklander 1 Policies and methods Fetch policy (Noutopolitiikka) When to load page to memory? Placement policy (Sijoituspolitiikka

More information

Memory Management. Chapter 4 Memory Management. Multiprogramming with Fixed Partitions. Ideally programmers want memory that is.

Memory Management. Chapter 4 Memory Management. Multiprogramming with Fixed Partitions. Ideally programmers want memory that is. Chapter 4 Memory Management Ideally programmers want memory that is Memory Management large fast non volatile 4.1 Basic memory management 4.2 Swapping 4.3 Virtual memory 4.4 Page replacement algorithms

More information

Chapter 7: Main Memory. Operating System Concepts Essentials 8 th Edition

Chapter 7: Main Memory. Operating System Concepts Essentials 8 th Edition Chapter 7: Main Memory Operating System Concepts Essentials 8 th Edition Silberschatz, Galvin and Gagne 2011 Chapter 7: Memory Management Background Swapping Contiguous Memory Allocation Paging Structure

More information

Operating Systems Comprehensive Exam. Fall Student ID # 10/31/2013

Operating Systems Comprehensive Exam. Fall Student ID # 10/31/2013 Operating Systems Comprehensive Exam Fall 2013 Student ID # 10/31/2013 You must complete all of Section I You must complete two of the problems in Section II If you need more space to answer a question,

More information

Outlook. Background Swapping Contiguous Memory Allocation Paging Structure of the Page Table Segmentation Example: The Intel Pentium

Outlook. Background Swapping Contiguous Memory Allocation Paging Structure of the Page Table Segmentation Example: The Intel Pentium Main Memory Outlook Background Swapping Contiguous Memory Allocation Paging Structure of the Page Table Segmentation Example: The Intel Pentium 2 Backgound Background So far we considered how to share

More information

Operating Systems, Fall

Operating Systems, Fall Policies and methods Virtual memory Operations and policies Chapters 3.4. 3.6 Week 2: 17.9.2009 Tiina Niklander 1 Fetch policy (Noutopolitiikka) When to load page to memory? Placement policy (Sijoituspolitiikka

More information

390 Chapter 8 Main Memory

390 Chapter 8 Main Memory 390 Chapter 8 Main Memory information (pages or segments) that can be shared. Sharing is a means of running many processes with a limited amount of memory, but shared programs and data must be designed

More information

Basic Memory Management. Basic Memory Management. Address Binding. Running a user program. Operating Systems 10/14/2018 CSC 256/456 1

Basic Memory Management. Basic Memory Management. Address Binding. Running a user program. Operating Systems 10/14/2018 CSC 256/456 1 Basic Memory Management Program must be brought into memory and placed within a process for it to be run Basic Memory Management CS 256/456 Dept. of Computer Science, University of Rochester Mono-programming

More information

VIRTUAL MEMORY. Maninder Kaur. 1

VIRTUAL MEMORY. Maninder Kaur. 1 VIRTUAL MEMORY Maninder Kaur professormaninder@gmail.com 1 www.eazynotes.com What is Virtual Memory? The term virtual memory refers to something which appears to be present but actually it is not. The

More information

OPERATING SYSTEMS. After A.S.Tanenbaum, Modern Operating Systems 3rd edition Uses content with permission from Assoc. Prof. Florin Fortis, PhD

OPERATING SYSTEMS. After A.S.Tanenbaum, Modern Operating Systems 3rd edition Uses content with permission from Assoc. Prof. Florin Fortis, PhD OPERATING SYSTEMS #8 After A.S.Tanenbaum, Modern Operating Systems 3rd edition Uses content with permission from Assoc. Prof. Florin Fortis, PhD MEMORY MANAGEMENT MEMORY MANAGEMENT The memory is one of

More information

Operating Systems. Memory Management. Lecture 9 Michael O Boyle

Operating Systems. Memory Management. Lecture 9 Michael O Boyle Operating Systems Memory Management Lecture 9 Michael O Boyle 1 Memory Management Background Logical/Virtual Address Space vs Physical Address Space Swapping Contiguous Memory Allocation Segmentation Goals

More information

a process may be swapped in and out of main memory such that it occupies different regions

a process may be swapped in and out of main memory such that it occupies different regions Virtual Memory Characteristics of Paging and Segmentation A process may be broken up into pieces (pages or segments) that do not need to be located contiguously in main memory Memory references are dynamically

More information

Operating Systems Lecture 6: Memory Management II

Operating Systems Lecture 6: Memory Management II CSCI-GA.2250-001 Operating Systems Lecture 6: Memory Management II Hubertus Franke frankeh@cims.nyu.edu What is the problem? Not enough memory Have enough memory is not possible with current technology

More information

CPU Scheduling CHAPTER. Exercises

CPU Scheduling CHAPTER. Exercises 5 CHAPTER CPU Scheduling CPU scheduling is the basis of multiprogrammed operating systems. By switching the CPU among processes, the operating system can make the computer more productive. In this chapter,

More information

Chapter 8: Memory- Management Strategies. Operating System Concepts 9 th Edition

Chapter 8: Memory- Management Strategies. Operating System Concepts 9 th Edition Chapter 8: Memory- Management Strategies Operating System Concepts 9 th Edition Silberschatz, Galvin and Gagne 2013 Chapter 8: Memory Management Strategies Background Swapping Contiguous Memory Allocation

More information

Main Memory. Electrical and Computer Engineering Stephen Kim ECE/IUPUI RTOS & APPS 1

Main Memory. Electrical and Computer Engineering Stephen Kim ECE/IUPUI RTOS & APPS 1 Main Memory Electrical and Computer Engineering Stephen Kim (dskim@iupui.edu) ECE/IUPUI RTOS & APPS 1 Main Memory Background Swapping Contiguous allocation Paging Segmentation Segmentation with paging

More information

CS307 Operating Systems Main Memory

CS307 Operating Systems Main Memory CS307 Main Memory Fan Wu Department of Computer Science and Engineering Shanghai Jiao Tong University Spring 2018 Background Program must be brought (from disk) into memory and placed within a process

More information

Chapter 9: Memory Management. Background

Chapter 9: Memory Management. Background 1 Chapter 9: Memory Management Background Swapping Contiguous Allocation Paging Segmentation Segmentation with Paging 9.1 Background Program must be brought into memory and placed within a process for

More information

The Memory Management Unit. Operating Systems. Autumn CS4023

The Memory Management Unit. Operating Systems. Autumn CS4023 Operating Systems Autumn 2017-2018 Outline The Memory Management Unit 1 The Memory Management Unit Logical vs. Physical Address Space The concept of a logical address space that is bound to a separate

More information

Goals of Memory Management

Goals of Memory Management Memory Management Goals of Memory Management Allocate available memory efficiently to multiple processes Main functions Allocate memory to processes when needed Keep track of what memory is used and what

More information

CS 322 Operating Systems Practice Midterm Questions

CS 322 Operating Systems Practice Midterm Questions ! CS 322 Operating Systems 1. Processes go through the following states in their lifetime. time slice ends Consider the following events and answer the questions that follow. Assume there are 5 processes,

More information

Chapters 9 & 10: Memory Management and Virtual Memory

Chapters 9 & 10: Memory Management and Virtual Memory Chapters 9 & 10: Memory Management and Virtual Memory Important concepts (for final, projects, papers) addressing: physical/absolute, logical/relative/virtual overlays swapping and paging memory protection

More information

UNIT III MEMORY MANAGEMENT

UNIT III MEMORY MANAGEMENT UNIT III MEMORY MANAGEMENT TOPICS TO BE COVERED 3.1 Memory management 3.2 Contiguous allocation i Partitioned memory allocation ii Fixed & variable partitioning iii Swapping iv Relocation v Protection

More information

Memory Management. Frédéric Haziza Spring Department of Computer Systems Uppsala University

Memory Management. Frédéric Haziza Spring Department of Computer Systems Uppsala University Memory Management Frédéric Haziza Department of Computer Systems Uppsala University Spring 2008 Operating Systems Process Management Memory Management Storage Management Compilers Compiling

More information

Operating System 1 (ECS-501)

Operating System 1 (ECS-501) Operating System 1 (ECS-501) Unit- IV Memory Management 1.1 Bare Machine: 1.1.1 Introduction: It has the ability to recover the operating system of a machine to the identical state it was at a given point

More information

The Virtual Memory Abstraction. Memory Management. Address spaces: Physical and Virtual. Address Translation

The Virtual Memory Abstraction. Memory Management. Address spaces: Physical and Virtual. Address Translation The Virtual Memory Abstraction Memory Management Physical Memory Unprotected address space Limited size Shared physical frames Easy to share data Virtual Memory Programs are isolated Arbitrary size All

More information

UNIT I OVERVIEW OF OPERATING SYSTEMS

UNIT I OVERVIEW OF OPERATING SYSTEMS UNIT I OVERVIEW OF OPERATING SYSTEMS Introduction - overview of operating system concepts - Process management and Scheduling, Memory management: partitioning, paging, segmentation, virtual memory, Device

More information

Techno India Batanagar Department of Computer Science & Engineering. Model Questions. Multiple Choice Questions:

Techno India Batanagar Department of Computer Science & Engineering. Model Questions. Multiple Choice Questions: Techno India Batanagar Department of Computer Science & Engineering Model Questions Subject Name: Operating System Multiple Choice Questions: Subject Code: CS603 1) Shell is the exclusive feature of a)

More information

Basic Memory Management

Basic Memory Management Basic Memory Management CS 256/456 Dept. of Computer Science, University of Rochester 10/15/14 CSC 2/456 1 Basic Memory Management Program must be brought into memory and placed within a process for it

More information

Chapter 8 Memory Management

Chapter 8 Memory Management 1 Chapter 8 Memory Management The technique we will describe are: 1. Single continuous memory management 2. Partitioned memory management 3. Relocatable partitioned memory management 4. Paged memory management

More information

Main Memory (Part I)

Main Memory (Part I) Main Memory (Part I) Amir H. Payberah amir@sics.se Amirkabir University of Technology (Tehran Polytechnic) Amir H. Payberah (Tehran Polytechnic) Main Memory 1393/8/5 1 / 47 Motivation and Background Amir

More information

Address spaces and memory management

Address spaces and memory management Address spaces and memory management Review of processes Process = one or more threads in an address space Thread = stream of executing instructions Address space = memory space used by threads Address

More information

Memory management. Last modified: Adaptation of Silberschatz, Galvin, Gagne slides for the textbook Applied Operating Systems Concepts

Memory management. Last modified: Adaptation of Silberschatz, Galvin, Gagne slides for the textbook Applied Operating Systems Concepts Memory management Last modified: 26.04.2016 1 Contents Background Logical and physical address spaces; address binding Overlaying, swapping Contiguous Memory Allocation Segmentation Paging Structure of

More information

Chapter 8: Main Memory

Chapter 8: Main Memory Chapter 8: Main Memory Chapter 8: Memory Management Background Swapping Contiguous Memory Allocation Segmentation Paging Structure of the Page Table Example: The Intel 32 and 64-bit Architectures Example:

More information

Practice Exercises 449

Practice Exercises 449 Practice Exercises 449 Kernel processes typically require memory to be allocated using pages that are physically contiguous. The buddy system allocates memory to kernel processes in units sized according

More information

Computer Systems II. Memory Management" Subdividing memory to accommodate many processes. A program is loaded in main memory to be executed

Computer Systems II. Memory Management Subdividing memory to accommodate many processes. A program is loaded in main memory to be executed Computer Systems II Memory Management" Memory Management" Subdividing memory to accommodate many processes A program is loaded in main memory to be executed Memory needs to be allocated efficiently to

More information

CS450/550 Operating Systems

CS450/550 Operating Systems CS450/550 Operating Systems Lecture 4 memory Palden Lama Department of Computer Science CS450/550 Memory.1 Review: Summary of Chapter 3 Deadlocks and its modeling Deadlock detection Deadlock recovery Deadlock

More information

4.1 Paging suffers from and Segmentation suffers from. Ans

4.1 Paging suffers from and Segmentation suffers from. Ans Worked out Examples 4.1 Paging suffers from and Segmentation suffers from. Ans: Internal Fragmentation, External Fragmentation 4.2 Which of the following is/are fastest memory allocation policy? a. First

More information

Chapter 8: Main Memory

Chapter 8: Main Memory Chapter 8: Main Memory Operating System Concepts 8 th Edition,! Silberschatz, Galvin and Gagne 2009! Chapter 8: Memory Management Background" Swapping " Contiguous Memory Allocation" Paging" Structure

More information

Chapter 8: Memory-Management Strategies

Chapter 8: Memory-Management Strategies Chapter 8: Memory-Management Strategies Chapter 8: Memory Management Strategies Background Swapping Contiguous Memory Allocation Segmentation Paging Structure of the Page Table Example: The Intel 32 and

More information

Memory Management. CSCI 315 Operating Systems Design Department of Computer Science

Memory Management. CSCI 315 Operating Systems Design Department of Computer Science Memory Management CSCI 315 Operating Systems Design Department of Computer Science Notice: The slides for this lecture are based on those from Operating Systems Concepts, 9th ed., by Silberschatz, Galvin,

More information

Chapter 8: Main Memory

Chapter 8: Main Memory Chapter 8: Main Memory Chapter 8: Memory Management Background Swapping Contiguous Memory Allocation Paging Structure of the Page Table Segmentation Example: The Intel Pentium 8.2 Silberschatz, Galvin

More information

ALL the assignments (A1, A2, A3) and Projects (P0, P1, P2) we have done so far.

ALL the assignments (A1, A2, A3) and Projects (P0, P1, P2) we have done so far. Midterm Exam Reviews ALL the assignments (A1, A2, A3) and Projects (P0, P1, P2) we have done so far. Particular attentions on the following: System call, system kernel Thread/process, thread vs process

More information

CS370: Operating Systems [Spring 2017] Dept. Of Computer Science, Colorado State University

CS370: Operating Systems [Spring 2017] Dept. Of Computer Science, Colorado State University Frequently asked questions from the previous class survey CS 370: OPERATING SYSTEMS [MEMORY MANAGEMENT] Matrices in Banker s algorithm Max, need, allocated Shrideep Pallickara Computer Science Colorado

More information

CS6401- Operating System UNIT-III STORAGE MANAGEMENT

CS6401- Operating System UNIT-III STORAGE MANAGEMENT UNIT-III STORAGE MANAGEMENT Memory Management: Background In general, to rum a program, it must be brought into memory. Input queue collection of processes on the disk that are waiting to be brought into

More information

Chapter 8: Memory- Management Strategies. Operating System Concepts 9 th Edition

Chapter 8: Memory- Management Strategies. Operating System Concepts 9 th Edition Chapter 8: Memory- Management Strategies Operating System Concepts 9 th Edition Silberschatz, Galvin and Gagne 2013 Chapter 8: Memory Management Strategies Background Swapping Contiguous Memory Allocation

More information

Chapter 8: Memory- Management Strategies

Chapter 8: Memory- Management Strategies Chapter 8: Memory Management Strategies Chapter 8: Memory- Management Strategies Background Swapping Contiguous Memory Allocation Segmentation Paging Structure of the Page Table Example: The Intel 32 and

More information

Chapter 4 Memory Management

Chapter 4 Memory Management Chapter 4 Memory Management 4.1 Basic memory management 4.2 Swapping 4.3 Virtual memory 4.4 Page replacement algorithms 4.5 Modeling page replacement algorithms 4.6 Design issues for paging systems 4.7

More information

Chapter 3: Important Concepts (3/29/2015)

Chapter 3: Important Concepts (3/29/2015) CISC 3595 Operating System Spring, 2015 Chapter 3: Important Concepts (3/29/2015) 1 Memory from programmer s perspective: you already know these: Code (functions) and data are loaded into memory when the

More information

Part Three - Memory Management. Chapter 8: Memory-Management Strategies

Part Three - Memory Management. Chapter 8: Memory-Management Strategies Part Three - Memory Management Chapter 8: Memory-Management Strategies Chapter 8: Memory-Management Strategies 8.1 Background 8.2 Swapping 8.3 Contiguous Memory Allocation 8.4 Segmentation 8.5 Paging 8.6

More information

CHAPTER 8 - MEMORY MANAGEMENT STRATEGIES

CHAPTER 8 - MEMORY MANAGEMENT STRATEGIES CHAPTER 8 - MEMORY MANAGEMENT STRATEGIES OBJECTIVES Detailed description of various ways of organizing memory hardware Various memory-management techniques, including paging and segmentation To provide

More information

Operating Systems. 09. Memory Management Part 1. Paul Krzyzanowski. Rutgers University. Spring 2015

Operating Systems. 09. Memory Management Part 1. Paul Krzyzanowski. Rutgers University. Spring 2015 Operating Systems 09. Memory Management Part 1 Paul Krzyzanowski Rutgers University Spring 2015 March 9, 2015 2014-2015 Paul Krzyzanowski 1 CPU Access to Memory The CPU reads instructions and reads/write

More information

Chapter 8: Memory Management Strategies

Chapter 8: Memory Management Strategies Chapter 8: Memory- Management Strategies, Silberschatz, Galvin and Gagne 2009 Chapter 8: Memory Management Strategies Background Swapping Contiguous Memory Allocation Paging Structure of the Page Table

More information

Unit 3 : Process Management

Unit 3 : Process Management Unit : Process Management Processes are the most widely used units of computation in programming and systems, although object and threads are becoming more prominent in contemporary systems. Process management

More information

Course Outline. Processes CPU Scheduling Synchronization & Deadlock Memory Management File Systems & I/O Distributed Systems

Course Outline. Processes CPU Scheduling Synchronization & Deadlock Memory Management File Systems & I/O Distributed Systems Course Outline Processes CPU Scheduling Synchronization & Deadlock Memory Management File Systems & I/O Distributed Systems 1 Today: Memory Management Terminology Uniprogramming Multiprogramming Contiguous

More information

Chapter 8: Main Memory. Operating System Concepts 9 th Edition

Chapter 8: Main Memory. Operating System Concepts 9 th Edition Chapter 8: Main Memory Silberschatz, Galvin and Gagne 2013 Chapter 8: Memory Management Background Swapping Contiguous Memory Allocation Segmentation Paging Structure of the Page Table Example: The Intel

More information

MC7204 OPERATING SYSTEMS

MC7204 OPERATING SYSTEMS MC7204 OPERATING SYSTEMS QUESTION BANK UNIT I INTRODUCTION 9 Introduction Types of operating systems operating systems structures Systems components operating systems services System calls Systems programs

More information

CS 537: Introduction to Operating Systems Fall 2015: Midterm Exam #1

CS 537: Introduction to Operating Systems Fall 2015: Midterm Exam #1 CS 537: Introduction to Operating Systems Fall 2015: Midterm Exam #1 This exam is closed book, closed notes. All cell phones must be turned off. No calculators may be used. You have two hours to complete

More information

Operating systems. Part 1. Module 11 Main memory introduction. Tami Sorgente 1

Operating systems. Part 1. Module 11 Main memory introduction. Tami Sorgente 1 Operating systems Module 11 Main memory introduction Part 1 Tami Sorgente 1 MODULE 11 MAIN MEMORY INTRODUCTION Background Swapping Contiguous Memory Allocation Noncontiguous Memory Allocation o Segmentation

More information

With regard to operating systems the kernel consists of the most frequently used functions in the operating system and it kept in main memory.

With regard to operating systems the kernel consists of the most frequently used functions in the operating system and it kept in main memory. CS 320 Ch 8 Operating Systems An operating system controls execution of applications and acts as an interface between the user and the computer. A typical OS provides the following services: Program Creation

More information

Processes and Tasks What comprises the state of a running program (a process or task)?

Processes and Tasks What comprises the state of a running program (a process or task)? Processes and Tasks What comprises the state of a running program (a process or task)? Microprocessor Address bus Control DRAM OS code and data special caches code/data cache EAXEBP EIP DS EBXESP EFlags

More information

CSE 421/521 - Operating Systems Fall Lecture - XII Main Memory Management. Tevfik Koşar. University at Buffalo. October 18 th, 2012.

CSE 421/521 - Operating Systems Fall Lecture - XII Main Memory Management. Tevfik Koşar. University at Buffalo. October 18 th, 2012. CSE 421/521 - Operating Systems Fall 2012 Lecture - XII Main Memory Management Tevfik Koşar University at Buffalo October 18 th, 2012 1 Roadmap Main Memory Management Fixed and Dynamic Memory Allocation

More information

Chapter 8: Main Memory

Chapter 8: Main Memory Chapter 8: Main Memory Silberschatz, Galvin and Gagne 2013 Chapter 8: Memory Management Background Swapping Contiguous Memory Allocation Segmentation Paging Structure of the Page Table Example: The Intel

More information