Presentation is loading. Please wait.

Presentation is loading. Please wait.

SLC/VER1.0/OS CONCEPTS/OCT'99

Similar presentations


Presentation on theme: "SLC/VER1.0/OS CONCEPTS/OCT'99"— Presentation transcript:

1 SLC/VER1.0/OS CONCEPTS/OCT'99
Memory Management Background Logical Versus Physical Address Space Swapping Paging Virtual Memory Demand Paging’ Thrashing SLC/VER1.0/OS CONCEPTS/OCT'99

2 SLC/VER1.0/OS CONCEPTS/OCT'99
Background Program must be brought into memory and placed within a process for it to be executed Input queue – collection of processes on the disk that are waiting to be brought into memory for execution. User programs go through several steps before being executed. SLC/VER1.0/OS CONCEPTS/OCT'99

3 SLC/VER1.0/OS CONCEPTS/OCT'99
Address Binding Address binding of instructions and data to memory addresses can happen at three different stages. -Compile Time -Load Time -Execution Time SLC/VER1.0/OS CONCEPTS/OCT'99

4 SLC/VER1.0/OS CONCEPTS/OCT'99
Dynamic Loading Routine is not loaded until it is called Better memory-space utilization Useful for large amount of code are needed No special support from the OS is required SLC/VER1.0/OS CONCEPTS/OCT'99

5 SLC/VER1.0/OS CONCEPTS/OCT'99
Dynamic Linking Linking postponed until execution time. Stub used to locate the appropriate memory-resident library routine. OS needed to check if routine is in processes memory address. SLC/VER1.0/OS CONCEPTS/OCT'99

6 Logical Vs Physical address space
Logical address are generated by CPU Unit of memory is commonly referred as a physical addresses logical and physical address differ at the execution time The run time mapping from virtual to physical address is done by the MMU, which is a hardware device. SLC/VER1.0/OS CONCEPTS/OCT'99

7 Logical Vs Physical address space
Relocation register 1400 + Logical address Physical address CPU Memory 346 14346 MMU Dynamic relocation using a relocation register SLC/VER1.0/OS CONCEPTS/OCT'99

8 SLC/VER1.0/OS CONCEPTS/OCT'99
SWAPING A process can be swapped temporarily out of memory to a backing store, and then brought back into memory for continued execution swapping can be done on priority bases A process that is swapped out will be swapped back into the same memory space that is occupied previously SLC/VER1.0/OS CONCEPTS/OCT'99

9 Schematic View of Swapping
SLC/VER1.0/OS CONCEPTS/OCT'99

10 SLC/VER1.0/OS CONCEPTS/OCT'99
Paging Physical memory is broken into fixed size blocks called frames logical memory is broken into blocks of same size called pages paging is done with the hardware support SLC/VER1.0/OS CONCEPTS/OCT'99

11 SLC/VER1.0/OS CONCEPTS/OCT'99
Paging Logical address Physical Memory CPU P d F d Page table f p Paging hardware SLC/VER1.0/OS CONCEPTS/OCT'99

12 Paging E.g u a I j k l 1 b 2 c 3 4 3 d m n o p 4 1 4 e f 8 5 1 g 2 6 a
u a I j k l 1 b 2 c 3 4 3 d m n o p 4 1 4 e f 8 5 1 g 2 6 a b c d h 7 3 2 12 8 i Page table e f g h 9 j 10 k 16 11 l Logical Memory page Example for 32-byte memory with 4byte pages Physical memory SLC/VER1.0/OS CONCEPTS/OCT'99

13 SLC/VER1.0/OS CONCEPTS/OCT'99
Virtual Memory Virtual memory – separation of user logical memory from physical memory. Only part of the program needs to be in memory for execution. Logical address space can therefore be much larger than physical address space. Need to allow pages to be swapped in and out. Virtual memory can be implemented via: Demand paging SLC/VER1.0/OS CONCEPTS/OCT'99

14 SLC/VER1.0/OS CONCEPTS/OCT'99
Demand-paging Bring a page into memory only when it is needed -Less I/O needed -Less memory needed -Faster response -more users Page in, Page out and Page fault. SLC/VER1.0/OS CONCEPTS/OCT'99

15 SLC/VER1.0/OS CONCEPTS/OCT'99
Valid-Invalid Bit With each page table entry a valid-invalid bit is associated. Example of a page table snapshot Frame # valid-invalid bit 1 1 1 1 M SLC/VER1.0/OS CONCEPTS/OCT'99

16 SLC/VER1.0/OS CONCEPTS/OCT'99
Demand-paging OS 3 2 1 i Load M 6 Free frame 5 4 SLC/VER1.0/OS CONCEPTS/OCT'99

17 What happens if there is no free frame?
Page replacement - find some page in memory, but not really in use, swap it out -algorithms -performance-want an algorithm which will result in minimum number of page faults. Same page may be brought into memory several times. SLC/VER1.0/OS CONCEPTS/OCT'99

18 SLC/VER1.0/OS CONCEPTS/OCT'99
Thrashing If process doesn’t have “enough” pages, the page-fault rate is very high. This leads to: -low CPU utilization -OS thinks that it needs to increase the degree of multiprogramming -another process added to the system Thrashing= a process is busy swapping pages in and out SLC/VER1.0/OS CONCEPTS/OCT'99

19 SLC/VER1.0/OS CONCEPTS/OCT'99
Thrashing Causes Of Thrashing: C P U t I l z a o n Thrashing Degree of multiprocessing SLC/VER1.0/OS CONCEPTS/OCT'99


Download ppt "SLC/VER1.0/OS CONCEPTS/OCT'99"

Similar presentations


Ads by Google