Presentation is loading. Please wait.

Presentation is loading. Please wait.

CGS 3763 Operating Systems Concepts Spring 2013 Dan C. Marinescu Office: HEC 304 Office hours: M-Wd 11:30 - 12:30 AM.

Similar presentations


Presentation on theme: "CGS 3763 Operating Systems Concepts Spring 2013 Dan C. Marinescu Office: HEC 304 Office hours: M-Wd 11:30 - 12:30 AM."— Presentation transcript:

1 CGS 3763 Operating Systems Concepts Spring 2013 Dan C. Marinescu Office: HEC 304 Office hours: M-Wd 11:30 - 12:30 AM

2 Last time: Storage models Types of storage Transactions  Today Memory hierarchies. Binary image; swapping Contiguous allocation of the main memory Physical, logical, and virtual addresses Paging Next time  Memory management Reading assignments  Chapters 8 and 9 of the textbook Lecture 33 – Friday, April 5, 2013 Lecture 332

3 Basic concepts The three basic components of a computing system:  Interpreter  Storage  Communication channels Hierarchy of physical storage:  Registers  Cache (L1 and L2)  Primary storage (main memory – volatile storage)  Secondary storage (mechanical or solid-state disks – persistent storage) The CPU can access directly only the registers, the cache, and the primary memory. A program has a binary image stored on secondary storage (disk); this image must be brought (from disk) into memory and placed within a process for it to be run. Lecture 333

4 4

5 The steps to create a binary image from a source program in a high level language Lecture 335

6 Swapping Lecture 336 A process can be swapped temporarily out of memory to a backing store, and then brought back into memory for continued execution Backing store – fast disk large enough to accommodate copies of all memory images for all users; must provide direct access to these memory images Roll out, roll in – swapping variant used for priority-based scheduling algorithms; lower-priority process is swapped out so higher-priority process can be loaded and executed Major part of swap time is transfer time; total transfer time is directly proportional to the amount of memory swapped Modified versions of swapping are found on many systems (i.e., UNIX, Linux, and Windows) Memory management and scheduling have to work in concert. System maintains a ready queue of ready-to-run processes which have memory images on disk

7 Lecture 337

8 Physical versus virtual address spaces Physical address space  the range of physical addresses in a memory module. It depends on the size of the physical memory. Virtual (logical) address space  the range of virtual addresses available for a process. A process in execution uses virtual addresses and the Multi-Level- Memory-Management (MLMM) software assisted by hardware has to translate them into physical addresses. This process is called Dynamic Address Translation (DAT). Lecture 338

9 Memory management then and …now At the beginning computers did not use the concept of logical addresses. A logical address was the physical address!!! The physical memory allocated to a process was contiguous. A base register gave the address where the process was loaded and a limit register was marking the end of the address space. Lecture 339

10 A relocation register was added to allow a binary to be loaded at any physical address. Lecture 3310

11 Lecture 3311

12 Problems with contiguous allocation  Hole – block of available memory; holes of various size are scattered throughout memory  When a process arrives, it is allocated memory from a hole large enough to accommodate it  Operating system maintains information about: a) allocated partitions b) free partitions (hole) OS process 5 process 8 process 2 OS process 5 process 2 OS process 5 process 2 OS process 5 process 9 process 2 process 9 process 10 Lecture 3312

13 How to satisfy a request of size n First-fit: Allocate the first hole that is big enough Best-fit: Allocate the smallest hole that is big enough; must search entire list, unless ordered by size  Produces the smallest leftover hole Worst-fit: Allocate the largest hole; must also search entire list  Produces the largest leftover hole First-fit and best-fit better than worst-fit in terms of speed and storage utilization Lecture 3313

14 Fragmentation External Fragmentation  total memory space exists to satisfy a request, but it is not contiguous Internal Fragmentation  allocated memory may be slightly larger than requested memory; this size difference is memory internal to a partition, but not being used Compaction  to reduce external fragmentation:  Shuffle memory contents to place all free memory together in one large block  Compaction is possible only if relocation is dynamic, and is done at execution time  I/O problem Latch job in memory while it is involved in I/O Do I/O only into OS buffers Lecture 3314

15 Paging Logical address space of a process can be noncontiguous; process is allocated physical memory whenever the latter is available Divide physical memory into fixed-sized blocks called frames (size is power of 2, between 512 bytes and 8,192 bytes) Divide logical memory into blocks of same size called pages Keep track of all free frames To run a program of size n pages, need to find n free frames and load program Set up a page table to translate logical to physical addresses Internal fragmentation Lecture 3315


Download ppt "CGS 3763 Operating Systems Concepts Spring 2013 Dan C. Marinescu Office: HEC 304 Office hours: M-Wd 11:30 - 12:30 AM."

Similar presentations


Ads by Google