LOADERS AND LINKERS 1. BASIC LOADER FUNCTIONS 2. DESIGN OF AN ABSOLUTE LOADER 3. A SIMPLE BOOTSTRAP LOADER 4. MACHINE DEPENDENT LOADER FEATURES

Size: px
Start display at page:

Download "LOADERS AND LINKERS 1. BASIC LOADER FUNCTIONS 2. DESIGN OF AN ABSOLUTE LOADER 3. A SIMPLE BOOTSTRAP LOADER 4. MACHINE DEPENDENT LOADER FEATURES"

Transcription

1 UIT III LOADERS AD LIKERS 1. BASIC LOADER FUCTIOS 2. DESIG OF A ABSOLUTE LOADER 3. A SIMPLE BOOTSTRAP LOADER 4. MACHIE DEPEDET LOADER FEATURES 5. RELOCATIO 6. PROGRAM LIKIG 7. ALGORITHM AD DATA STRUCTURES FOR LIKIG LOADER 8. MACHIE-IDEPEDET LOADER FEATURES 9. AUTOMATIC LIBRAR SEARCH 10. LOADER OPTIOS 11. LOADER DESIG OPTIOS 12. LIKAGE EDITORS 13. DAMIC LIKIG 14. BOOTSTRAP LOADERS 15. IMPLEMETATIO EXAMPLE 16. MSDOS LIKER.

2 LIKERS AD LOADERS 1. Introduction Installing a code in memory is called loading. Memory Assembler Loader Obj. prog. Source program Object program Figure 1. Loading an object code into memory The task of integrating the program modules together is called linking. Module1 relocatable object modules Assembler Linker Loader Module2 Source modules Module 3 Linked Object modules Figure 2. Linking and loading as split processes

3 Linking and loading are frequently done at one time by a linking loader. Module 1 Assembler Linking Loader Module 2 relocatable Source object modules modules object Module 3 modules Figure 3. Linking loader Types of loaders: 1. Absolute loaders 2. Relocating loaders 3. Linking loaders 2. Absolute Loaders Assembler generates the code and writes instructions in a file together with their load addresses. The loader reads the file and places the code at the absolute address given in the file. Example 1: Assume that the assembler generates the following code: Address: instruction: 0100 F B F

4 The above code is written in the file as follows: 0100 location (2 bytes) 5 number of bytes F code 47 B location 4 number of bytes 05 F2 code EOF

5 read 2 bytes EOF marker return set LC to the byte read read a byte and set B to it read a byte place it into the memory location pointed to by LC Counter of Bytes B = B 1 LC = LC + 1 LC: Location B: umber B>0 Figure 4. Absolute loader

6 3. Relocating Loader independently assembled modules Assembler relocation information Relocating Loader Example 2: Assume that the following two relocatable codes and the associated DATs are generated by the assembler: Address: instruction: 0000 F B5 DAT F DAT 0002

7 The relocating loader adds the load-point of the code to all the references specified in DAT. If the load-points of the above programs are 500 and 700, they are placed in the memory as follows: Memory A B F

8 Get load-point LC=0 Read a byte EOF marker return LC is in DAT Read next byte Place the byte at memory location LC + Load Point Add load point Place the bytes at memory locations LC + Load Point and LC + Load Point + 1 LC = LC + 1 LC = LC + 2 Figure 5. Relocating loader

9 4. Linking Loader Linking loaders perform four functions: 1. Allocation: allocating space in memory for programs 2. Linking: resolving external references between modules 3. Relocation: adjusting all address references 4. Loading: physically placing machine instructions and data in memory Entry and External Points When a statement in one module refers to a symbol in another module, it is called an external reference (EXTREF). Any symbol in a module that can be referred to from another module is called an entry point (EXTDEF). Module A Module B EXTERAL ALPHA, BETA ETR ALPHA, BETA LDA ALPHA ALPHA: LXI BETA BETA:

10 Example 3: The assembler has generated the object codes of the following source programs where external references have not been resolved. These codes will be linked and loaded into memory by a linking-loader. Source programs Code generated by the assembler H R R R PROGA SIZE BUF SUM PROGA: START 0 address EXTREF SIZE, BUF, SUM LDA # STA SIZE C LDA # LDX # L1: STA BUF, X 000C 0F ADD #1 000F TIX SIZE C JEQ L B (placed by the assembler in pass 2) J L C 00 0C (placed by the assembler in pass 1) L2: JSUB SUM 001B 48 RSUB 001E 4F ED DAT 0016 DAT 0019 M SIZE 0004 M BUF 000D M SIZE 0013 M SUM 001B H PROGB D SUM 0000 R BUF R SIZE R TOT PROGB: START 0 EXTDEF SUM EXTREF SIZE, BUF, TOT SUM: LDA # LDX # L3: ADD BUF, X B TIX SIZE C JEQ L4 000C (placed by the assembler in pass 2) J L3 000F 3C (placed by the assembler in pass 1)

11 L4: STA TOT C RSUB F ED DAT 000D DAT 0010 M BUF 0007 M SIZE 000A M TOT 0013 H PROGC D SIZE 0000 D TOT 0003 D BUF 0006 PROGC: START 0 EXTDEF SIZE, BUF, TOT SIZE: RESW TOT: RESW BUF: RESW ED C Relocatable machine codes Assembler DATs Linker H/D/R/M Information The linker does two passes: Pass1: 1. Gets load points of all programs. 2. Creates ESTAB table, using the information in D/R table. Calculates the absolute address of each label in ESTAB as: load point + relative address. Pass 2: 1. Using the M information and the absolute addresses in ESTAB, resolves the external references in all programs. 2. Using the DAT information, adds load points to the local references.

12 ESTAB program load point label absolute address PROGA 1000 PROGB 2000 SUM 2000 PROGC 3000 SIZE 3000 TOT 3003 BUF 3006 Source programs Code generated Code generated by the assembler at the end of linking address address PROGA: START 0 EXTREF SIZE, BUF, SUM LDA # STA SIZE C C LDA # LDX # L1: STA BUF, X 000C 0F 000C 0F ADD #1 000F F TIX SIZE C C JEQ L B B J L C 00 0C C 10 0C L2: JSUB SUM 001B B RSUB 001E 4F E 4F ED PROGB: START 0 EXTDEF SUM EXTREF SIZE, BUF, TOT SUM: LDA # LDX # L3: ADD BUF, X B B TIX SIZE C C JEQ L4 000C C J L3 000F 3C F 3C L4: STA TOT C C RSUB F F ED

13 PROGC: START 0 EXTDEF SIZE, BUF, TOT SIZE: RESW TOT: RESW BUF: RESW ED C 000C Get Load Point Read program name and enter in ESTAB Read a record D record Enter symbol in ESTAB and calculate absolute address end of program end of all programs Pass 2 Figure 6. Pass 1 of the Linker

14 Get load point from ESTAB and set LC to the load point Read a record object code Write it in the memory location pointed by LC M record symbol in ESTAB pointed by Find absolute address of the and write it in memory location LC + relative location DAT record Add load point to the value in memory location pointed by LC + DAT entry more records Done Figure 7. Pass 2 of the Linker

15 Linked codes are combined into a single file in the following format: File format: File name File type umber of blocks Load point (2 bytes) umber of bytes Code Header Block 1 Checksum Block Checksum: To calculate checksum, add up all data in the block and take its low order byte. When writing the code to the file, calculate checksum and write it at the end of each block. When installing the code in memory, recompute checksum and compare it with the one read from the file. Figure 8. Absolute loader, which reads the linked codes from a file and loads them into the memory.

16 Read header B = block count Read load point LC = load point Read byte count BC = byte count Initialize checksum Read a byte Write the byte in memory at location pointed to by LC Add the byte to checksum LC = LC + 1 BC = BC 1 BC>0 Read checksum byte Checksum OK B = B 1 print error message B > 0 B: umber of blocks LC: Location counter BC: Byte count Return

17 5. Linking with Libraries Library contains the relocatable image of each module. User programs are assembled individually. The library routines used in user programs appear as external references. Library routines Relocatable machine code DAT D/R/M Information user Relocatable machine code programs DAT Linker D/R/M Information Most linkers execute a default transparent search of a set of libraries that contain most of the commonly called routines. Searches are performed at the end of Pass 1 Library routines may have global symbols to be resolved, linker performs iterative search until all symbols are resolved Library files are designed to expedite the search. It is not necessary to go through the whole file, instead, a library file header is reviewed, usually located at the beginning of a file. The header contains all information. Ex: Library file header Routine ame Global Symbols Location in the File Library routines are linked with user programs, between Pass 1 and Pass 2, while the linker is resolving external references.

18 Pass 2 more references Take an External reference Resolve it Entry found for it in user programs Check all libraries (or only those specified by the user) to find an Entry for it found print error message Calculate a load point for the library routine Configure direct addresses in the modules Append the library routine to the user file Merge the new D/R information to the ESTAB Figure 9. Linking the library routines with the user programs.

19 Dynamic Address Resolution In dynamic linking, a subroutine is loaded and linked to the other programs when it is first called during the execution. Dynamic linking allows several executing programs to share the same copy of a subroutine. For example, a single copy of the routines in a dynamic linking library (run-time library) can be loaded into the memory, and all currently executing programs can be linked to this copy. Dynamic linking provides the ability to load the routines only when they are needed. For example, error correction routines are not need to be linked and loaded if no errors occur during the program. Dynamic linking also avoids the necessity of loading the entire library for each execution. For example, a program may be calling a different routine depending on the input data. Dynamic linking and loading has the following steps: 1. The user program makes a Load-and-Call request to the operating system (dynamic loader). 2. The operating system examines its internal tables to determine whether or not the routine is already loaded. If not, loads it into the memory. Then it transfers control to the routine. 3. After the subroutine is processed, it returns control to the operating system. 4. The operating system returns control to the program that issued the request. 5. The subroutine may be retained in the memory for later use. Machine Independent Loader Features Automatic Library Search Automatic library call The programmer does not need to take any action beyond mentioning the subroutine names as external references Solution 1 Enter the symbols from each Refer record into ESTAB 2 When the definition is encountered (Define record), the address is assigned 3 At the end of Pass 1, the symbols in ESTAB that remain undefined represent unresolved external references 4 The loader searches the specified (or standard) libraries for undefined symbols or subroutines The library search process may be repeated Since the subroutines fetched from a library may themselves contain external references Programmer defined subroutines have higher priority The programmer can override the standard subroutines in the library by supplying their own routines Library structures Assembled or compiled versions of the subroutines in a library can be

20 structured using a directory that gives the name of each routine and a pointer to its address within the library Loader Options Many loaders have a special command language that is used to specify options. The commands may be: In a separate input file In the source program Embedded in the primary input stream between programs Command Language Specifying alternative sources of input ICLUDE program-name(library-name) Changing or deleting external reference DELETE name CHAGE symbol1, symbol2 Controlling the automatic library search LIBRAR MLIB Specify that some references not be resolved OCALL name Specify the location at which execution is to begin Example If we would like to evaluate the use of READ and WRITE instead of RDREC and WRREC, for a temporary measure, we use the following loader commands ICLUDE READ(UTLIB) ICLUDE WRITE(UTLIB) DELETE RDREC, WRREC CHAGE RDREC, READ CHAGE WRREC, WRITE If it is know that the statistical analysis is not to be performed in an execution OCALL STDDEV, PLOT, CORREL Loader Design Options Linkage Editors Definition A linkage editor produces a linked version of the program (often called a load module or an executable image) which is written to a file or a library for later execution Procedure A linkage editor performs relocation of all control sections relative to the start of the linked program, resolves all external reference, and output a relocatable module for later execution A simple relocating loader can be used to load the program into memory (one-pass without external symbol table) Linking Loader vs. Linkage Editors Comparison Linking Loader: performs all linking and relocation operations, including library search if specified, and loads the linked program directly into memory for execution Linkage Editors: produces a linked version of the program (often called a load module or an executable image), which is written onto a file or library for later execution Resolution of external reference and library searching are only performed once for

21 linkage editor If a program is to be executed many times without being reassembled, the use of a linkage editor substantially reduces the overhead required. If a program is under development or is used infrequently, the use of a linking loader outperforms a linkage editor Dynamic Linking Comparison Linkage editors perform linking operations before the program is loaded for execution Linking loaders perform linking operations at load time Dynamic linking (dynamic loading, load on call) perform linking at execution time Delayed Binding Avoid the necessity of loading the entire library for each execution, i.e. load the routines only when they are needed Allow several executing programs to share one copy of a subroutine or library (Dynamic Link Library, DLL) Via an OS Dynamic loader is one part of the OS Instead of executing a JSUB instruction that refers to an external symbol, the program makes a load-and-call service request to the OS

22 Pass of control User program OS OS: load the subroutine OS Subroutine Subroutine OS OS User program

23 Bootstrap loaders When a computer is first turned on or restarted, bootstrap loader is executed. Bootstrap loader is a simple absolute loader. Its function is to load the first system program to be run by the computer, which is the operating system or a more complex loader that loads the rest of the system. Bootstrap loader is coded as a fixed-length record and added to the beginning of the system programs that are to be loaded into an empty system. A built-in hardware or a very simple program in ROM reads this record into the memory and transfers control to it. When it is executed, it loads the following program, which is either the operating system itself or other system programs to be run without the operating system. MS DOS linker object file (.OBJ) generated by assembler (or compiler) format THEADR name of this object module PUBDEF external symbols defined in this module EXTDEF external symbols used here TPDEF data types for pubdef and extdef SEGDEF describes segments in this module GRPDEF segment grouping LAMES name list indexed by segdef and grpdef LEDATA binary image of code LIDATA repeated data FIXUPP modification record MODED end LIK pass 1:» allocates segments defined in SEGDEF» resolve external symbols pass 2:» prepare memory image if needed, disk space is also used» expand LIDATA» relocations within segment» write.exe file

3.3 Machine-Independent Loader Features

3.3 Machine-Independent Loader Features 3.3 Machine-Independent Loader Features Loading and linking are often thought of as operating system service functions. Machine independent loader features: 3.3.1 Automatic Library Search 3.3.2 Loader

More information

UNIT III - LOADERS AND LINKERS

UNIT III - LOADERS AND LINKERS 3.1 Introduction to Loaders UNIT III - LOADERS AND LINKERS A loader is the part of an operating system that is responsible for loading programs into memory and prepares them for execution. Loading a program

More information

UNIT III LOADERS AND LINKERS PART A

UNIT III LOADERS AND LINKERS PART A PART A UNIT III LOADERS AND LINKERS 1. Define Absolute Loader and Bootstrap Loader. The loader, which is used only for loading but not for relocation or linking is known as absolute loader. e.g. Bootstrap

More information

This contains the following three processes, and they are,

This contains the following three processes, and they are, Chapter 3 Loaders and Linkers This Chapter gives you Basic Loader Functions Machine-Dependent Loader Features Machine-Independent Loader Features Loader Design Options Implementation Examples 30 Introduction

More information

Chapter 3: Loaders and Linkers

Chapter 3: Loaders and Linkers Department of Electr rical Eng ineering, Chapter 3: Loaders and Linkers 王振傑 (Chen-Chieh Wang) ccwang@mail.ee.ncku.edu.tw ncku edu 3.1 Basic Loader Functions 3.1.1 Design of an Absolute Loader 3.1.2 A Simple

More information

UNIT III LOADERS AND LINKERS

UNIT III LOADERS AND LINKERS UNIT III LOADERS AND LINKERS INTRODUCTION Loader is a system program that performs the loading function. Many loaders also support relocation and linking. Some systems have a linker (linkage editor) to

More information

Chapter 3 Loaders and Linkers

Chapter 3 Loaders and Linkers Chapter 3 Loaders and Linkers Three fundamental processes: Loading brings the object program into memory for execution. Relocation modifies the object program so that it can be loaded at an address different

More information

Chapter 3 Loaders and Linkers -- Machine-Dependent Loader Feature

Chapter 3 Loaders and Linkers -- Machine-Dependent Loader Feature Chapter 3 Loaders and Linkers -- Machine-Dependent Loader Feature Motivation Shortcoming of an absolute loader Programmer needs to specify the actual address at which it will be loaded into memory. It

More information

Prepared By : Ms. Sanchari Saha ( Asst. Professor) Department : Computer Science & Engineering

Prepared By : Ms. Sanchari Saha ( Asst. Professor) Department : Computer Science & Engineering Subject Name: System Software Subject Code: 10CS52 Prepared By : Ms. Sanchari Saha ( Asst. Professor) Department : Computer Science & Engineering Date : 20-10-2014 UNIT-4 LOADERS & LINKERS Engineered for

More information

Loaders. Systems Programming. Outline. Basic Loader Functions

Loaders. Systems Programming. Outline. Basic Loader Functions Loaders Systems Programming Chapter 3 Linkers and Loaders A loader is a system program that performs the loading function. many also support relocation & linking others have a separate linker and loader

More information

Chapter 3 Loaders and Linkers -- Loader Design Options

Chapter 3 Loaders and Linkers -- Loader Design Options Chapter 3 Loaders and Linkers -- Loader Design Options Loaders Linkage editor Linking before loading Dynamic linking Linking at the execution time Bootstrap loader Linkage editors Difference between a

More information

Chapter 3 Loaders and Linkers

Chapter 3 Loaders and Linkers Chapter 3 Loaders and Linkers Outline 3.1 Basic Loader Functions 3.2 Machine-Dependent Loader Features 3.3 Machine-Independent Loader Features 3.4 Loader Design Options 3.5 Implementation Examples Introduction

More information

Chapter 3 Loaders and Linkers

Chapter 3 Loaders and Linkers Chapter 3 Loaders and Linkers Outline 3.1 Basic Loader Functions 3.2 Machine-Dependent Loader Features 3.3 Machine-Independent Loader Features 3.4 Loader Design Options 3.5 Implementation Examples Introduction

More information

1.Program to find factorial of a given number

1.Program to find factorial of a given number 1.Program to find factorial of a given number DATA SEGMENT X DW 06H FACT DW? DATA ENDS CODE SEGMENT ASSUME CS:CODE,DS:DATA START: MOV AX,DATA MOV DS,AX MOV AX,01H ;Set the value of AX as 01H. MOV CX,X

More information

UNIT II ASSEMBLERS www.noyesengine.com www.technoscriptz.com 1 1. BASIC ASSEMBLER FUNCTIONS 2. A SIMPLE SIC ASSEMBLER 3. ASSEMBLER ALGORITHM AND DATA STRUCTURES 4. MACHINE DEPENDENT ASSEMBLER FEATURES

More information

CS2422 Assembly Language & System Programming

CS2422 Assembly Language & System Programming CS2422 Assembly Language & System Programming November 30, 2006 Today s Topic Assembler: Basic Functions Section 2.1 of Beck s System Software book. Reading Assignment: pages 43-52. Role of Assembler Source

More information

Assemblers. System Software by Leland L. Beck. Chapter 2

Assemblers. System Software by Leland L. Beck. Chapter 2 Assemblers System Software by Leland L. Beck Chapter 2 1 Role of Assembler Source Program Assembler Object Code Linker Executable Code Loader 2 Chapter 2 -- Outline Basic Assembler Functions Machine-dependent

More information

2.1. Basic Assembler Functions:

2.1. Basic Assembler Functions: 2.1. Basic Assembler Functions: The basic assembler functions are: Translating mnemonic language code to its equivalent object code. Assigning machine addresses to symbolic labels. SOURCE PROGRAM ASSEMBLER

More information

Gechstudentszone.wordpress.com

Gechstudentszone.wordpress.com CHAPTER -2 2.1 Basic Assembler Functions: The basic assembler functions are: ASSEMBLERS-1 Translating mnemonic language code to its equivalent object code. Assigning machine addresses to symbolic labels.

More information

CSI 402 Lecture 5 (Assemblers Continued) 5 1 / 18

CSI 402 Lecture 5 (Assemblers Continued) 5 1 / 18 CSI 402 Lecture 5 (Assemblers Continued) 5 1 / 18 Program Relocation Example 1: Consider the SIC instruction LDA THREE Assume the following: The START directive specifies the value 100 (decimal) The LC

More information

UNIT 1: MACHINE ARCHITECTURE

UNIT 1: MACHINE ARCHITECTURE VTU QUESTION PAPER SOLUTION UNIT 1: MACHINE ARCHITECTURE 1. a) Give the target address generated for the following machine instruction: (i) 032600h (ii) 03C300h (iii) 0310C303h if (B)=006000, (PC)=003000,

More information

Chapter 2 Assemblers Machine-Dependent Assembler Features

Chapter 2 Assemblers Machine-Dependent Assembler Features Chapter 2 Assemblers -- 2.2 Machine-Dependent Assembler Features Outline Instruction format and addressing mode Program relocation Instruction format and addressing mode PC-relative or Base-relative addressing

More information

Chapter 2. Assembler Design

Chapter 2. Assembler Design Chapter 2 Assembler Design Assembler is system software which is used to convert an assembly language program to its equivalent object code. The input to the assembler is a source code written in assembly

More information

國立嘉義大學資訊工程學系系統程式期中考考卷

國立嘉義大學資訊工程學系系統程式期中考考卷 國立嘉義大學資訊工程學系系統程式期中考考卷 學號 : 姓名 : 1. Please write the content in the lines. (25%) PROGB START EXTDEF B1, B2 EXTREF A1 LDA B1 +LDA A1 STA B1 +STA A1 B1 WORD 7 BUF RESB 1 B2 RESW 1 MAX EQU 1 END H^PROGA^^

More information

By: Bhargavi Goswami Assistant Professor Sunshine Group of Institutions Rajkot, Gujarat, India. Mob:

By: Bhargavi Goswami Assistant Professor Sunshine Group of Institutions Rajkot, Gujarat, India.   Mob: Linkers By: Bhargavi Goswami Assistant Professor Sunshine Group of Institutions Rajkot, Gujarat, India. Email: bhargavigoswami@gmail.com Mob: +918140099018 Steps for Execution: Performed By: Translator

More information

UNIT I - INTRODUCTION

UNIT I - INTRODUCTION UNIT I - INTRODUCTION 1. Define system software. It consists of variety of programs that supports the operation of the computer. This software makes it possible for the user to focus on the other problems

More information

Unit 2 -- Outline. Basic Assembler Functions Machine-dependent Assembler Features Machine-independent Assembler Features Assembler Design Options

Unit 2 -- Outline. Basic Assembler Functions Machine-dependent Assembler Features Machine-independent Assembler Features Assembler Design Options Unit 2 -- Outline Basic Assembler Functions Machine-dependent Assembler Features Machine-independent Assembler Features Assembler Design Options Introduction to Assemblers Fundamental functions translating

More information

AS-2883 B.Sc.(Hon s)(fifth Semester) Examination,2013 Computer Science (PCSC-503) (System Software) [Time Allowed: Three Hours] [Maximum Marks : 30]

AS-2883 B.Sc.(Hon s)(fifth Semester) Examination,2013 Computer Science (PCSC-503) (System Software) [Time Allowed: Three Hours] [Maximum Marks : 30] AS-2883 B.Sc.(Hon s)(fifth Semester) Examination,2013 Computer Science (PCSC-503) (System Software) [Time Allowed: Three Hours] [Maximum Marks : 30] Note: Question Number 1 is compulsory. Marks : 10X1

More information

CS2304-SYSTEM SOFTWARE 2 MARK QUESTION & ANSWERS. UNIT I INTRODUCTION

CS2304-SYSTEM SOFTWARE 2 MARK QUESTION & ANSWERS. UNIT I INTRODUCTION CS2304-SYSTEM SOFTWARE 2 MARK QUESTION & ANSWERS. UNIT I INTRODUCTION 1. Define System Software. System software consists of a variety of programs that supports the operations of a computer. Eg. Compiler,

More information

CS2422 Assembly Language & System Programming

CS2422 Assembly Language & System Programming CS2422 Assembly Language & System Programming December 7, 2006 Today s Topic Assembler: Machine Dependent Features SIC/XE Program Relocation Modification Records in an Object File. Study Guide Sections

More information

UNIT 1: MACHINE ARCHITECTURE

UNIT 1: MACHINE ARCHITECTURE VTU QUESTION PAPER SOLUTION UNIT 1: MACHINE ARCHITECTURE 1. Give the target address generated for the following machine instruction: (i) 032600h (ii) 03C300h (iii) 0310C303h if (B)=006000, (PC)=003000,

More information

Compile: compiler. Load: loader. compiler linker loader memory. source object load code module module 2

Compile: compiler. Load: loader. compiler linker loader memory. source object load code module module 2 Part III Storage Management Chapter 8: Memory Management Fall 2010 1 Address Generation Address generation has three stages: Compile: compiler Link: linker or linkage editor Load: loader compiler linker

More information

Gechstudentszone.wordpress.com

Gechstudentszone.wordpress.com UNIT - 1 MACHINE ARCHITECTURE 11 Introduction: The Software is set of instructions or programs written to carry out certain task on digital computers It is classified into system software and application

More information

Systems Programming Assemblers Part 4 Control Sections

Systems Programming Assemblers Part 4 Control Sections Systems Programming Assemblers Part 4 Control Sections Prof. Dr. Hani Mahdi Department of Computer Science Al-Isra University, Amman, Jordan 1 1 Control Sections A Control Section is a part of the program

More information

INTERNAL TEST (SCHEME AND SOLUTION)

INTERNAL TEST (SCHEME AND SOLUTION) PES Institute of Technology, Bangalore South Campus (Formerly PES School of Engineering) (Hosur Road, 1KM before Electronic City, Bangalore-560 100) Dept of MCA INTERNAL TEST (SCHEME AND SOLUTION) 1 Subject

More information

DHANALAKSHMI SRINIVASAN INSTITUTE OF RESEARCH AND TECHNOLOGY SIRUVACHUR, PERAMBALUR DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

DHANALAKSHMI SRINIVASAN INSTITUTE OF RESEARCH AND TECHNOLOGY SIRUVACHUR, PERAMBALUR DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING DHANALAKSHMI SRINIVASAN INSTITUTE OF RESEARCH AND TECHNOLOGY SIRUVACHUR, PERAMBALUR 621113. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING CS2304- SYSTEM SOFTWARE PART-B QUESTIONS 1. EXPLAIN THE ARCHITECTURE

More information

Introduction SIC, RISC & CISC 0. Introduction to Systems Programming This course aims at: Understanding what is going on behind the scenes The design and implementation of system software, such as Assemblers

More information

Chapter 1. Introduction

Chapter 1. Introduction Chapter 1 Introduction This Chapter gives you System Software & Machine Architecture The Simplified Instructional Computer SIC and SIC/XE Traditional (CISC) Machines - Complex Instruction Set Computers

More information

From Code to Program: CALL Con'nued (Linking, and Loading)

From Code to Program: CALL Con'nued (Linking, and Loading) ecture 13 Computer Science 61C Spring 2017 February 15th, 2017 From Code to Program: CALL Con'nued (Linking, and Loading) 1 Administrivia We know it still sucks but: Waitlist students: Please be patient.

More information

PESIT Bangalore South Campus Department of MCA Course Information for. System Programming (13MCA24)

PESIT Bangalore South Campus Department of MCA Course Information for. System Programming (13MCA24) PESIT Bangalore South Campus Department of MCA Course Information for System Programming (13MCA24) 1.GENERAL INFORMATION Academic Year: 2015 Semester(s): 2 nd Title Code Duration (hrs) Lectures 48 Hrs

More information

CSCI341. Lecture 22, MIPS Programming: Directives, Linkers, Loaders, Memory

CSCI341. Lecture 22, MIPS Programming: Directives, Linkers, Loaders, Memory CSCI341 Lecture 22, MIPS Programming: Directives, Linkers, Loaders, Memory REVIEW Assemblers understand special commands called directives Assemblers understand macro commands Assembly programs become

More information

Chapter 1: Background

Chapter 1: Background Chapter 1: Background Hsung-Pin Chang Department of Computer Science National Chung Hsing University Outline 1.1 Introduction 1.2 System Software and Machine Architecture 1.3 The Simplified Instructional

More information

MODULE 5 LINKERS AND LOADERS

MODULE 5 LINKERS AND LOADERS MODULE 5 LINKERS AND LOADERS Execution phases The execution of a program involves 4 steps:- 1) Translation Converting source program to object modules. The assemblers and compilers fall under the category

More information

COMPILERS BASIC COMPILER FUNCTIONS

COMPILERS BASIC COMPILER FUNCTIONS COMPILERS BASIC COMPILER FUNCTIONS A compiler accepts a program written in a high level language as input and produces its machine language equivalent as output. For the purpose of compiler construction,

More information

CS 61C: Great Ideas in Computer Architecture CALL continued ( Linking and Loading)

CS 61C: Great Ideas in Computer Architecture CALL continued ( Linking and Loading) CS 61C: Great Ideas in Computer Architecture CALL continued ( Linking and Loading) Instructors: Nicholas Weaver & Vladimir Stojanovic http://inst.eecs.berkeley.edu/~cs61c/sp16 1 Where Are We Now? 2 Linker

More information

Chapter 9 Memory Management Main Memory Operating system concepts. Sixth Edition. Silberschatz, Galvin, and Gagne 8.1

Chapter 9 Memory Management Main Memory Operating system concepts. Sixth Edition. Silberschatz, Galvin, and Gagne 8.1 Chapter 9 Memory Management Main Memory Operating system concepts. Sixth Edition. Silberschatz, Galvin, and Gagne 8.1 Chapter 9: Memory Management Background Swapping Contiguous Memory Allocation Segmentation

More information

CSE 4/521 Introduction to Operating Systems. Lecture 12 Main Memory I (Background, Swapping) Summer 2018

CSE 4/521 Introduction to Operating Systems. Lecture 12 Main Memory I (Background, Swapping) Summer 2018 CSE 4/521 Introduction to Operating Systems Lecture 12 Main Memory I (Background, Swapping) Summer 2018 Overview Objective: 1. To provide a detailed description of various ways of organizing memory hardware.

More information

Chapter 8: Memory Management. Operating System Concepts with Java 8 th Edition

Chapter 8: Memory Management. Operating System Concepts with Java 8 th Edition Chapter 8: Memory Management 8.1 Silberschatz, Galvin and Gagne 2009 Background Program must be brought (from disk) into memory and placed within a process for it to be run Main memory and registers are

More information

Chapter 9 Memory Management

Chapter 9 Memory Management Contents 1. Introduction 2. Computer-System Structures 3. Operating-System Structures 4. Processes 5. Threads 6. CPU Scheduling 7. Process Synchronization 8. Deadlocks 9. Memory Management 10. Virtual

More information

Memory Management. Reading: Silberschatz chapter 9 Reading: Stallings. chapter 7 EEL 358

Memory Management. Reading: Silberschatz chapter 9 Reading: Stallings. chapter 7 EEL 358 Memory Management Reading: Silberschatz chapter 9 Reading: Stallings chapter 7 1 Outline Background Issues in Memory Management Logical Vs Physical address, MMU Dynamic Loading Memory Partitioning Placement

More information

Compiler, Assembler, and Linker

Compiler, Assembler, and Linker Compiler, Assembler, and Linker Minsoo Ryu Department of Computer Science and Engineering Hanyang University msryu@hanyang.ac.kr What is a Compilation? Preprocessor Compiler Assembler Linker Loader Contents

More information

Memory Management (1) Memory Management

Memory Management (1) Memory Management EECS 3221 Operating System Fundamentals No.8 Memory Management (1) Prof. Hui Jiang Dept of Electrical Engineering and Computer Science, York University Memory Management A program usually resides on a

More information

Memory Management (1) Memory Management. CPU vs. memory. No.8. Prof. Hui Jiang Dept of Electrical Engineering and Computer Science, York University

Memory Management (1) Memory Management. CPU vs. memory. No.8. Prof. Hui Jiang Dept of Electrical Engineering and Computer Science, York University EECS 3221 Operating System Fundamentals No.8 Memory Management (1) Prof. Hui Jiang Dept of Electrical Engineering and Computer Science, York University Memory Management A program usually resides on a

More information

Chapter 1 Background. Professor Gwan-Hwan Hwang Dept. Computer Science and Information Engineering National Taiwan Normal University

Chapter 1 Background. Professor Gwan-Hwan Hwang Dept. Computer Science and Information Engineering National Taiwan Normal University Chapter 1 Background Professor Gwan-Hwan Hwang Dept. Computer Science and Information Engineering National Taiwan Normal University 9/17/2009 1 Outlines 1.1 Introduction 1.2 System Software and Machine

More information

12: Memory Management

12: Memory Management 12: Memory Management Mark Handley Address Binding Program goes through multiple steps from compilation to execution. At some stage, addresses in the program must be bound to physical memory addresses:

More information

UNIT II ASSEMBLERS. Figure Assembler

UNIT II ASSEMBLERS. Figure Assembler 2.1 Basic assembler functions UNIT II ASSEMBLERS Assembler Assembler which converts assembly language programs into object files. Object files contain a combination of machine instructions, data, and information

More information

Operating Systems. Designed and Presented by Dr. Ayman Elshenawy Elsefy

Operating Systems. Designed and Presented by Dr. Ayman Elshenawy Elsefy Operating Systems Designed and Presented by Dr. Ayman Elshenawy Elsefy Dept. of Systems & Computer Eng.. AL-AZHAR University Website : eaymanelshenawy.wordpress.com Email : eaymanelshenawy@yahoo.com Reference

More information

Main Memory (Part I)

Main Memory (Part I) Main Memory (Part I) Amir H. Payberah amir@sics.se Amirkabir University of Technology (Tehran Polytechnic) Amir H. Payberah (Tehran Polytechnic) Main Memory 1393/8/5 1 / 47 Motivation and Background Amir

More information

From Source to Execution:

From Source to Execution: From Source to Execution: Translation and Linking CSE 410, Spring 2009 Computer Systems http://www.cs.washington.edu/410 4/16/2009 cse410-08-link 2006-09 Perkins, DW Johnson and University of Washington

More information

Memory Management. CSCI 315 Operating Systems Design Department of Computer Science

Memory Management. CSCI 315 Operating Systems Design Department of Computer Science Memory Management CSCI 315 Operating Systems Design Department of Computer Science Notice: The slides for this lecture are based on those from Operating Systems Concepts, 9th ed., by Silberschatz, Galvin,

More information

Memory Management 9th Week

Memory Management 9th Week Department of Electrical Engineering and Information Technology Faculty of Engineering Universitas Gadjah Mada, Indonesia Operating System - TIF 206 Memory Management 9th Week Sunu Wibirama Copyright 2011

More information

Building a Runnable Program and Code Improvement. Dario Marasco, Greg Klepic, Tess DiStefano

Building a Runnable Program and Code Improvement. Dario Marasco, Greg Klepic, Tess DiStefano Building a Runnable Program and Code Improvement Dario Marasco, Greg Klepic, Tess DiStefano Building a Runnable Program Review Front end code Source code analysis Syntax tree Back end code Target code

More information

Introduction. Linking, which combines two or more separate object programs and supplies the information needed to allow references between them.

Introduction. Linking, which combines two or more separate object programs and supplies the information needed to allow references between them. Index 1. Introduction 2. Functions of Loader 3. Translation & Linking of Program 4. Loading And Linking Scheme -Link-And-Go -Link-Load-And-Go 5. Difference Between Link-And-Go & Link-Load-And-Go 1 Introduction

More information

Background. Contiguous Memory Allocation

Background. Contiguous Memory Allocation Operating System Lecture 8 2017.5.9 Chapter 8 (Main Memory) Background Swapping Contiguous Memory Allocation Segmentation - Paging Memory Management Selection of a memory-management method for a specific

More information

Machine dependent Assembler Features

Machine dependent Assembler Features Machine dependent Assembler Features Assembler Features Machine Dependent Assembler Features Instruction formats and addressing modes (SIC/XE) Program relocation Machine Independent Assembler Features

More information

Memory Management. Frédéric Haziza Spring Department of Computer Systems Uppsala University

Memory Management. Frédéric Haziza Spring Department of Computer Systems Uppsala University Memory Management Frédéric Haziza Department of Computer Systems Uppsala University Spring 2008 Operating Systems Process Management Memory Management Storage Management Compilers Compiling

More information

Language Translation. Compilation vs. interpretation. Compilation diagram. Step 1: compile. Step 2: run. compiler. Compiled program. program.

Language Translation. Compilation vs. interpretation. Compilation diagram. Step 1: compile. Step 2: run. compiler. Compiled program. program. Language Translation Compilation vs. interpretation Compilation diagram Step 1: compile program compiler Compiled program Step 2: run input Compiled program output Language Translation compilation is translation

More information

CS1203-SYSTEM SOFTWARE UNIT I-INTRODUCTION

CS1203-SYSTEM SOFTWARE UNIT I-INTRODUCTION CS1203-SYSTEM SOFTWARE UNIT I-INTRODUCTION 1. Define system software. It consists of variety of programs that supports the operation of the computer. This software makes it possible for the user to focus

More information

PESIT SOUTHCAMPUS 10CS52: SYSTEM SOFTWARE QUESTION BANK

PESIT SOUTHCAMPUS 10CS52: SYSTEM SOFTWARE QUESTION BANK CS52: SYSTEM SOFTWARE QUESTION BANK Chapter1: MACHINE ARCHITECTURE OBJECTIVE: Main Objective is to Know about the system software and architecture of Various Machines Like SIC, SIC/XE and Programming examples

More information

Administrivia. Deadlock Prevention Techniques. Handling Deadlock. Deadlock Avoidance

Administrivia. Deadlock Prevention Techniques. Handling Deadlock. Deadlock Avoidance Administrivia Project discussion? Last time Wrapped up deadlock Today: Start memory management SUNY-BINGHAMTON CS35 SPRING 8 LEC. #13 1 Handling Deadlock Deadlock Prevention Techniques Prevent hold and

More information

ECE260: Fundamentals of Computer Engineering

ECE260: Fundamentals of Computer Engineering ECE260: Fundamentals of Computer Engineering Translation of High-Level Languages James Moscola Dept. of Engineering & Computer Science York College of Pennsylvania ECE260: Fundamentals of Computer Engineering

More information

M2 Instruction Set Architecture

M2 Instruction Set Architecture M2 Instruction Set Architecture Module Outline Addressing modes. Instruction classes. MIPS-I ISA. Translating and starting a program. High level languages, Assembly languages and object code. Subroutine

More information

Memory Management II

Memory Management II Memory Management II an OS view Dr Alun Moon Computing, Engineering and Information Sciences 1st November 2011 Dr Alun Moon (ceis:nu) Memory Management II 1st November 2011 1 / 16 Processes in memory Memory

More information

CS420: Operating Systems

CS420: Operating Systems Main Memory James Moscola Department of Engineering & Computer Science York College of Pennsylvania Based on Operating System Concepts, 9th Edition by Silberschatz, Galvin, Gagne Background Program must

More information

CIT 595 Spring System Software: Programming Tools. Assembly Process Example: First Pass. Assembly Process Example: Second Pass.

CIT 595 Spring System Software: Programming Tools. Assembly Process Example: First Pass. Assembly Process Example: Second Pass. System Software: Programming Tools Programming tools carry out the mechanics of software creation within the confines of the operating system and hardware environment Linkers & Loaders CIT 595 Spring 2010

More information

! What is main memory? ! What is static and dynamic allocation? ! What is segmentation? Maria Hybinette, UGA. High Address (0x7fffffff) !

! What is main memory? ! What is static and dynamic allocation? ! What is segmentation? Maria Hybinette, UGA. High Address (0x7fffffff) ! Memory Questions? CSCI [4 6]730 Operating Systems Main Memory! What is main memory?! How does multiple processes share memory space?» Key is how do they refer to memory addresses?! What is static and dynamic

More information

Chapter 8 & Chapter 9 Main Memory & Virtual Memory

Chapter 8 & Chapter 9 Main Memory & Virtual Memory Chapter 8 & Chapter 9 Main Memory & Virtual Memory 1. Various ways of organizing memory hardware. 2. Memory-management techniques: 1. Paging 2. Segmentation. Introduction Memory consists of a large array

More information

CS5460/6460: Operating Systems. Lecture 21: Shared libraries. Anton Burtsev March, 2014

CS5460/6460: Operating Systems. Lecture 21: Shared libraries. Anton Burtsev March, 2014 CS5460/6460: Operating Systems Lecture 21: Shared libraries Anton Burtsev March, 2014 Recap from last time We know what linkers and loaders do Types of object files Relocatable object files (.o) Static

More information

Memory Management. Memory Management

Memory Management. Memory Management Memory Management Most demanding di aspect of an operating system Cost has dropped. Consequently size of main memory has expanded enormously. Can we say that we have enough still. Swapping in/out. Memory

More information

Review C program: foo.c Compiler Assembly program: foo.s Assembler Object(mach lang module): foo.o

Review C program: foo.c Compiler Assembly program: foo.s Assembler Object(mach lang module): foo.o CS61C L18 Running a Program I (1) inst.eecs.berkeley.edu/~cs61c UC Berkeley CS61C : Machine Structures Lecture 19 Running a Program II aka Compiling, Assembling, Linking, Loading 2006-10-11 (aka 2006-0xB)

More information

Introduction. Chapter 4 Macro Processors -- Basic Macro Processor Functions. Macro expansion. Basic macro processor functions

Introduction. Chapter 4 Macro Processors -- Basic Macro Processor Functions. Macro expansion. Basic macro processor functions Introduction Chapter 4 Macro Processors -- Basic Macro Processor Functions Amacroinstruction(macro)isanotational convenience for the programmer Itallowstheprogrammertowriteshorthandversionofaprogram (module

More information

Lec 13: Linking and Memory. Kavita Bala CS 3410, Fall 2008 Computer Science Cornell University. Announcements

Lec 13: Linking and Memory. Kavita Bala CS 3410, Fall 2008 Computer Science Cornell University. Announcements Lec 13: Linking and Memory Kavita Bala CS 3410, Fall 2008 Computer Science Cornell University PA 2 is out Due on Oct 22 nd Announcements Prelim Oct 23 rd, 7:30-9:30/10:00 All content up to Lecture on Oct

More information

(Extract from the slides by Terrance E. Boult

(Extract from the slides by Terrance E. Boult What software engineers need to know about linking and a few things about execution (Extract from the slides by Terrance E. Boult http://vast.uccs.edu/~tboult/) A Simplistic Program Translation Scheme

More information

Review C program: foo.c Compiler Assembly program: foo.s Assembler Object(mach lang module): foo.o

Review C program: foo.c Compiler Assembly program: foo.s Assembler Object(mach lang module): foo.o CS61C L18 Running a Program I (1) inst.eecs.berkeley.edu/~cs61c UC Berkeley CS61C : Machine Structures Lecture 19 Running a Program II aka Compiling, Assembling, Linking, Loading 2007-03-02 Lecturer SOE

More information

TRB-COMPUTER INSTRUCTOR COMPUTER SCIENCE UNIT IV. SYSTEM SOFTWARE 10% DISCOUNT FOR ALL PGTRB MATERIALS WITH QUESTION BANK.

TRB-COMPUTER INSTRUCTOR COMPUTER SCIENCE UNIT IV.  SYSTEM SOFTWARE 10% DISCOUNT FOR ALL PGTRB MATERIALS WITH QUESTION BANK. N COACHING CENTRE-TRICHY- TRB- COMPUTER INSTRUCTOR-COMPUTER SCIENCE STUDY MATERIAL-CONTACT: 822006 2017 N TRB-COMPUTER INSTRUCTOR COMPUTER SCIENCE UNIT IV SYSTEM SOFTWARE 10% DISCOUNT FOR ALL PGTRB MATERIALS

More information

CHAPTER 8: MEMORY MANAGEMENT. By I-Chen Lin Textbook: Operating System Concepts 9th Ed.

CHAPTER 8: MEMORY MANAGEMENT. By I-Chen Lin Textbook: Operating System Concepts 9th Ed. CHAPTER 8: MEMORY MANAGEMENT By I-Chen Lin Textbook: Operating System Concepts 9th Ed. Chapter 8: Memory Management Background Swapping Contiguous Memory Allocation Segmentation Paging Structure of the

More information

CS399 New Beginnings. Jonathan Walpole

CS399 New Beginnings. Jonathan Walpole CS399 New Beginnings Jonathan Walpole Memory Management Memory Management Memory a linear array of bytes - Holds O.S. and programs (processes) - Each cell (byte) is named by a unique memory address Recall,

More information

EE 5340/7340 Motorola 68HC11 Microcontroler Lecture 1. Carlos E. Davila, Electrical Engineering Dept. Southern Methodist University

EE 5340/7340 Motorola 68HC11 Microcontroler Lecture 1. Carlos E. Davila, Electrical Engineering Dept. Southern Methodist University EE 5340/7340 Motorola 68HC11 Microcontroler Lecture 1 Carlos E. Davila, Electrical Engineering Dept. Southern Methodist University What is Assembly Language? Assembly language is a programming language

More information

3. Memory Management

3. Memory Management Principles of Operating Systems CS 446/646 3. Memory Management René Doursat Department of Computer Science & Engineering University of Nevada, Reno Spring 2006 Principles of Operating Systems CS 446/646

More information

Assembly Language Programming Linkers

Assembly Language Programming Linkers Assembly Language Programming Linkers November 14, 2017 Placement problem (relocation) Because there can be more than one program in the memory, during compilation it is impossible to forecast their real

More information

Lecture 2 - Fundamental Concepts

Lecture 2 - Fundamental Concepts Lecture 2 - Fundamental Concepts Instructor : Bibhas Ghoshal (bibhas.ghoshal@iiita.ac.in) Autumn Semester, 2015 Bibhas Ghoshal IOSY 332C & IOPS 332C: OS Autumn Semester, 2015 1 / 43 Lecture Outline Operating

More information

Chapter 8: Memory- Management Strategies. Operating System Concepts 9 th Edition

Chapter 8: Memory- Management Strategies. Operating System Concepts 9 th Edition Chapter 8: Memory- Management Strategies Operating System Concepts 9 th Edition Silberschatz, Galvin and Gagne 2013 Chapter 8: Memory Management Strategies Background Swapping Contiguous Memory Allocation

More information

Outline. Unresolved references

Outline. Unresolved references Outline CS 4120 Introduction to Compilers Andrew Myers Cornell University Lecture 36: Linking and Loading 21 Nov 11 Static linking Object files Libraries Shared libraries Relocatable Dynamic linking explicit

More information

Chapter 8: Main Memory

Chapter 8: Main Memory Chapter 8: Main Memory Chapter 8: Memory Management Background Swapping Contiguous Memory Allocation Segmentation Paging Structure of the Page Table Example: The Intel 32 and 64-bit Architectures Example:

More information

CS370 Operating Systems

CS370 Operating Systems CS370 Operating Systems Colorado State University Yashwant K Malaiya Spring 2018 L16 Deadlocks, Main Memory Slides based on Text by Silberschatz, Galvin, Gagne Various sources 1 1 Where we are: Deadlocks

More information

MIPS (SPIM) Assembler Syntax

MIPS (SPIM) Assembler Syntax MIPS (SPIM) Assembler Syntax Comments begin with # Everything from # to the end of the line is ignored Identifiers are a sequence of alphanumeric characters, underbars (_), and dots () that do not begin

More information

Chapter 8: Memory-Management Strategies

Chapter 8: Memory-Management Strategies Chapter 8: Memory-Management Strategies Chapter 8: Memory Management Strategies Background Swapping Contiguous Memory Allocation Segmentation Paging Structure of the Page Table Example: The Intel 32 and

More information

Amiga Binary File Structure

Amiga Binary File Structure Amiga Binary File Structure Compiled by Paul René Jørgensen, paulrene@gmail.com The information in this document is 1991 by Commodore Electronics Ltd 1990 Mikael Karlsson 2005 Paul Rene Jørgensen Last

More information

Assembler Design Options

Assembler Design Options Assembler Design Options One and Multi-Pass Assembler So far, we have presented the design and implementation of a two-pass assembler. Here, we will present the design and implementation of One-pass assembler

More information

COMPILING OBJECTS AND OTHER LANGUAGE IMPLEMENTATION ISSUES. Credit: Mostly Bryant & O Hallaron

COMPILING OBJECTS AND OTHER LANGUAGE IMPLEMENTATION ISSUES. Credit: Mostly Bryant & O Hallaron COMPILING OBJECTS AND OTHER LANGUAGE IMPLEMENTATION ISSUES Credit: Mostly Bryant & O Hallaron Word-Oriented Memory Organization Addresses Specify Byte Locations Address of first byte in word Addresses

More information