1 / 16

Operating Systems {week 13a}

Rensselaer Polytechnic Institute CSCI-4210 – Operating Systems David Goldschmidt, Ph.D. Operating Systems {week 13a}. Hierarchical storage architecture. very fast. very small. volatile. non-volatile. very slow. very large. Von Neumann architecture.

daisy
Download Presentation

Operating Systems {week 13a}

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. Rensselaer Polytechnic Institute CSCI-4210 – Operating Systems David Goldschmidt, Ph.D. Operating Systems{week 13a}

  2. Hierarchical storage architecture very fast very small volatile non-volatile very slow very large

  3. Von Neumann architecture • Based on the von Neumann architecture, data and program instructionsexist in physical memory • Repeatedly performfetch-decode-executecycles • The execute partoften results in datafetch and store operations physical memory

  4. Main memory (i) • Locations in memoryare identified bymemory addresses • When compiled, programsconsist of relocatable code • Other compiled modulesalso consist ofrelocatable code symbolic addresses in source code relative addresses in object code

  5. Main memory (ii) • At load time, anyadditional librariesalso consist ofrelocatable code physical addresses generated by loader

  6. Main memory (iii) • At run time, memoryaddresses of all objectfiles are mapped to asingle memory spacein physical memory

  7. Dynamic loading and linking • Using dynamic loading, external libraries are not loaded when a process starts • Libraries are stored on disk in relocatable form • Libraries loaded into memory only when needed • Using dynamic linking, external libraries can be preloaded into shared memory • When a process calls a library function, thecorresponding physical address is determined

  8. Dynamically linked libraries

  9. Contiguous memory allocation (i) • Main memoryis partitionedand allocatedto residentoperating systemand user processes fixed partitioning scheme

  10. Contiguous memory allocation (ii) • A pair of base and limitregisters define thelogical address space • Also known asrelocation registers

  11. Contiguous memory allocation (iii) • The CPU generates logical memory addresses • A Memory-Management Unit (MMU)maps logical memory addressesto the physical address space • User programs never seephysical memory addresses

  12. Contiguous memory allocation (iv) • Hardware protects against memory access outside of a process’s valid memory space

  13. OS OS OS OS Process 5 Process 5 Process 5 Process 5 Process 9 Process 9 Process 8 Process 1 Process 2 Process 2 Process 2 Process 2 Dynamic partitioning • Variable-length or dynamic partitions: • When a new process enters the system, the process is allocated to a single contiguous block • The operating system maintains a list of allocated partitions and free partitions

  14. Placement algorithms • How can we place new process Pi in memory? • First-fit algorithm: allocate the first free blockthat’s large enough to accommodate Pi • Best-fit algorithm: allocate thesmallest free block that’s largeenough to accommodate Pi • Next-fit algorithm: allocate thenext free block, searching from last allocated block • Worst-fit algorithm: allocate the largest free blockthat’s large enough to accommodate Pi

  15. OS Process 5 Process 8 Process 3 Process 2 Process 6 Process 7 Process 12 Fragmentation (i) • Memory is wasted due to fragmentation,which can cause performance issues • Internal fragmentation is wasted memorywithin a single process memory space • External fragmentation can reducethe number of runnable processes • Total memory space exists to satisfya memory request, but memory isnot contiguous unused Process 9

  16. OS Process 5 Process 8 Process 3 Process 3 Process 2 Process 3 Process 6 Process 6 Process 6 Process 7 Process 7 Process 7 Process 12 Process 12 Process 12 Fragmentation (ii) • Reduce external fragmentation bycompaction or defragmentation • Rearrange memory contents to organizeall free memory blocks together intoone large contiguous block • Compaction is possible only ifrelocation is dynamic and isdone at execution time • Compaction is expensive Process 9 Process 9

More Related