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

Size: px
Start display at page:

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

Transcription

1 Subject Name: System Software Subject Code: 10CS52 Prepared By : Ms. Sanchari Saha ( Asst. Professor) Department : Computer Science & Engineering Date :

2 UNIT-4 LOADERS & LINKERS Engineered for Tomorrow Prepared by- Sanchari Saha, Assistant Professor, Dept of CSE, MVJCE

3 Topic Details 1) Basic Loader Functions - Design of an Absolute Loader 2) A Simple Bootstrap Loader 3) Machine-Dependent Loader Features Relocation, Program Linking, Algorithm and Data Structures for a Linking Loader 4) Machine-Independent Loader Features - Automatic Library Search, Loader Options, 5) Loader Design Options - Linkage Editor, Dynamic Linkage, Bootstrap Loaders, 6) Implementation Examples - MS-DOS Linker. 7) Chapter Summary 8) Self-check exercise

4 Learning Outcome: Students will understand:- The basic functionality of loaders & linkers Relationship between linking & relocation Working principle of Bootstrap loader, absolute loader Implementation example-ms-dos linker

5 1. Basic Loader Functions - Design of an Absolute Loader Engineered for Tomorrow

6 1.1 Three Working Items Loading: loading an object program into memory for execution. Relocation: modify the object program so that it can be loaded at an address from the location originally specified. Linking: combines two or more separate object programs and supplies the information needed to allow references between them. A loader is a system program that performs the loading function. Many loaders also support relocation and linking. Some systems have a linker to perform the linking and a separate loader to handle relocation and loading.

7 1.2 Design of an Absolute Loader An object program is loaded at the address specified on the START directive. No relocation or linking is needed, thus is very simple

8

9 1.3 Absolute loader implementation 14 occupies two bytes if it is represented in char form. When loaded into memory, 14 should occupy only one byte.

10 2. A Simple Bootstrap Loader Engineered for Tomorrow

11 Bootstrap Loader: When a computer is first turned on or restarted, a special type of absolute loader must be executed (stored in ROM on a PC). The bootstrap loader loads the first program to be run by the computer usually the operating system, from the boot disk (e.g., a hard disk or a floppy disk) It then jumps to the just loaded program to execute it. Normally, the just loaded program is very small (e.g., a disk sector s size, 512 bytes) and is a loader itself. The just loaded loader will continue to load another larger loader and jump to it. This process repeats another the entire large operating system is loaded. The just loaded loader will continue to load another larger loader and jump to it. This process repeats another the entire large operating system is loaded

12 Bootstrap Loader Example Convert 14 in char form to 14 in byte form

13 Bootstrap Loader Example Convert 1 in char form to 1 in its ASCII code

14 3. Machine Dependent Loader Features Engineered for Tomorrow

15 3.1 Relocating Loader Two methods to describe where in the object program to modify the address (add the program starting address) Use modification records Suitable for a small number of changes Use relocation bit mask Suitable for a large number of changes

16 Program Written in SIC/XE

17

18 This program is written in SIC/XE instructions. Program counterrelative and base-relative addressing are extensively used to avoid the need for many address modification records.

19 The Object Program Only lines 15, 35, and 65 need to be modified.

20 The Same Program Written in SIC

21

22 This program is written in SIC instructions. Only direct addressing can be used. As such, we need many modification records. This not only makes the object program bigger, it also slows down the loading process.

23 Relocation Bit Mask If an object needs too many modification records, it would be more efficient to use a relocation bit mask to indicate where in the object program should be modified when the object program is loaded. A relocation bit is associated with each word of object code. Since all SIC instructions occupy one word, this means that there is one relocation bit for each possible instruction. If the relocation bit corresponding to a word of object code is set to 1, the program s starting address will be added to this word when the program is relocated.

24 Relocation Bit Mask Example This one-byte F1 makes the LDX instruction on line 210 begins a new text record. This is because each relocation bit should be associated with a three-byte word. However, this data item occupies only one byte, which violates the Alignment rule.

25 Program Linking A program may be composed of many control sections. These control sections may be assembled separately. These control sections may be loaded at different addresses in memory. External references to symbol defined in other control sections can only be resolved (calculating their addresses in memory) after these control sections are loaded into memory.

26 Program Linking Example

27

28

29 Object Program Example

30

31

32 After Loading into Memory Suppose that program A is loaded at , program B at , and program C at 0040E2. Notice that REF4, REF5, REF6, and REF7 in all of these three programs have the same values.

33

34 Algorithm & Data Structure A linking loader makes two passes over its input In pass 1: assign addresses to external references In pass 2: perform the actually loading, relocation, and linking Very similar to what a two-pass assembler does.

35 Data Structures External symbol tables (ESTAB) Like SYMTAB, store the name and address of each external symbol in the set of control sections being loaded. It needs to indicate in which control section the symbol is defined. PROGADDR The beginning address in memory where the linked program is to be loaded. (given by the OS) CSADDR It contains the starting address assigned to the control section currently being scanned by the loader. This value is added to all relative addresses within the control sections.

36

37

38 Reference Number The linking loader algorithm can be made more efficient if we assign a reference number to each external symbol referred to in a control section. This reference number is used (instead of the symbol name) in modification record. This simple technique avoid multiple searches of ESTAB for the same symbol during the loading of a control section. After the first search for a symbol (the REFER records), we put the found entries into an array. Later in the same control section, we can just use the reference number as an index into the array to quickly fetch a symbol s value.

39 Reference Number Example Reference number 01 is reserved for the current control section name. All other reference numbers start from 02.

40 Reference Number Example

41 Reference Number Example

42 Reference Number Example

43 4. Machine Independent Features Engineered for Tomorrow

44 Automatic Library Search Many linking loaders can automatically incorporate routines from a subprogram library into the program being loaded. (E.g., the standard C library) The subroutines called by the program are automatically fetched from the library, linked with the main program, and loaded. The programmer does not need to take any action beyond mentioning the subroutine names as external references in the source program

45 Linking loader that support automatic library search must keep track of external symbols that are referred to, but not defined, in the primary input to the loader. At the end of pass 1, the symbols in ESTAB that remain undefined represent unresolved external references. The loader searches the library for routines that contain the definitions of these symbols, and processes the subroutines found by this search process exactly as if they had been part of the primary input stream.

46 The subroutines fetched from a library in this way may themselves contain external references. It is necessary to repeat the library search process until all references are resolved. If unresolved references remain after the library search is completed, they are treated as errors. If a symbol (or a subroutine name) is defined both in the source program and in the library, the one in the source program is used first. A programmer can make his own library easily on UNIX by using the ar command.

47 Loader Options Many loaders allow the user to specify options that modify the standard processing. For example: Include program-name (library name) Direct the loader to read the designated object program from a library Delete csect-name Instruct the loader to delete the named control sections from the set of programs being loaded Change name1, name2 Cause the external symbol name1 to be changed to name2 wherever it appears in the program

48 Loader Option Application In the COPY program, we write two subroutines RDREC and WRREC to perform read records and write records. Suppose that the computer system provides READ and WRITE subroutines which has similar but advanced functions. Without modifying the source program and reassembling it, we can use the following loader options to make the COPY object program use READ rather than RDREC and WRITE rather than WRREC. Include READ (Util) Include WRITE (Util) Delete RDREC, WRREC Change RDREC, READ Change WRREC, WRITE

49 Loader Design Options Linkage Editor The difference between a linkage editor and a linking loader: A linking loader performs all linking and relocation operations, including automatic library search, and loads the linked program into memory for execution. A linkage editor produces a linked version of the program, which is normally written to a file for later execution.

50 When the user is ready to run the linked program, a simple relocating loader can be used to load the program into memory. The only object code modification necessary is the addition of an actual address to relative values within the program. The linkage editor performs relocation of all control sections relative to the start of the linked program.

51 All items that need to be modified at load time have values that are relative to the start of the linked program. This means that the loading can be accomplished in one pass with no external symbol table required. Thus, if a program is to be executed many times without being reassembled, the use of a linkage editor can substantially reduces the overhead required. Resolution of external references and library searching are only performed once.

52 Dynamic Linking Linkage editors perform linking before the program is loaded for execution. Linking loaders perform these same operations at load time. Dynamic linking postpones the linking function until execution time. A subroutine is loaded and linked to the test of the program when it is first called.

53 Dynamic Linking Application Dynamic linking is often used to allow several executing programs to share one copy of a subroutine or library. For example, a single copy of the standard C library can be loaded into memory. All C programs currently in execution can be linked to this one copy, instead of linking a separate copy into each object program.

54 Dynamic Linking Application In an object-oriented system, dynamic linking is often used for references to software object. This allows the implementation of the object and its method to be determined at the time the program is run. (e.g., C++) The implementation can be changed at any time, without affecting the program that makes use of the object.

55 Dynamic Linking Advantage The subroutines that diagnose errors may never need to be called at all. However, without using dynamic linking, these subroutines must be loaded and linked every time the program is run. Using dynamic linking can save both space for storing the object program on disk and in memory, and time for loading the bigger object program.

56 On PC Windows or UNIX operating systems, normally you are using (e.g., ld) a linkage editor to generate an executable program.

57 Dynamic Linking Implementation A subroutine that is to be dynamically loaded must be called via an operating system service request. This method can also be thought of as a request to a part of the loader that is kept in memory during execution of the program Instead of executing a JSUB instruction to an external symbol, the program makes a load-and-call service request to the OS. The parameter of this request is the symbolic name of the routine to be called..

58 The OS examines its internal tables to determines whether the subroutine is already loaded. If needed, the subroutine is loaded from the library. Then control is passed from the OS to the subroutine being called. When the called subroutine completes its processing, it returns to its caller (operating system). The OS then returns control to the program that issues the request. After the subroutine is completed, the memory that was allocated to it may be released.

59 However, often this is not done immediately. If the subroutine is retained in memory, it can be used by later calls to the same subroutine without loading the same subroutine multiple times. Control can simply pass from the dynamic loader to the called routine directly.

60 Issue a load-andcall service request Load the called subroutine into memory

61

62 Bootstrap Loaders Given an idle computer with no program in memory, how do we get things started? With the machine empty and idle, there is no need for program relocation Some early computers required the operator to enter into memory the object code for an absolute loader, using switches on the computer console One some computer, an absolute loader program is permanently resident in a ROM A built-in hardware function that reads a fixed-length record form some device into memory at a fixed location

63 When a computer is first turned on or restarted, a special type of absolute loader must be executed (stored in ROM on a PC). The bootstrap loader loads the first program to be run by the computer usually the operating system, from the boot disk (e.g., a hard disk or a floppy disk) It then jumps to the just loaded program to execute it. Normally, the just loaded program is very small (e.g., a disk sector's size, 512 bytes) and is a loader itself. The just loaded loader will continue to load another larger loader and jump to it. This process repeats another the entire large operating system is loaded

64

65 Engineered for Tomorrow 5. Self Check Exercise

66 1) Write a sequence of instructions to set ALPHA=BETA*GAMMA 2) Write a sequence of instruction to set ALPHA to the integer portion of BETA/GAMMA 3) Write a sequence of instructions to set ALPHA=GAMMA*BETA-9 4) Write a sequence of instructions to set ALPHA=4*BETA-9 5) Write a sequence of instructions to set ALPHA=BETA+DECREMENT+1 6) Write SIC instructions to swap the values of ALPHA & BETA 7) Write a sequence of instructions in SIC/XE to add 2 arrays of 100 integers. 8) Write sequence of instructions for SIC/XE to divide BETA by GAMMA setting ALPHA to the integer portion of quotient & DELTA to the remainder 9) Write a sequence of instructions for SIC to clear 20 bytes of string to all blanks 10) Write a sequence of instructions for SIC & SIC/XE to copy the string SYSTEM SOFTWARE to another string. 11) Write a sequence of instructions for SIC to clear 20 bytes of string to all blanks using register to register instruction & immediate addressing. 12) Suppose that ALPHA is an array of 100 words. Write a sequence of instructions for SIC to set all 100 elements of the array to 0. 13) Bring out the difference between system software & application software 14) Explain the following w.r.to both SIC & SIC/XE Instruction format, addressing mode, data formats, Register organization 15) Give the target address generated for the following machine instructions: H, 03C300H, 0310C303 If B=006000, PC=003000, X=000090

67 Engineered for Tomorrow 6. Summary

68 1) Write a sequence of instructions to set ALPHA=BETA*GAMMA 2) Write a sequence of instruction to set ALPHA to the integer portion of BETA/GAMMA 3) Write a sequence of instructions to set ALPHA=GAMMA*BETA-9 4) Write a sequence of instructions to set ALPHA=4*BETA-9 5) Write a sequence of instructions to set ALPHA=BETA+DECREMENT+1 6) Write SIC instructions to swap the values of ALPHA & BETA 7) Write a sequence of instructions in SIC/XE to add 2 arrays of 100 integers. 8) Write sequence of instructions for SIC/XE to divide BETA by GAMMA setting ALPHA to the integer portion of quotient & DELTA to the remainder 9) Write a sequence of instructions for SIC to clear 20 bytes of string to all blanks 10) Write a sequence of instructions for SIC & SIC/XE to copy the string SYSTEM SOFTWARE to another string. 11) Write a sequence of instructions for SIC to clear 20 bytes of string to all blanks using register to register instruction & immediate addressing. 12) Suppose that ALPHA is an array of 100 words. Write a sequence of instructions for SIC to set all 100 elements of the array to 0. 13) Bring out the difference between system software & application software 14) Explain the following w.r.to both SIC & SIC/XE Instruction format, addressing mode, data formats, Register organization 15) Give the target address generated for the following machine instructions: H, 03C300H, 0310C303 If B=006000, PC=003000, X=000090

69 Engineered for Tomorrow END of UNIT-4

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

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 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

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

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

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

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

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

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

LOADERS AND LINKERS 1. BASIC LOADER FUNCTIONS 2. DESIGN OF AN ABSOLUTE LOADER 3. A SIMPLE BOOTSTRAP LOADER 4. MACHINE DEPENDENT LOADER FEATURES 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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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 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

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

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

CS370: Operating Systems [Spring 2017] Dept. Of Computer Science, Colorado State University

CS370: Operating Systems [Spring 2017] Dept. Of Computer Science, Colorado State University Frequently asked questions from the previous class survey CS 370: OPERATING SYSTEMS [MEMORY MANAGEMENT] Matrices in Banker s algorithm Max, need, allocated Shrideep Pallickara Computer Science Colorado

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

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

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

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

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

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

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

Typical File Extensions File Structure

Typical File Extensions File Structure CS 355 Operating Systems File Systems File Systems A file is a collection of data records grouped together for purpose of access control and modification A file system is software responsible for creating,

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

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

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

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

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

! 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

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

Addresses in the source program are generally symbolic. A compiler will typically bind these symbolic addresses to re-locatable addresses.

Addresses in the source program are generally symbolic. A compiler will typically bind these symbolic addresses to re-locatable addresses. 1 Memory Management Address Binding The normal procedures is to select one of the processes in the input queue and to load that process into memory. As the process executed, it accesses instructions and

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

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

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

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

Module 1: Introduction

Module 1: Introduction Module 1: Introduction What is an operating system? Simple Batch Systems Multiprogramming Batched Systems Time-Sharing Systems Personal-Computer Systems Parallel Systems Distributed Systems Real-Time Systems

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

PRINCIPLES OF COMPILER DESIGN UNIT I INTRODUCTION TO COMPILERS

PRINCIPLES OF COMPILER DESIGN UNIT I INTRODUCTION TO COMPILERS Objective PRINCIPLES OF COMPILER DESIGN UNIT I INTRODUCTION TO COMPILERS Explain what is meant by compiler. Explain how the compiler works. Describe various analysis of the source program. Describe the

More information

Chapter 2 Assemblers Assembler Design Options

Chapter 2 Assemblers Assembler Design Options Chapter 2 Assemblers -- 2.4 Assembler Design Options Outline One-pass assemblers Multi-pass assemblers Two-pass assembler with overlay structure Load-and-Go Assembler Load-and-go assembler generates their

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

Module 1: Introduction. What is an Operating System?

Module 1: Introduction. What is an Operating System? Module 1: Introduction What is an operating system? Simple Batch Systems Multiprogramming Batched Systems Time-Sharing Systems Personal-Computer Systems Parallel Systems Distributed Systems Real-Time Systems

More information

Computer Hardware and System Software Concepts

Computer Hardware and System Software Concepts Computer Hardware and System Software Concepts Introduction to concepts of System Software/Operating System Welcome to this course on Computer Hardware and System Software Concepts 1 RoadMap Introduction

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

Silberschatz, et al. Topics based on Chapter 13

Silberschatz, et al. Topics based on Chapter 13 Silberschatz, et al. Topics based on Chapter 13 Mass Storage Structure CPSC 410--Richard Furuta 3/23/00 1 Mass Storage Topics Secondary storage structure Disk Structure Disk Scheduling Disk Management

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

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

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

DOS. 5/1/2006 Computer System Software CS 012 BE 7th Semester 2

DOS. 5/1/2006 Computer System Software CS 012 BE 7th Semester 2 DOS File System DOS The moment we turn the computer on, the computer loads a special program called the operating system into the computer s memory which provides an environment for us to run other programs.

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

Chapter 2 Operating-System Structures

Chapter 2 Operating-System Structures This chapter will discuss the following concepts: 2.1 Operating System Services 2.2 User Operating System Interface 2.3 System Calls 2.4 System Programs 2.5 Operating System Design and Implementation 2.6

More information

Part-A QUESTION BANK UNIT-III 1. Define Dynamic Loading. To obtain better memory-space utilization dynamic loading is used. With dynamic loading, a routine is not loaded until it is called. All routines

More information

Outlook. Background Swapping Contiguous Memory Allocation Paging Structure of the Page Table Segmentation Example: The Intel Pentium

Outlook. Background Swapping Contiguous Memory Allocation Paging Structure of the Page Table Segmentation Example: The Intel Pentium Main Memory Outlook Background Swapping Contiguous Memory Allocation Paging Structure of the Page Table Segmentation Example: The Intel Pentium 2 Backgound Background So far we considered how to share

More information

System Programming Loaders and Linkers

System Programming Loaders and Linkers System Programming Loaders and Linkers Introduction: In this chapter we will understand the concept of linking and loading. As discussed earlier the source program is converted to object program by assembler.

More information

Main Memory. CISC3595, Spring 2015 X. Zhang Fordham University

Main Memory. CISC3595, Spring 2015 X. Zhang Fordham University Main Memory CISC3595, Spring 2015 X. Zhang Fordham University 1 Memory Management! Background!! Contiguous Memory Allocation!! Paging!! Structure of the Page Table!! Segmentation!! Example: The Intel Pentium

More information

CS307: Operating Systems

CS307: Operating Systems CS307: Operating Systems Chentao Wu 吴晨涛 Associate Professor Dept. of Computer Science and Engineering Shanghai Jiao Tong University SEIEE Building 3-513 wuct@cs.sjtu.edu.cn Download Lectures ftp://public.sjtu.edu.cn

More information

Introduction to OS. File Management. MOS Ch. 4. Mahmoud El-Gayyar. Mahmoud El-Gayyar / Introduction to OS 1

Introduction to OS. File Management. MOS Ch. 4. Mahmoud El-Gayyar. Mahmoud El-Gayyar / Introduction to OS 1 Introduction to OS File Management MOS Ch. 4 Mahmoud El-Gayyar elgayyar@ci.suez.edu.eg Mahmoud El-Gayyar / Introduction to OS 1 File Management Objectives Provide I/O support for a variety of storage device

More information

8086 Interrupts and Interrupt Responses:

8086 Interrupts and Interrupt Responses: UNIT-III PART -A INTERRUPTS AND PROGRAMMABLE INTERRUPT CONTROLLERS Contents at a glance: 8086 Interrupts and Interrupt Responses Introduction to DOS and BIOS interrupts 8259A Priority Interrupt Controller

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

15 Sharing Main Memory Segmentation and Paging

15 Sharing Main Memory Segmentation and Paging Operating Systems 58 15 Sharing Main Memory Segmentation and Paging Readings for this topic: Anderson/Dahlin Chapter 8 9; Siberschatz/Galvin Chapter 8 9 Simple uniprogramming with a single segment per

More information

File Directories Associated with any file management system and collection of files is a file directories The directory contains information about

File Directories Associated with any file management system and collection of files is a file directories The directory contains information about 1 File Management 2 File Directories Associated with any file management system and collection of files is a file directories The directory contains information about the files, including attributes, location

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

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

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

國立嘉義大學資訊工程學系系統程式期中考考卷 國立嘉義大學資訊工程學系系統程式期中考考卷 學號 : 姓名 : 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

General Objective:To understand the basic memory management of operating system. Specific Objectives: At the end of the unit you should be able to:

General Objective:To understand the basic memory management of operating system. Specific Objectives: At the end of the unit you should be able to: F2007/Unit6/1 UNIT 6 OBJECTIVES General Objective:To understand the basic memory management of operating system Specific Objectives: At the end of the unit you should be able to: define the memory management

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

COMPILER DESIGN LEXICAL ANALYSIS, PARSING

COMPILER DESIGN LEXICAL ANALYSIS, PARSING COMPILER DESIGN LEXICAL ANALYSIS, PARSING 1. Which of the following system program forgoes the production of object code to generate absolute machine code and load it into the Physical main storage location

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

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

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

OPERATING SYSTEMS OVERVIEW

OPERATING SYSTEMS OVERVIEW OPERATING SYSTEMS OVERVIEW Contents O.S.Functions The Evolution of O.S. Characteristics of O.S. Basic hardware elements Contents USER 1 USER 2 USER 3 USER n O.S.Components System calls O.S.Structure compiler

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

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

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

Roadmap. Tevfik Koşar. CSC Operating Systems Spring Lecture - XII Main Memory - II. Louisiana State University

Roadmap. Tevfik Koşar. CSC Operating Systems Spring Lecture - XII Main Memory - II. Louisiana State University CSC 4103 - Operating Systems Spring 2007 Lecture - XII Main Memory - II Tevfik Koşar Louisiana State University March 8 th, 2007 1 Roadmap Dynamic Loading & Linking Contiguous Memory Allocation Fragmentation

More information

CS 390 Chapter 2 Homework Solutions

CS 390 Chapter 2 Homework Solutions CS 390 Chapter 2 Homework Solutions 2.1 What is the purpose of... System calls are used by user-level programs to request a service from the operating system. 2.5 What is the purpose of... The purpose

More information

COS 318: Operating Systems

COS 318: Operating Systems COS 318: Operating Systems Overview Kai Li Computer Science Department Princeton University (http://www.cs.princeton.edu/courses/cos318/) Important Times Lectures 9/20 Lecture is here Other lectures in

More information

Topics. 2 Introduction to Common Object File Format 2-3

Topics. 2 Introduction to Common Object File Format 2-3 MSP430 Family Introduction to COFF Format Topics 2 Introduction to Common Object File Format 2-3 2.1 Sections 2-4 2.2 How the Assembler Handles Sections 2-6 2.2.1 Uninitialized Sections 2-6 2.2.2 Initialized

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

Process size is independent of the main memory present in the system.

Process size is independent of the main memory present in the system. Hardware control structure Two characteristics are key to paging and segmentation: 1. All memory references are logical addresses within a process which are dynamically converted into physical at run time.

More information