Operating Systems1 9. Linking and Sharing 9.1 Single-Copy Sharing –Why Share –Requirements for Sharing –Linking and Sharing 9.2 Sharing in Systems without.

Slides:



Advertisements
Similar presentations
8. Virtual Memory 8.1 Principles of Virtual Memory
Advertisements

Part IV: Memory Management
Memory Protection: Kernel and User Address Spaces  Background  Address binding  How memory protection is achieved.
Linkage Editors Difference between a linkage editor and a linking loader: Linking loader performs all linking and relocation operations, including automatic.
Linking & Loading CS-502 Operating Systems
Chapter 3 Loaders and Linkers
Loaders and Linkers CS 230 이준원. 2 Overview assembler –generates an object code in a predefined format »COFF (common object file format) »ELF (executable.
Mr. D. J. Patel, AITS, Rajkot 1 Operating Systems, by Dhananjay Dhamdhere1 Static and Dynamic Memory Allocation Memory allocation is an aspect of a more.
CS 31003: Compilers ANIRUDDHA GUPTA 11CS10004 G2 CLASS DATE : 24/07/2013.
1 Starting a Program The 4 stages that take a C++ program (or any high-level programming language) and execute it in internal memory are: Compiler - C++
Mehmet Can Vuran, Instructor University of Nebraska-Lincoln Acknowledgement: Overheads adapted from those provided by the authors of the textbook.
Memory Management Chapter 7.
Memory Management (II)
Loader- Machine Independent Loader Features
A. Frank - P. Weisberg Operating Systems Real Memory Management.
Operating System Concepts
03/05/2008CSCI 315 Operating Systems Design1 Memory Management Notice: The slides for this lecture have been largely based on those accompanying the textbook.
CompSci 143A1 9. Linking and Sharing 9.1 Single-Copy Sharing –Why Share –Requirements for Sharing –Linking and Sharing 9.2 Sharing in Systems without Virtual.
Memory management. Instruction execution cycle Fetch instruction from main memory Decode instruction Fetch operands (if needed0 Execute instruction Store.
Chapter 91 Memory Management Chapter 9   Review of process from source to executable (linking, loading, addressing)   General discussion of memory.
Operating System Chapter 7. Memory Management Lynn Choi School of Electrical Engineering.
Computer Architecture and Operating Systems CS 3230: Operating System Section Lecture OS-7 Memory Management (1) Department of Computer Science and Software.
Memory Management. Process must be loaded into memory before being executed. Memory needs to be allocated to ensure a reasonable supply of ready processes.
© 2004, D. J. Foreman 1 Memory Management. © 2004, D. J. Foreman 2 Building a Module -1  Compiler ■ generates references for function addresses may be.
Linking and Loading Linker collects procedures and links them together object modules into one executable program. Why isn't everything written as just.
Chapter 4 Storage Management (Memory Management).
CIS250 OPERATING SYSTEMS Memory Management Since we share memory, we need to manage it Memory manager only sees the address A program counter value indicates.
By Teacher Asma Aleisa Year 1433 H.   Goals of memory management  To provide a convenient abstraction for programming  To allocate scarce memory resources.
1 Memory Management Requirements of memory management system to provide the memory space to enable several processes to execute concurrently to provide.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Memory: Relocation.
Operating Systems Principles Memory Management Lecture 9: Sharing of Code and Data in Main Memory 主講人:虞台文.
CPS3340 COMPUTER ARCHITECTURE Fall Semester, /29/2013 Lecture 13: Compile-Link-Load Instructor: Ashraf Yaseen DEPARTMENT OF MATH & COMPUTER SCIENCE.
RNJ 05/05/091 6 Further System Fundamentals (HL) ‏ 6.3 Operating Systems and Utility Software Linkers, Loaders and Library Managers.
Memory Management Operating Systems CS550. Memory Manager Memory manager - manages allocation and de-allocation of main memory Plays significant impact.
CS6502 Operating Systems - Dr. J. Garrido Memory Management – Part 1 Class Will Start Momentarily… Lecture 8b CS6502 Operating Systems Dr. Jose M. Garrido.
Operating Systems Lecture 31.
CSC 360, Instructor Kui Wu Memory Management I: Main Memory.
ICS Linking and Sharing 9.1 Single-Copy Sharing –Why Share –Requirements for Sharing 9.2 Static Linking and Sharing –Sharing in Systems w/o Segmentation.
WEEK 5 LINKING AND LOADING MEMORY MANAGEMENT PAGING AND SEGMENTATION Operating Systems CS3013 / CS502.
LECTURE 3 Translation. PROCESS MEMORY There are four general areas of memory in a process. The text area contains the instructions for the application.
Operating Systems Lecture 31 Syed Mansoor Sarwar.
Object Files & Linking. Object Sections Compiled code store as object files – Linux : ELF : Extensible Linking Format – Windows : PE : Portable Execution.
Program Execution in Linux David Ferry, Chris Gill CSE 522S - Advanced Operating Systems Washington University in St. Louis St. Louis, MO
Memory management.
Real Memory Management
Multics.
The University of Adelaide, School of Computer Science
Background Information Text Chapter 8
Linking & Loading.
Memory Management © 2004, D. J. Foreman.
Program Execution in Linux
CS-3013 Operating Systems C-term 2008
CSI 400/500 Operating Systems Spring 2009
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy 11/12/2018.
Segmentation Lecture November 2018.
Machine Independent Features
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy Chapter 8 11/24/2018.
Background Program must be brought into memory and placed within a process for it to be run. Input queue – collection of processes on the disk that are.
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy Chapter 9 12/1/2018.
Memory Management Tasks
Chapter 8: Memory management
Outline Module 1 and 2 dealt with processes, scheduling and synchronization Next two modules will deal with memory and storage Processes require data to.
Linking & Loading CS-502 Operating Systems
Operating System Chapter 7. Memory Management
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy Chapter 9 4/5/2019.
Program Execution in Linux
Linking & Loading CS-502 Operating Systems
OPERATING SYSTEMS MEMORY MANAGEMENT BY DR.V.R.ELANGOVAN.
Structure of Processes
CSE 542: Operating Systems
Presentation transcript:

Operating Systems1 9. Linking and Sharing 9.1 Single-Copy Sharing –Why Share –Requirements for Sharing –Linking and Sharing 9.2 Sharing in Systems without Virtual Memory 9.3 Sharing in Paging Systems –Sharing of Data –Sharing of Code 9.3 Sharing in Segmented Systems

Operating Systems2 Single-Copy Sharing Focus: sharing a single copy of code or data in memory Why share? –Processes need to access common data producer/consumer, task pools, file directories –Better utilization of memory code, system tables, data bases

Operating Systems3 Linking and Sharing Linking resolves external references Sharing links the same copy of a module into two or more address spaces Static linking/sharing: –Resolve references before execution starts Dynamic linking/sharing: –While executing

Operating Systems4 Sharing without Virtual Memory With one or no Relocation Register (RR) –All memory of a process is contiguous –Sharing user programs: Possible only with 2 user programs by partial overlap Too restrictive and difficult; generally not used –Sharing system components: Components are assigned specific, agreed-upon starting positions Linker resolves references to those locations

Operating Systems5 Sharing without Virtual Memory With multiple RRs –CBR: Code Base Points to shared copy of code –SBR: Stack Base Points to private copy of stack –DBR: Data Base Points to private copy of data –Multiple processes can share code or data

Operating Systems6 Sharing in Paging Systems Sharing of data pages: –PT entries of different processes point to same pages –If shared pages contain no addresses, linker can: assign arbitrary page numbers to shared pages record in PT –So shared data page can have a different page # in different processes –But address in shared page does not work

Sharing in Paging Systems Sharing of code pages Solution 1: assign the same page numbers to all shared pages –Restrictive Solution 2: no page numbers in shared code –Compile self-references relative to CBR –Compile data/stack references relative to DBR/SBR –Limitation: shared code cannot contain any external references Operating Systems7

8 Sharing of Code Pages in Paging Systems When to resolve external references (to shared pages)? loader could check which shared pages are resident, adjust PT (e.g. n2) –too much overhead –many shared libs are never accessed solution: defer linking until first access: –dynamic linking –using transfer vector

Operating Systems9 Dynamic Linking via Transfer Vector One tv entry per shared module Initially each entry contains only a stub Stub does the following: –checks if referenced code is loaded –if not, it loads it –it then replaces itself by a branch to shared code Next reference to the same code bypasses stub (simple indirect branch)

Operating Systems10 Sharing in Segmented Systems Similar to paging Data pages: assign any segment numbers Code pages: –Assign same segment numbers in all STs, or –Use base registers for self/data/stack references Limitation: no addresses in shared segments But segments are logical entities—permit general solution: –Keep private linkage section (LS) for each segment –External references are in LS, not in code –Every process has its own copy of LS: Can use different segment numbers –Introduced in Multics (1968)

Operating Systems11 Unrestricted Dynamic Linking/Sharing Self-references resolved using CBR Other references via addresses but kept in private LS –sharing is unrestricted (can use different page #s, shared segments can contain external references) Linking/sharing is dynamic –External reference kept symbolic: (S,W), where S is a program name and W is a label, e.g. (HelloWorld, start) –At runtime, on first use: (S,W) is resolved to (s,w), using trap mechanism (s,w) is entered in linkage section of process –code is unchanged –Subsequent references use (s,w) without involving OS

Operating Systems12 Dynamic Linking/Sharing Before and After External Reference is Executed