1 / 60

Memory Management and Processor Management

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

vala
Download Presentation

Memory Management and Processor Management

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 6 Memory Management and Processor Management

  2. Management ofResources • 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

  3. Management ofResources • 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.

  4. Processor Management • Processor Management • Concerned with managing the processor’s time.

  5. Memory Management • 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.

  6. 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.

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

  8. Memory ManagementPartitions and Regions

  9. 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.

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

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

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

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

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

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

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

  17. Memory ManagementPartitions and Regions • Fixed-Partition Memory Management • Regions – Dynamic Memory Management.

  18. Memory ManagementPartitions • 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.

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

  20. Memory ManagementPartitions • 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

  21. Memory ManagementRegions • 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

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

  23. Memory ManagementRegions • 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.

  24. Memory ManagementRegions • Regions - Dynamic Memory Management • Utilizes: • Segmentation • Paging

  25. Memory ManagementRegions • Segmentation: • Programs are divided into independently addressed segments and stored in non-contiguous memory.

  26. Memory ManagementSegmentation • 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

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

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

  29. Memory ManagementPaging • 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

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

  31. Memory ManagementSegmentation 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.

  32. Fig. 6.8: Segmentation and paging.

  33. Virtual Memory

  34. Memory ManagementVirtual 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.

  35. Fig. 6.10: Virtual memory.

  36. Memory ManagementVirtual Memory • Divides main storage into 2K sections called pageframes. • 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.

  37. Memory ManagementVirtual 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 realstorage; • Brings in the new page into real storage (page-in).

  38. Memory ManagementVirtual Memory • Virtual address dynamically translated • Thrashing • excessive paging • Seriously degrades system performance

  39. 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.

  40. 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

  41. 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.

  42. 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.

  43. Fig. 6.16: Queuing and scheduling.

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

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

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

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

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

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

More Related