Skip to main content
System Software




          Overall Syllabus Discussion
System Software
  •The subject introduced the design and
  implementation of system software
   •System software consists of a variety of programs
   that support the operation of a computer
      •operating system, compiler, assembler, macro processor,
      loader or linker, debugger, text editor, database
      management systems, software engineering tools, ….
We Discussed On…
    Machine Architecture
    Assemblers
    Loaders and Linkers
    Editors and Debugging Systems
    Macro Processor
    Compilers
    Lex and Yacc
Machine Architecture
 This Chapter Gave you…
  •System Software & Machine Architecture
  •The Simplified Instructional Computer SIC
  and SIC/XE
  •Traditional (CISC) Machines
  Complex Instruction Set Computers
  •RISC Machines
  Reduced Instruction Set Computers
System Software & Machine
Architecture

    •Machine Dependent
    •Machine Independent
Space for
                           2 inch x 2 inch
                             size Picture

SIC Machine Architecture
  •Memory and Registers
  •Data Formats
  •Instruction Formats
  •Addressing Modes
  •Instruction Set
  •Input and Output
SIC/XE Machine Architecture
   •Memory and Registers
   •Data Formats
   •Instruction Formats
   •Addressing Modes
   •Instruction Set
   •Input and Output
Example Programs SIC


   Example Programs (SIC/XE)
Different Architectures
  •Traditional (CISC) machines
       - VAX Architecture
       - Pentium Pro Architecture
  •RISC machines
       - UltraSPARC Architecture
       - Cray T3E Architecture
Traditional (CISC) Machines
•Complex Instruction Set Computers
•Has relatively large and complex instruction set
•Different instruction formats, different lengths,
different addressing modes
•Implementation of hardware is complex
• VAX and Intel x86 processors are examples
RISC Machines
•Reduced Instruction Set Computers
•Intended to simplify the design of
processors. Greater reliability, faster
execution and less expensive processors
•Standard and fixed instruction length
•Number of machine instructions,
instruction formats, and addressing modes
relatively small
Comparison of these
   •Memory
   •Registers
   •Data Formats
   •Instruction Formats
   •Addressing Modes
   •Instruction Set
   •Input and Output
Assemblers
 This Chapter Gave you…
   -Assembler Definition
   - Assembler Features
   - Machine dependent and machine independent
        features
   - Design of various assemblers
               - One-pass
               - Multi-pass
Assemblers
• Translating source code written in assembly
  language to object code.
• Assigning machine address to symbolic labels.
Assembler Design

• Assembler Design can be done in:
  – Single pass
  – Two pass
• Single Pass Assembler:
  – Does everything in single pass
  – Cannot resolve the forward referencing
• Multi pass assembler:
   – Does the work in two pass
   – Resolves the forward references
• First pass:
   – Scans the code
   – Validates the tokens
   – Creates a symbol table
• Second Pass:
  – Solves forward references
  – Converts the code to the machine code
Machine-Dependent Assembler
Features
 In Machine Specific Instructions we have:
    Instruction Format and Addressing modes
         How to handle program relocation
Machine independent features

   Literals
   Symbol defining statements
   Expressions
   Program blocks
   Control Sections and program
   linkings
Types of Assemblers
  One-pass assembler
  Multi-pass assembler
  Two-pass assembler with overlay
Loaders and Linkers
 This Chapter Gave you…
  - Basic Loader Functions
  - Machine-Dependent Loader Features
  - Machine-Independent Loader Features
  - Loader Design Options
  - Implementation Examples
Role of Loader
  Source                                   Object
                        Object
           Translator             Loader   program
 Program                                   ready for
                        Program            execution




Translator – Assembler/Compiler


                                           Memory
Role of Loader
  Source                                  Object
                       Object
           Assembler             Loader   program
 Program                                  ready for
                       Program            execution




                                          Memory
Role of Loader and Linker
                                             Memory

Source                Object
          Assembler              Linker
Program               Program                Object
                                             program
                                             ready for
                                Executable   execution

                                  Code


                                 Loader
Role of Absolute Loader
                         1000
    Object    Absolute          Object
    Program   Loader            program
                                ready for
                                execution
                         2000




                                Memory
Machine-Dependent Loader Features
 Absolute Loader – Simple and efficient
 Disadvantage is – programmer has to
 specify the starting address
 One program to run – no problem – not for
 several
 Difficult to use subroutine libraries efficiently
Program Linking
 • Goal - Resolve the problems with EXTREF
 and EXTDEF from different control sections
 (Sec 2.3.5)
 • Example - Program in Fig. 3.8 and object
 code in Fig. 3.9
    • Use modification records for both
    relocation and linking
              - address constant
              - external reference
Machine-independent Loader Features

  Features that are not directly related to
  machine architecture and design
     - Automatic Library Search
     - Loader Options
Linking Loaders           Object
                          Program(s)   The source
                                       program is first
                                       assembled or
                                       compiled,
                                       producing an
              Library     Linking
                                       object program.
                          loader       A linking loader
                                       performs all
                                       linking and
                                       loading
                                       operations, and
                          Memory       loads the
                                       program into
                                       memory for
Processing of an Object                execution
program using LL
Linkage Editors             Object
                          Program(s)


                           Linkage
              Library       editor



                             Linked
                            program


                            Relocating
                             loader
Processing of an Object
program using LE            Memory
Implementation examples…
•Brief description of loaders and linkers for
actual computers
•They are
   MS-DOS Linker        - Pentium architecture
   SunOS Linkers        - SPARC architecture
   Cray MPP Linkers – T3E architecture
Editors and Debugging Systems

  This Chapter Gave you…

     - Text editors
     - Interactive Debugging Systems
Text Editors
 An Interactive text editor has become
 an important part of almost any
 computing environment
    Text editor acts as a primary interface to the
    computer for all type of “knowledge workers”
    as they compose, organize, study, and
    manipulate computer-based information
Editing    Editing
                      component    buffer
                                             Editing
                                              filter


                       Traveling                         Main
                      component                         memory

input   Command
        language                             Viewing
        processor      Viewing     Viewing     filter
                      component     buffer




        Output
        devices          Display                          File
                       component                        system



                    Typical editor structure
Editors function in three basic types
of computing environments:

               Time sharing
               Stand-alone
               Distributed

            Each type of environment imposes some
            constraints on the design of an editor
Interactive Debugging Systems
 An interactive debugging system provides
 programmers with facilities that aid in
 testing and debugging of programs
   Many such systems are available during
   these days
   Our discussion was broad in scope, giving the
   overview of interactive debugging systems –
   not specific to any particular existing system
We Discussed
 Important functions and capabilities of
 IDS
 Relationship of IDS to other parts of the
 system
 The nature of the user interface for IDS
Macro Processor
  This Chapter Gave you…
    - Basic Macro Processor Functions
    - Algorithms
    - Nested macros
    -Comparison of different macro design
    - Machine-Independent macro features
    - Implementation of conditional macros
Macros
•A macro instruction (Macro) is a notational
convenience for the programmer
   •Allows the programmer to write short hand
   programs (modular programming).
•The macro processor replaces each macro
instruction with its equivalent block of instructions.
•The macro processor is not concerned with the
meaning of the involved statements during
expansion.
•The design of the macro processor is generally
machine independent.
Macro Expansion
Macro Invocation
Two-Pass Macro Processor
Design of two-pass macro processor
  Pass 1:
     Process all macro definitions
  Pass 2:
     Expand all macro invocation statements
One-Pass Macro Processor
   •A one-pass macro processor that alternate
   between macro definition and macro expansion
   in a recursive way is able to handle recursive
   macro definition
   Data Structure for One-Pass Macro Processor
         - DEFTAB (definition table)
         - NAMTAB
         - ARGTAB
-Machine-Independent Macro Processor Features
-Concatenation of Macro Parameters
-Generating Unique Labels
-Macro-time Looping
-Conditional Macro expansion
-Keyword macro parameters
-Recursive Macros
-Line-by-Line Macros
-Integrated Macros
Compilers
    Introduction
    Basic Compiler Function
    Lexical Analysis,
    Syntactic Analysis
           Operator-Precedence Parsing
           Shift Reduce Parsing
           Recusive Descent Parsing
Source Program
Phases of
Compilers      Lexical analysis

                Syntax analysis

    Table        Intermediate        Error
  Management    Code generation     Handling

               Code Optimization

                Code Generation
               Target Program
   Code Generation
   Machine - Dependent Code Optimization
   Machine Independent Compiler Features
   Machine - Independent Code Optimization
MACHINE - DEPENDENT CODE
OPTIMIZATION
 There are several different possibilities for
performing machine-dependent code optimization .
   Assignment and use of registers
   Divide the problem into basic blocks.
 Rearrangement of machine instruction to
improve efficiency of execution
•Machine Independent Compiler
Features
•Storage Allocation
•Block Structured Languages
•Compiler Design Options – Division Into
Passes
•Interpreters
•P-Code Compilers
•Compiler-Compilers
Lex and Yacc
 -LEX is a program generator designed for
 lexical processing of character input
 streams.

 -Yacc provides a general tool for describing
 the input to a computer program
LEX (LEXical Analyzer Generator)
   Features
   Creating a Lexical Analyzer with LEX
   LEX Source
   LEX Regular Expressions
   Functions
YACC –Yet Another Compiler-Compiler
   YACC Basic Specification
   How does the Parser Works?
   Ambiguity and Conflicts
   YACC Programs
     simple expression with +, - , /, and *.
     recognize an valid variable.
   Lex and Yacc
Notes for all the topics are available
                   @

    http://forum.vtu.ac.in