Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "6 Memory Management and Processor Management Management of Resources Measure of Effectiveness – On most modern computers, the operating system serves."— Presentation transcript:

1

2 6 Memory Management and Processor Management

3 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

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

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

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

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

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

9 Memory Management Partitions and Regions

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

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

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

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

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

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

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

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

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

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

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

21 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

22 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

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

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

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

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

27 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

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

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

30 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

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

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

33 Fig. 6.8: Segmentation and paging.

34 Virtual Memory

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

36 Fig. 6.10: Virtual memory.

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

38 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).

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

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

41 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

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

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

44 Fig. 6.16: Queuing and scheduling.

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

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

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

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

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

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

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

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

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

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

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

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

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

58 Fig. 6.15: Polling.

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

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


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

Similar presentations


Ads by Google