6 Memory Management and Processor Management Management of Resources Measure of Effectiveness – On most modern computers, the operating system serves.

Slides:



Advertisements
Similar presentations
Part IV: Memory Management
Advertisements

Memory Management Chapter 7.
Chapter 10 Operating Systems.
Memory Management Chapter 7. Memory Management Subdividing memory to accommodate multiple processes Memory needs to be allocated efficiently to pack as.
Chapter 7 Memory Management Operating Systems: Internals and Design Principles, 6/E William Stallings Dave Bremer Otago Polytechnic, N.Z. ©2009, Prentice.
Chapter 101 Virtual Memory Chapter 10 Sections and plus (Skip:10.3.2, 10.7, rest of 10.8)
1 Memory Management Chapter 7. 2 Memory Management Subdividing memory to accommodate multiple processes Memory needs to be allocated to ensure a reasonable.
Memory Management 1 CS502 Spring 2006 Memory Management CS-502 Spring 2006.
1 Chapter 8 Virtual Memory Virtual memory is a storage allocation scheme in which secondary memory can be addressed as though it were part of main memory.
CS-3013 & CS-502, Summer 2006 Memory Management1 CS-3013 & CS-502 Summer 2006.
Memory Management Chapter 5.
Computer Organization and Architecture
Virtual Memory I Chapter 8.
03/05/2008CSCI 315 Operating Systems Design1 Memory Management Notice: The slides for this lecture have been largely based on those accompanying the textbook.
1 Lecture 8: Memory Mangement Operating System I Spring 2008.
Chapter 91 Memory Management Chapter 9   Review of process from source to executable (linking, loading, addressing)   General discussion of memory.
Memory Management ◦ Operating Systems ◦ CS550. Paging and Segmentation  Non-contiguous memory allocation  Fragmentation is a serious problem with contiguous.
Chapter 3 Memory Management: Virtual Memory
Tutorial 7 Memory Management presented by: Antonio Maiorano Paul Di Marco.
Computer Architecture and Operating Systems CS 3230: Operating System Section Lecture OS-7 Memory Management (1) Department of Computer Science and Software.
Most modern operating systems incorporate these five components.
Chapter 5 Operating System Support. Outline Operating system - Objective and function - types of OS Scheduling - Long term scheduling - Medium term scheduling.
CGS 3763 Operating Systems Concepts Spring 2013 Dan C. Marinescu Office: HEC 304 Office hours: M-Wd 11: :30 AM.
Chapter 10 Operating Systems.
CIS250 OPERATING SYSTEMS Memory Management Since we share memory, we need to manage it Memory manager only sees the address A program counter value indicates.
Memory Management. Roadmap Basic requirements of Memory Management Memory Partitioning Basic blocks of memory management –Paging –Segmentation.
Chapter 7 Operating Systems. Define the purpose and functions of an operating system. Understand the components of an operating system. Understand the.
Computers Operating System Essentials. Operating Systems PROGRAM HARDWARE OPERATING SYSTEM.
1 Virtual Memory Chapter 8. 2 Hardware and Control Structures Memory references are dynamically translated into physical addresses at run time –A process.
Chapter 4 Memory Management Virtual Memory.
1 Memory Management Chapter 7. 2 Memory Management Subdividing memory to accommodate multiple processes Memory needs to be allocated to ensure a reasonable.
Computer Systems Week 14: Memory Management Amanda Oddie.
1 Memory Management Chapter 7. 2 Memory Management Subdividing memory to accommodate multiple processes Memory needs to be allocated to ensure a reasonable.
Main Memory. Chapter 8: Memory Management Background Swapping Contiguous Memory Allocation Paging Structure of the Page Table Segmentation Example: The.
Virtual Memory The memory space of a process is normally divided into blocks that are either pages or segments. Virtual memory management takes.
Informationsteknologi Wednesday, October 3, 2007Computer Systems/Operating Systems - Class 121 Today’s class Memory management Virtual memory.
CS6502 Operating Systems - Dr. J. Garrido Memory Management – Part 1 Class Will Start Momentarily… Lecture 8b CS6502 Operating Systems Dr. Jose M. Garrido.
Memory Management OS Fazal Rehman Shamil. swapping Swapping concept comes in terms of process scheduling. Swapping is basically implemented by Medium.
Lectures 8 & 9 Virtual Memory - Paging & Segmentation System Design.
Background Program must be brought into memory and placed within a process for it to be run. Input queue – collection of processes on the disk that are.
COMP091 – Operating Systems 1 Memory Management. Memory Management Terms Physical address –Actual address as seen by memory unit Logical address –Address.
1 Memory Management n In most schemes, the kernel occupies some fixed portion of main memory and the rest is shared by multiple processes.
2010INT Operating Systems, School of Information Technology, Griffith University – Gold Coast Copyright © William Stallings /2 Memory Management.
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.
Chapter 8: Memory Management. 8.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 8: Memory Management Background Swapping Contiguous.
Chapter 7 Memory Management
Memory Management Chapter 7.
SLC/VER1.0/OS CONCEPTS/OCT'99
Memory Management.
ITEC 202 Operating Systems
Chapter 2 Memory and process management
Chapter 8: Main Memory.
Chapter 9: Virtual Memory
Chapter 9 – Real Memory Organization and Management
CSI 400/500 Operating Systems Spring 2009
Main Memory Management
Chapter 9: Virtual-Memory Management
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy Chapter 8 11/24/2018.
Background Program must be brought into memory and placed within a process for it to be run. Input queue – collection of processes on the disk that are.
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy Chapter 9 12/1/2018.
Main Memory Background Swapping Contiguous Allocation Paging
Lecture 32 Syed Mansoor Sarwar
Outline Module 1 and 2 dealt with processes, scheduling and synchronization Next two modules will deal with memory and storage Processes require data to.
Lecture 3: Main Memory.
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy Chapter 9 4/5/2019.
COMP755 Advanced Operating Systems
CSE 542: Operating Systems
Presentation transcript:

6 Memory Management and Processor Management

Management of Resources Measure of Effectiveness – On most modern computers, the operating system serves as the primary resource manager allocating and managing: Processor Time Memory Space Peripheral Devices Secondary Storage Space Data Program Libraries

Management of Resources Measure of Effectiveness – A well-designed operating system attempts to optimize the utilization pf all the system resources. – Resource management is a key operating system function. – The operating system’s job is to manage the computer system’s resources as efficiently as possible.

Processor Management – Concerned with managing the processor’s time.

Memory Management – Concerned with managing the computer’s available pool of memory: Allocating space to application routines and making sure that they do not interfere with each other.

Operating System Management Routines Resident – A routine that stays in memory because it directly supports application programs as they run. Transient – A routine that is loaded as needed. Transient area – Memory for application programs and transient routines.

Fig. 6.2: The operating system (Resident & Transient Routines) occupies low memory. The remaining memory is the transient area.

Memory Management Partitions and Regions

Overlay Structures Developed when the amount of available memory was limited. Divide the program into logically independent modules. – Module 1 holds the main control logic and key data common to the entire program. – Module 2 processes valid input data. – Module 3 processes errors. – Module 4 generates end-of-program statistics.

Fig. 6.9a: Overlay structures. The complete program consists of four modules.

Fig. 6.9b: Normally, only modules 1 and 2 are in memory.

Fig. 6.9c: When an error occurs, module 3 overlays module 2.

Fig. 6.9d: At end-of-job, only modules 1 and 4 are needed.

Memory Management Concurrency A program cannot process data it does not have. A program spends more time waiting for I/O than processing data.

Memory Management Concurrency Resolution – – Put a additional programs into memory. – Where ? – How ?

Fig. 6.3: Multiple programs are loaded and executed concurrently. Where????? How?????

Memory Management Partitions and Regions Fixed-Partition Memory Management Regions – Dynamic Memory Management.

Memory Management Partitions Fixed-Partition Memory Management – Divides the available space into fixed-length partitions – Each partition can execute a program – Partition size is set when the operating system is generated.

Fig. 6.4: Fixed- partition memory management divides the available space into fixed-length partitions.

Memory Management Partitions Fragmentation occurs because – With Fixed-Partition Memory Management It is assumed that a given program must be loaded into contiguous memory. Not all the space assigned to a partition may be used

Memory Management Regions Regions - Dynamic Memory Management – The transient area is treated as a pool of free space – When a program needs to be executed A region of memory just sufficient to hold the program is allocated from the transient pool The program is loaded into this region

Fig. 6.5:Under dynamic memory management, a region of memory just sufficient to hold the program is allocated when the program is loaded.

Memory Management Regions Fragmentation occurs because – With Dynamic Memory Management It is assumed that a given program must be loaded into contiguous memory. With dynamic allocation, bits of unused space is spread throughout memory.

Memory Management Regions Regions - Dynamic Memory Management – Utilizes: Segmentation Paging

Memory Management Regions Segmentation: – Programs are divided into independently addressed segments and stored in non- contiguous memory.

Memory Management Segmentation When a program is loaded into memory: – the operating system builds a segment table for the program listing the absolute entry point address of each of the program’s segments. – As the program executes, addresses must be translated from relative to absolute form. Base + Displacement Segment + Displacement

Fig. 6.6: With segmentation, programs are divided into independently addressed segments and stored in noncontiguous memory.

Fig. 6.7: Dynamically translating a segment address to an absolute address.

Memory Management Paging A program is broken into fixed-length pages (2k – 4K) The pages are loaded into noncontiguous memory. As the pages are loaded into memory, a page table is created. Page Addresses: – Page Number – Page Displacement

Fig. 6.7: Dynamically translating a page address to an absolute address.

Memory Management Segmentation and Paging Addresses are divided into: – A segment number – A page number within that segment – A displacement within that page After the ICU expands the relative address: – The program’s segment table is searched for the segment number which yields the address of the segment’s page table – The page table is searched for the page’s base address which is added to the displacement to get an absolute address.

Fig. 6.8: Segmentation and paging.

Virtual Memory

Memory Management Virtual Memory Three Levels of Storage – Real Memory Main memory, directly addressable by the processor External Paging Device – Disk – Virtual Memory Acts just like real memory, but isn’t real memory.

Fig. 6.10: Virtual memory.

Memory Management Virtual Memory Divides main storage into 2K sections called page frames. Divides all programs into 2K sections called pages. When the operating system loads a program for execution, it first divides the program into pages and stores the pages on a disk file called the PAGE DATA SET. The operating system then loads the pages of the program that are initially active into main (real) storage. When a part of the program which is not in real storage is needed, a PAGE FAULT occurs. The operating system loads the page containing that code into real storage.

Memory Management Virtual Memory When real storage is completely filled with active pages and another page is needed in real storage: The operating system selects a page that has been in real storage the longest without being referenced; Writes it back on the Page Data Set (page-out) if the contents of the page have been changed since it was first brought into real storage; Brings in the new page into real storage (page-in).

Memory Management Virtual Memory Virtual address dynamically translated Thrashing – excessive paging – Seriously degrades system performance

Multiprogramming Interrupt – An electronic signal – A program surrenders control of the processor when it requests an I/O operation and is eligible to continue when the I/O operation is completed.

Multiprogramming Interrupts can originate with: – Software A program issues an interrupt to request the operating system’s support Hardware for an I/O operation – Hardware Hardware issues an interrupt to notify the processor that an asynchronous event has occurred. – Illegal operations

Multiprogramming Control Block – Created to hold a partition’s key control flags, constants, and variables. – Linked to form a linked list – The Dispatcher determines which program is to start by following the chain of pointers from control block to control block.

Scheduling and Queuing As programs enter the system, they are placed on a queue by the queuing routine. When space becomes available, the scheduler selects a program from the queue and loads it into memory.

Fig. 6.16: Queuing and scheduling.

Fig. 6.13: The dispatcher decides which program to start by following a linked list of control blocks.

Fig. 6.12: The operating system’s dispatcher decides which ready program executes first.

Fig. 6.14a: The program issues an interrupt, requesting the operating system’s support.

Fig. 6.14b: The interrupt handler sets the program to a wait state.

Fig. 6.14c: After the Interrupt Handler Routine starts the requested I/O operation, the dispatcher starts another application program.

Fig. 6.14d: The channel signals the end of the I/O operation by sending the processor an interrupt.

Fig. 6.14e: Following the interrupt, the interrupt handler routine resets program A to a ready state.

Fig. 6.14f: After the interrupt is processed, the dispatcher selects an application program and starts it.

Fig. 6.11: Pages are swapped between the external paging device and the real-memory page pool.

Time-Sharing Managing multiple concurrent users designed with interactive processing in mind. Roll-in/roll-out memory management Dispatching – Time-slicing – Polling

Time-Sharing Roll-in/roll-out memory management – Executing a series of brief transactions – As a given transaction is processed, the system knows that considerable time will pass before that next user’s transaction arrives. – The workspace is rolled out to secondary storage, making room for another application in memory. – When the first user’s next transaction arrives, his/her workspace is rolled back in.

Time-Sharing Time-Slicing – Each program is restricted to a maximum slice of time – Once a program begins executing, it runs until The program requires input or output before exhausting its time slice. –Sends an I/O interrupt to the operating system –Drops into a wait state.

Time-Sharing Time-Slicing – Once a program begins executing, it runs until The program requires input or output before exhausting its time slice. The program uses up its entire time slice –Sends an I/O interrupt to the operating system –Drops into a wait state. –The dispatcher starts the next program.

Fig. 6.15: Polling.

Spooling Copying data from a slow input device to disk for subsequent processing. Copying data to disk for subsequent output to a slow device such as a printer.

Deadlock Two (or more) programs each control a resource needed by the other. Neither program can continue without the needed resource. Neither program will surrender its control.