Anda di halaman 1dari 35

MODULE II MCA 303 SYSTEM SOFTWARE ADMN 2011 – ‘12

2.1 Introduction

Execution of a program written in a programming language L involves the following steps:

1. Translation of the program.

2. Linking of the program with other programs needed for its execution.

3. Relocation of the program to execute from the specific memory area allocated to it.

4. Load the program in the memory for execution.

These steps are performed by different language processors. Step 1 is performed by the
translator for language L. Steps 2 and 3 are performed by a linker while step 4 is performed by a
loader.

Data
Data

Translator Linker Loader Binary


programs

Results
Object module Binary programs

Fig: 2.1 A Schematic program execution

Fig: 2.1 contain schematic showing steps 1-4 in the execution of a program. The translator
outputs a program form called object module for the program. The linker processes a set of object
modules to produce a ready to execute program form, a Binary program. The loader loads this
program into the memory for the purpose of execution. Object modules and Binary program
forms can be stored in the form of files for repeated use.

Department of Computer Sciences and Applications, SJCET, Palai P a g e | 25


MODULE II MCA 303 SYSTEM SOFTWARE ADMN 2011 – ‘12

2.1.1 Translated, linked and load time addresses

While compiling a program P, a translator is given an origin specification for P. This is


called translated origin of P. The translator uses the value of the translated origin to perform the
memory allocation for the symbols declared in P. This results in the assignment of a translation
time address t to each symbol in the program. The execution start address or the start address of a
program is the address of the instruction from which its execution must begin. The start address
specified by the translator is the translated start address of the program.

The origin of the program may have to be changed by the linker or loader for one
of the two reasons. First, same set of translated addresses may be used by different object modules
constituting a program, for example Object modules of library routines often have the same
translated origin. Memory allocation to such programs would conflict unless their origins are
changed. Secondly an operating system may require that a program should execute from the
specific area of memory. This may require a change in origin. The change in origin leads to the
change in the execution start address and the address assigned to symbols.

The following terminologies are used to refer to the address of a program entity at
different times.

Translation time address: Address assigned by the translator.

Linked address: Address assigned by the Linker.

Load time (load) address: Address assigned by the Loader.

Translated origin: Address of the origin assumed by the Translator. This is the address specified
by the programmer in an ORIGIN statement.

Linked origin: Address of the origin assumed by the linker while producing a binary program.

Load origin: Address of the origin assumed by the loader while loading the program for
execution.

The linked and load origins may differ from the translated origin of a program due to one of the
reasons mentioned earlier.

A Sample assembly program & code is shown below to specify about the address of
program entity.

START 500

ENTRY TOTAL

EXTRN MAX, ALPHA

Department of Computer Sciences and Applications, SJCET, Palai P a g e | 26


MODULE II MCA 303 SYSTEM SOFTWARE ADMN 2011 – ‘12

READ A 500) + 09 0 540

LOOP 501)

MOVER AREG, ALPHA 518) +04 1 000

BC LT, LOOP 538) + 06 6 000

STOP

A DS 1

TOTAL DS 1

END

The translated origin of the program is 500.Translation time address of LOOP is 501.If the
program is loaded for execution in the memory area starting with the address 900.The load time
origin is 900. The load time address of LOOP would be 901.

2.2 RELOCATION AND LINKING CONCEPTS

2.2.1 Program Relocation

Let AA be the set of absolute addresses –instruction or data addresses used in the
instruction of a program P.AA=Φ implies that program P assumes its instructions and data to
occupy memory words with specific addresses. Such a program called an Address sensitive
program –contains one or more of the following:

1. Address sensitive instruction: an instruction which uses an address i.e. ai ε AA

2. Address constant: a data word which contains an address i.e. ai ε AA

Address sensitive program P can execute correctly only if the start address of the memory
area allocated to it is same as its translated origin. To execute correctly from any other memory
area, the address used in each address sensitive instruction of P must be corrected. Program
relocation is the process of modifying the addresses used in the address sensitive instructions of
the program such that the program can execute correctly from the designated area of memory.

If linked origin ≠ translated origin, relocation is performed by linker. If load origin ≠


linked origin, relocation is performed by a loader. In general linker always perform relocation

Department of Computer Sciences and Applications, SJCET, Palai P a g e | 27


MODULE II MCA 303 SYSTEM SOFTWARE ADMN 2011 – ‘12

where as loaders do not perform relocation, load origin= linked origin. Such loaders are called as
absolute loaders.

2.2.2 Object module

Object module of a program contains all the information necessary to relocate and link the
program with other programs. Object module of a program P consists of four components:

I. Header –The header contains translated origin, size and execution start address of P.

II. Program-This component contains the machine language program corresponding to P.

III. Relocation Table (RELOCTAB)- This table contains a single field Translated address is

the translated address of address sensitive instruction.

IV. Linking Table (LINKTAB): This table contains information concerning the public
definitions and external references in P. Each LINKTAB entry contains three fields:

Symbol-Symbolic name

Type—PD/EXT indicating whether public definition or external reference

Translated address: For a public definition, this is the address of the first memory word
allocated to the symbol. For external reference, it is the address of memory word which is
required to contain the address of the symbol.

Consider the assembly program,

START 500

ENTRY TOTAL

EXTRN MAX, ALPHA

READ A 500) + 09 0 540

LOOP 501)

MOVER AREG, ALPHA 518) +04 1 000

BC LT, LOOP 538) + 06 6 000

STOP

A DS 1

Department of Computer Sciences and Applications, SJCET, Palai P a g e | 28


MODULE II MCA 303 SYSTEM SOFTWARE ADMN 2011 – ‘12

TOTAL DS 1

END

Object module of the program contains the following information:

1. Translated origin=500, size=42, execution start address=500

2. Machine language instructions

3. Relocation table

500

538

4. Linking table

ALPHA EXT 518

MAX EXT 519

A PD 540

LOOP does not appear in the linking table because it is not declared as a public definition

2.3 LINKER

The process of merging many object modules to form a single machine language program
is known as linking. Linker performs the function of linking. The need for linking arises because a
program written by a programmer or its translated version does not execute on its own, without
the presence of some other programs in the computer storage. For example a high level language
like FORTRAN, COBOL contains calls on certain standard functions like SIN, COS etc. Every
time a standard function is invoked by the high level language program the control should get
transferred to the appropriate program. Linking process makes addresses of programs unknown to
each other so that such control transfers can take place during execution. In short, Linking is the
Process of binding an external reference to the correct link time address. An external reference is

Department of Computer Sciences and Applications, SJCET, Palai P a g e | 29


MODULE II MCA 303 SYSTEM SOFTWARE ADMN 2011 – ‘12

said to be unresolved until linking is performed for it. It is said to be resolved when its linking is
completed.

Fig: 2.2 Linking of a program

Output of the translator is given to the linker .Linker performs the linking of object
modules. Output of the Linker is loaded into memory for execution. Fig: 2.2 shows the process of
linking a program.

2.3.1 LINKING FOR OVERLAYS

An overlay is a part of a program which has the same load origin as some other part of the
program. Overlays are used to reduce the main memory requirement of a program.

Overlay structured Program:

Program containing overlays are referred as overlay structured program. Such programs
consist of a permanently resident portion called the root, as set of overlays. Execution begins with
loading root in the memory and given control for the purpose of execution. Other overlays are
loaded as and when needed. Loading of an overlay overwrite a previously loaded overlay with the
same load origin. This reduces the memory requirement of program. It is also makes it possible to
execute the programs whose size exceeds the amount of memory which can be allocated to them.

2.4 Program Relocatability

Department of Computer Sciences and Applications, SJCET, Palai P a g e | 30


MODULE II MCA 303 SYSTEM SOFTWARE ADMN 2011 – ‘12

The manner in which a program can be modified or can modify itself to execute from a
given load origin can be used to classify programs into the following,

1. Non relocatable programs

2. Relocatable programs

3. Self-relocating programs

2.4.1 Non relocatable program


A Non relocatable program is a program which cannot be executed in any memory area
other than the area starting on its translated origin. Non relocatability is the result of address
sensitivity of a program and lack of information concerning the address sensitive instructions in
the program. The difference between a relocatable program and a non relocatable program is the
availability of information concerning the address sensitive instructions in it. Representative
example is Hand coded machine language program.

2.4.2 Relocatable program

A Relocating program can be processed to relocate it to a desired area of memory. It


contains the Program and relevant information for relocation .Relocation information identifies
address sensitive portions of the code and indicates how they can be relocated.

2.4.3 Self relocating program

Self relocating program is a program which can perform the relocation of its own address
sensitive instructions. It contains the following two provisions for this purpose. A table of
information concerning the address sensitive instructions exists as a part of the program. Code to
perform the relocation of address sensitive instructions exists as a part of the Program. This is
called the relocating logic.

The start address of the relocating logic is specified as the execution start address of the
program. Thus the relocating logic gains control when the program is loaded in memory for
execution. It uses the load address and the information concerning the address sensitive
instructions to perform its own relocation. Execution control is now transferred to the relocated
program. A self-relocating program can execute in any area of the memory. This is important in
time sharing systems where load address of a program is different for different executions.

Department of Computer Sciences and Applications, SJCET, Palai P a g e | 31


MODULE II MCA 303 SYSTEM SOFTWARE ADMN 2011 – ‘12

Relocating

Logic
Program
Program
Program +
Data +
+
Data Data
Relocation
Relocation
Information
information

(a) (b) (c)

Fig: 2.3 Program forms and relocability: (a) Non-relocatable program (b) Relocatable program

(c) Self- relocating program.

2.5 Link and load schemes

Two basic schemes used are link and go scheme and link – load-and- go scheme.

2.5.1 Link- and- go scheme


In the link- and- go- scheme the linkage editor actually situates a program at its load
address, performs all other linking functions and passes control to it for the purpose of
execution.Fig: 2.4 represents the tasks involved in the link-load-and-go scheme.

Object
module
Ready to execute
Linkage program

Object
Editor
module

Fig: 2.4 Representation of link- and – go scheme


Department of Computer Sciences and Applications, SJCET, Palai P a g e | 32
MODULE II MCA 303 SYSTEM SOFTWARE ADMN 2011 – ‘12

Disadvantage:

1. Linkage editor needs to co- exist with the program while performing the linking tasks.

2. Storage requirements are higher.

3. Linking has to be repeated for every execution of the program.

2.5.2 Link-load-and-go scheme

This scheme requires less storage since the linkage editor constructs a ready to execute
form of the program and puts it out on the secondary medium. This ready to execute programs are
stored in the library known as phase library. For executing the program it needs to be loaded into
the main storage without any relocation. Absolut loaders are used to load this program because it
does not require any relocation of the program.

2.6 Loader

Software processor which performs some low level processing of the programs input to it
to produce a ready to execute program. It Load the program in appropriate area in the memory
when it is to be executed. It initiates the execution of the program. 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. In general it binds the program to its load time addresses.

2.6.1 Functions of loader

o Assignment of load time storage area to program

o Loading of program into the assigned area

o Relocation of the program to execute properly from load time storage area

o Linking of programs with one another

2.6.2 Different types of loader

2.6.2.1 Absolute loader


The absolute loader is the simplest and quickest as compared to the relocating loader. The
loader Performs I/O operations to load the program into the storage. It does not require any
relocation or linking of the program. Because the linkage editor constructs a ready to execute

Department of Computer Sciences and Applications, SJCET, Palai P a g e | 33


MODULE II MCA 303 SYSTEM SOFTWARE ADMN 2011 – ‘12

form of the program and puts it out on the secondary medium. Every instruction of this program is
bound at a specific load-time address. For executing the program, it needs to be loaded into the
main storage without any relocation. This task is performed by an absolute loader. The loader is
presented with the text of the program which has been linked for the designated area, load address
of the first word of the program and length of the program.

Fig: 2.5 Absolute loader

The loader Performs I/O operations to load the program into the storage. Because of its
simplicity, absolute loader can be coded in very few machine instructions. Hence not much
storage is wasted because of loaders presence in main storage. Another advantage of absolute
loader is that the program can be stored in the library in their ready to execute form. Such library
is known as phase library. Storage resident supervisor of an operating system generally contains
an absolute loader for loading various system components from the phase library. This is
explained in the fig: 2.6.

Object
module Phase library
Linkage Absolute
Editor Loader

Ready to execute
program

Department of Computer Sciences and Applications, SJCET, Palai P a g e | 34


MODULE II MCA 303 SYSTEM SOFTWARE ADMN 2011 – ‘12

Fig: 2.6 Operation of a linkage editor

Advantages

 Simple and efficient

Disadvantages

 the need for programmer to specify the actual address

 difficult to use subroutine libraries

2.6.2.2 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 until the entire large
operating system is loaded. It is a technique in which the first few instructions of program are
sufficient to bring the rest of itself into the computer from an input device. The task of bootstrap
loader is to load the necessary portion of the operating system in the main memory .The initial
address at which the bootstrap loader is to be loaded is generally the lowest (may be at 0th
location) or the highest location.

2.6.2.3 Relocating Loader

Loaders that perform the program relocation is called as relocating loaders. This loader
performs the relocation while loading the program for execution. This permits a program to be
executed in different parts of memory. Relocation of the program is possible due to the ability to
manipulate address sensitive instructions of the program. There are two methods to describe
where in the object program to modify the addresses.

1. Use modification records

It is Suitable for a small number of changes in the instruction.

2. Use 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

Department of Computer Sciences and Applications, SJCET, Palai P a g e | 35


MODULE II MCA 303 SYSTEM SOFTWARE ADMN 2011 – ‘12

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. It is suitable for a large
number of changes.

Advantages

It provides an efficient sharing of the machine with larger memory when several
independent programs are to be run together. It supports the use of subroutine libraries efficiently.

Disadvantages

There is a slight overhead in terms of delay in calculation of relative offsets.

2.6.3 Design of a Loader


Linkage editor
Source program is first assembled or compiled producing an object program. Linkage
editor Produces linked version of the program which is written to a file or library for later
execution.

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 load address to relative values within the program. The linkage editor performs
relocation of all control sections relative to the start of the linked program. 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. It
is less overhead than using a linking loader. 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. In contrast a
linking loader searches the libraries and resolves external references every time the program is
executed. Sometimes, however a program is reassembled for nearly every execution. This
situation might occur in a program development and testing environment. It also occurs when a
program is used so less frequently that that it is not worthwhile to store the assembled version in
library. In such a case it is efficient to use a linking loader which avoids the steps of writing and
reading a linked program. Figure 2.6 illustrates the functions of linkage editor.

Linked program produced by the linkage editor is generally in a form that is suitable for
processing by a relocating loader. All external references are resolved and relocation is indicated
by some mechanisms such as modification records or a bit mask. Even though all linking has been
performed, instruction concerning external references is often retained in the linked program. This
allows subsequent relinking of the program to replace control sections, modify external references
etc. If this information is not retained, the linked program cannot be reprocessed by the linkage

Department of Computer Sciences and Applications, SJCET, Palai P a g e | 36


MODULE II MCA 303 SYSTEM SOFTWARE ADMN 2011 – ‘12

editor, it can only be loaded an executed. If the active address at which the program will be loaded
is known in advance, the linkage editor can perform all needed relocation. The result is a linked
program that is an exact image of the way the program will appear in memory during execution
.But this added flexibility of being able to load the program at any location results in a slight
additional overhead for performing relocation at load time. Linkage editors can perform many
useful functions besides simply preparing an object program for execution. It can be used to build
packages of subroutines or other control sections that are generally used together. Compared to
the linking loaders, linkage editor in general tend to offer more flexibility and control when a
corresponding increase in complexity an overhead.

Fig: 2.7 Functions of linkage editor

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.

When program is used less frequently, not worthy to store the assembled version in the
library, the linking loader is used. A loader is unnecessary for interpreted languages, as the
executable code is built up into the memory of the computer.

Comparison of functions of linkage editor and linking loader is shown in the figure 2.8.

Department of Computer Sciences and Applications, SJCET, Palai P a g e | 37


MODULE II MCA 303 SYSTEM SOFTWARE ADMN 2011 – ‘12

Fig 2.8 Functions of Linking loader and Linkage Editor

Dynamic Linking

Linkage editors perform linking before the program is loaded for execution. Linking
loaders perform these same operations at load time. A subroutine is loaded and linked to the rest
of the program when it is called. It postpones the linking function until execution time. This type
of function is called dynamic linking, dynamic loading, or load on call.

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

Department of Computer Sciences and Applications, SJCET, Palai P a g e | 38


MODULE II MCA 303 SYSTEM SOFTWARE ADMN 2011 – ‘12

a separate copy into each object program. 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. Dynamic linking
also makes it possible for one object to be share by several programs.

Advantages
 The subroutines that diagnose errors may never need to be called at all.

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

 Avoids the necessity of loading the entire library for execution.

 Dynamic linking make it unnecessary for the program to know the possible set of
subroutines that might be used. The subroutine name might be treated as another input
item.

Implementation of Dynamic Linking


There are number of methods that can be used to accomplish the actual loading and
linking of a called subroutine. Routines that are 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. The figures 2.9, 2.10, 2.11, 2.12,
2.13 shows the implementation of dynamic linking.

In fig: 2.9 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.

Department of Computer Sciences and Applications, SJCET, Palai P a g e | 39


MODULE II MCA 303 SYSTEM SOFTWARE ADMN 2011 – ‘12

Fig: 2.9 Issue a load-and-call service

In fig: 2.10 The OS examines its internal tables to determine 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.

Department of Computer Sciences and Applications, SJCET, Palai P a g e | 40


MODULE II MCA 303 SYSTEM SOFTWARE ADMN 2011 – ‘12

Fig: 2.10 Load the called subroutine into library

In Fig: 2.13(a), Control is passed from operating system to the routine being called.

In Fig: 2.13(b), when the called subroutine completes its processing it returns to its caller.
The operating system then returns control to the program that issued the request. This return of
control that enables the operating system to know when the call routine has completed its
execution.

In Fig: 2.13(c), after the subroutine is called, memory allocated to load it may be released
and used for other purposes. However this is not always done immediately. Sometimes it retains
the routine in memory for later use as long as storage is not needed for other processing. If
subroutine is still in memory a second call to it may not require another load operation. Control
may be simply passed from dynamic loader to the called routine.

Load the called subroutine into library

Fig: 2.13 (a) (b) (c)

Control is returned to the loader and later The called subroutine is already
returned to the user program loaded

Department of Computer Sciences and Applications, SJCET, Palai P a g e | 41


MODULE II MCA 303 SYSTEM SOFTWARE ADMN 2011 – ‘12

2.7 Software Tool


A software tool is a system program which Interfaces a program with the entity generating
its input data or interfaces the result of a program with the entity consuming them. Figure 2.14
below shows the schematic of a software tool.

Fig: 2.14 Software Tool


Steps in the program developments are
1) Program design, coding and documentation
2) Preparation of program in machine readable form.
3) Program translation linking and loading
4) Program testing debugging
5) performance tuning
6) Reformatting the data or results of program to suit other programs.

1. Program Design and Coding


Tools used for program design and coding are Program generators and Programming
environments. A program generator generates a program which performs a set of functions
described in its specification. A programming environment supports program cooing by
incorporating awareness of the programming language syntax and semantics in the language
editor.

2. Program Entry and Editing


In this case, text editors are used as front ends tool. The editor operates in two modes
Command mode and data mode. In the command mode, it accepts user commands specifying the
editing function' to be performed. In the data mode, the user keys in the text to added to the file.

3. Program Testing and Debugging


The important parameters are the selection of test data for the program analysis of test result
to detect errors and debugging. For program testing, the selection of test data for program and
analysis of test results to detect error if any is important. User uses following software tools for
this purpose.

 Test data generators: Test data generators help the programmer in selecting test data
Department of Computer Sciences and Applications, SJCET, Palai P a g e | 42
MODULE II MCA 303 SYSTEM SOFTWARE ADMN 2011 – ‘12

 Automated test drivers: Regression testing is done through automated test drives. in this,
program correctness is verified by subjecting it to a standard set of tests after every
modification.
 Debug monitors: Helps to obtain the information about localization of error, debug
monitor is used
 Source code control: Source code control system help to keep track of modification in the
source code.

4. Enhancement of Program Performance


Two factors affect the program efficiency. These are efficiency of the algorithm and
efficiency of its coding. An optimizing compiler can improve efficiency of the code but it cannot
improve efficiency of the algorithm. Only a program designer can improve efficiency of an
algorithm by rewriting it.

5. Program Documentation
Most programming projects suffer from lack of up to date documentation. Automatic
documentation tools are motivated by the desire to overcome this deficiency. These tools work on
the source program to produce different forms of documentation.
Eg: flow charts

2.7.1 Design for Software Tools


Program preprocessing techniques are used to support static analysis of programs.
Program instrumentation implies insertion of statements in a program. The instrumented program
is translated using a standard translator. Figure below shows the schematic of software tools using
the techniques of interpretation and program generation. Interpreter based tools suffer from poor
efficiency and poor portability, since an interpreter base tool is only as portable as the interpreter
it uses. A generated program is more efficient and can be made portable. Fig 2.15 shows the
design of software tools.

Department of Computer Sciences and Applications, SJCET, Palai P a g e | 43


MODULE II MCA 303 SYSTEM SOFTWARE ADMN 2011 – ‘12

Fig: 2.15 Design Of Software Tools

2.7.2 EDITOR
An interactive editor is a computer program that allows a user to create and revise a target
document. The document means an object such as computer programs, text, equations tables,
diagrams, photographs etc. The document editing process in an interactive user computer dialogue
designed to accomplish four tasks:
1) Select the part of the target document to be viewed & manipulated.
2) Determine how to format this view online and how to display it.
3) Specify and execute operations that modify the target document.
4) Update the view appropriately.

Selection of the part of the document to be viewed and edited involves first travelling
through the document to locate the area of interest. Travelling implies movement of the editing
context to a new position within the text. The selection of what is to be viewed and manipulated
that is controlled by filtering. Filtering extracts the relevant subset of the target document at the
point of interest, such as the next screenful of text or the next statement. Formatting determines
how the result of the filtering will be seen as a visible representation on a display screen or other
devices. In the actual editing phase, the target document is created or altered with a set of
operations such as insert, delete, replace, move and copy.

2.7.2.1 Types of Editor

Various types of editors are used for editing the document. Mainly two types of editors are
used commonly ie Text editor and graphic editor. Text editor is the most interactive editor used
for editing. Various types of editors and text editors are illustrated in the figure 2.11.

Department of Computer Sciences and Applications, SJCET, Palai P a g e | 44


MODULE II MCA 303 SYSTEM SOFTWARE ADMN 2011 – ‘12

Fig 2.16 Various types of editors


Screen Editor
Screen editor uses what you see is what you get principle in editor design. A editor
displays a screenful of text at a time. The user can move the cursor over the screen, position it at
the point where user desires to perform some editing and proceed with the editing directly. The
user has full control over the entire terminal. For example over an type exiting string which user
wishes to replace. User can bring the cursor over a character to be deleted and press a delete key.
It is possible to see the effect of an edit operation on the screen.

2.7.2.1.2 Line Editor


Line editor is one of the simplest types of editor which uses a buffer to store information:
It operates in command mode. Users give the command to the editor for any operation. Editor will
respond this command. Buffer is in the main memory. That is set aside to store the information
which is entered from the keyboard.
Merits

1) Simple for read and write.


2) Simple in design and implementation
3) Command and responses are interleaved.

Demerits

1) Not user friendly


2) Context of the text is not displayed.
Department of Computer Sciences and Applications, SJCET, Palai P a g e | 45
MODULE II MCA 303 SYSTEM SOFTWARE ADMN 2011 – ‘12

3) Only single line is used for editing.

Stream Editor
A stream editor views the entire text as a stream of characters. This permits edit operations
to cross line boundaries. Stream editor typically support character line and context orient
commands. In stream editor, the current editing context indicated by the position of text pointer.
This pointer can be manipulated using positioning. Stream editor maintain multiple
representations.

Word Processor
It is a document editor with additional features. It produces well formatted output.
Features of text are merging of text, Searching and replacement of word and Moving sections of
text.

Design of an Editor

The fundamental functions in editing are travelling, editing, viewing and display.
Travelling implies movement of the editing context to a new position within the text. Viewing
implies formatting the text in a manner desired by the user. A simple text editor' may choose to
combine the viewing and display functions.
In editing document, the start of the area to be edited is determined by the current editing
pointer maintained by the editing component. The travelling component of the editor actually
performs the setting of the current editing and viewing pointers. It also determines the point at
which the viewing and editing filters. The current editing pointer can be set or reset explicitly by
the user with travelling commands, such as next paragraph and next screen. When a user issue an
editing command the editing component invokes the editing filter. Editing component filters the
document to generate a new editing buffer based on the current editing pointer as well as on the
editing filter parameters. Filtering may simply consists of the selection of contiguous characters
beginning at the current point. Current viewing pointer determined the start of the area to be
viewed for viewing a document. Current viewing pointer can be set or reset explicitly by the user
with a travelling command or implicitly by the user with a travelling command or implicitly by
the system as a result of the previous editing operation.
Figure 2.17 shows the simple editor.

Department of Computer Sciences and Applications, SJCET, Palai P a g e | 46


MODULE II MCA 303 SYSTEM SOFTWARE ADMN 2011 – ‘12

Fig 2.17 Structure of editor

For a given position of the editing context, the editing and viewing filters operate on the
internal form of text to prepare the forms suitable for editing viewing. When the cursor position
changes, the filters operate on a new portion of text to update the contents of the buffers. As
editing is performed, the editing filter reflects the changes into the internal form and update the
content of the viewing buffer. The editing and viewing buffers are independent in some cases. The
editing and viewing buffer can also partially overlap or one may be completely contained in the
other. For example, the user might specify a search to the end of the document, starting at a
character position in the middle of the screen. In the above example, an editing filter creates an
editing buffer that contains the document from the selected character of the end of the document.
The viewing buffer contains the part of the document that is visible on the screen. Only the last
part of which is in the editing buffer.

2.8 Debugging Function and Capabilities

Debugging system should provide functions such as tracing and trace back. Tracing can be
used to track the flow of execution logic and data modifications. It can also be based on
conditional expressions. Trace back can show the path by which the current statement was
reached. It can also show which statements have modified a given variable or parameter.
Debugging system have a good program display capabilities. It must be possible to display the

Department of Computer Sciences and Applications, SJCET, Palai P a g e | 47


MODULE II MCA 303 SYSTEM SOFTWARE ADMN 2011 – ‘12

program being debugged, complete with statement numbers. The system should save all the
debugging specifications across such a recompilation, so the user does not need to reissue all of
these debugging commands. Debugging system must be sensitive to the specific languge being
debugged so that procedural, arithmetic and conditional logic can be coded in the syntax of that
language. The debugger should be able to switch its context when a program written in one
language calls a program written in a different language. A debugging system must be able to deal
with optimized code. Application code used in production environments is usually optimized.

2.8.1 Debug Monitors

Dynamic debugging facility is provided by the debug monitors. It is software which


provides debugging support for a Program. It executes the program being debugged under its own
control. It dynamically control the production of debug information .It provides execution
efficiency during debugging. It enables the monitor to perform dynamically specified debugging
actions. It is made language independent. Eg: Dynamic Debugging Technique of DEC-10.
Debug monitor includes following activities.
1. Setting breakpoints in the program.
2. Initiating a debug conversation when control reaches a breakpoint.
3. Displaying values of variables.
4. Assigning new values to variables.
5. Testing user defined assertions and predicates involving program variables.
When the user a commands to set a breakpoint the debug monitor instruments the
program to introduce a sensing instruction before the start of the statement at breakpoint. The
debug monitor function can be easily implemented in an interpreter. When a user gives a
command to set a breakpoint at statement 150, The debug monitor instruments the program to
introduce the instruction.<SI-instrn><code> in place of the no-op instructions preceding no-op
150.The debug monitors requires two kind of information regarding the user program Starting
address of program statements in the complied code and Program variables name and address.
Following sequence of step involved .in dynamic debugging of a program.
1. The user compiles the program under the debug option. The compiler produces two file i.e.
a) Complied code file
b) Debug information file
2. The user activates the debug monitor and indicates the name of program to be debugged.
Debug monitor opens the corresponding two files.
3. User indicates the debug requirements i.e. a list of breakpoints and action to performed at
breakpoints. Debug monitor builds a debug table. This table _contains, <statement number, debug
action.>'
4. The instrumented program gets the control and executes up to a breakpoint.
5. When <SI-instrn> is executed, software interrupt is generated and control is given to the debug
monitor. Debug monitor construct the debug table and perform the debug actions associated with
it.

Department of Computer Sciences and Applications, SJCET, Palai P a g e | 48


MODULE II MCA 303 SYSTEM SOFTWARE ADMN 2011 – ‘12

Control now returns to the u program.


6. Steps (4) and (5) are repeated until the end of the debug session.
Important requirement for an interactive debugger is that it always be available. The
debugger must communicate and cooperate with other operating system components such as
interactive subsystems. The debugger must coordinate its activities with those of existing and
future language compilers and interpreters. It is assumed that debugging facilities in existing
languages will continue to exist and be maintained.

2.8.2 Testing Assertions

A debug assertion is relation between values of program variables. It is associated with a


program statement. It verifies assertion when execution reaches that statement. Program execution
continues if the assertion is fulfilled, else a debug conversation is opened. The user can now
perform actions to locate the cause of program malfunction. It eliminates the need to produce
voluminous information for debugging process.

2.9 Macro Processors

Department of Computer Sciences and Applications, SJCET, Palai P a g e | 49


MODULE II MCA 303 SYSTEM SOFTWARE ADMN 2011 – ‘12

Department of Computer Sciences and Applications, SJCET, Palai P a g e | 50


MODULE II MCA 303 SYSTEM SOFTWARE ADMN 2011 – ‘12

Department of Computer Sciences and Applications, SJCET, Palai P a g e | 51


MODULE II MCA 303 SYSTEM SOFTWARE ADMN 2011 – ‘12

Department of Computer Sciences and Applications, SJCET, Palai P a g e | 52


MODULE II MCA 303 SYSTEM SOFTWARE ADMN 2011 – ‘12

Department of Computer Sciences and Applications, SJCET, Palai P a g e | 53


MODULE II MCA 303 SYSTEM SOFTWARE ADMN 2011 – ‘12

Department of Computer Sciences and Applications, SJCET, Palai P a g e | 54


MODULE II MCA 303 SYSTEM SOFTWARE ADMN 2011 – ‘12

Department of Computer Sciences and Applications, SJCET, Palai P a g e | 55


MODULE II MCA 303 SYSTEM SOFTWARE ADMN 2011 – ‘12

Department of Computer Sciences and Applications, SJCET, Palai P a g e | 56


MODULE II MCA 303 SYSTEM SOFTWARE ADMN 2011 – ‘12

Department of Computer Sciences and Applications, SJCET, Palai P a g e | 57


MODULE II MCA 303 SYSTEM SOFTWARE ADMN 2011 – ‘12

Department of Computer Sciences and Applications, SJCET, Palai P a g e | 58


MODULE II MCA 303 SYSTEM SOFTWARE ADMN 2011 – ‘12

Department of Computer Sciences and Applications, SJCET, Palai P a g e | 59

Anda mungkin juga menyukai