- A distributed system is a collection of autonomous computers linked by a network that appear as a single computer. Inter-process communication allows processes running on different computers to exchange data. Common IPC methods include message passing, shared memory, and remote procedure calls.
- Marshalling is the process of reformatting data to allow exchange between modules that use different data representations. Remote procedure calls allow a program to execute subroutines in another address space, such as on another computer. The client-server model partitions tasks between service providers (servers) and requesters (clients).
- Election algorithms are used in distributed systems to choose a coordinator process from among a group of processes. Examples include the bully algorithm and ring
This document discusses two common models for distributed computing communication: message passing and remote procedure calls (RPC). It describes the basic primitives and design issues for each model. For message passing, it covers synchronous vs asynchronous and blocking vs non-blocking primitives. For RPC, it explains the client-server model and how stubs are used to convert parameters and return results between machines. It also discusses binding, parameter passing techniques, and ensuring error handling and execution semantics.
Fault tolerance is important for distributed systems to continue functioning in the event of partial failures. There are several phases to achieving fault tolerance: fault detection, diagnosis, evidence generation, assessment, and recovery. Common techniques include replication, where multiple copies of data are stored at different sites to increase availability if one site fails, and check pointing, where a system's state is periodically saved to stable storage so the system can be restored to a previous consistent state if a failure occurs. Both techniques have limitations around managing consistency with replication and overhead from checkpointing communications and storage requirements.
Overview - Functions of an Operating System – Design Approaches – Types of Advanced
Operating System - Synchronization Mechanisms – Concept of a Process, Concurrent
Processes – The Critical Section Problem, Other Synchronization Problems – Language
Mechanisms for Synchronization – Axiomatic Verification of Parallel Programs - Process
Deadlocks - Preliminaries – Models of Deadlocks, Resources, System State – Necessary and
Sufficient conditions for a Deadlock – Systems with Single-Unit Requests, Consumable
Resources, Reusable Resources.
Distributed Middleware Reliability & Fault Tolerance Support in System SHarini Sirisena
The document discusses techniques for building reliable large-scale distributed systems. It describes how System S achieves reliability through two key building blocks - an inter-component communication infrastructure that handles failures and remote procedure calls, and a data storage mechanism. System S uses CORBA for communication and IBM DB2 for data storage. It also discusses how System S handles component failures through retrying operations, managing component state, and ensuring idempotent and non-idempotent operations are executed correctly.
The document discusses different system models for distributed systems. It describes two main types of models: architectural models and fundamental models. Architectural models consider the placement of components across a network and relationships between components. Variations of the client-server model are presented, including mobile code, mobile agents, network computers, and thin clients. Design requirements for distributed architectures including performance issues, quality of service, caching/replication, and dependability are also covered.
- A distributed system is a collection of autonomous computers linked by a network that appear as a single computer. Inter-process communication allows processes running on different computers to exchange data. Common IPC methods include message passing, shared memory, and remote procedure calls.
- Marshalling is the process of reformatting data to allow exchange between modules that use different data representations. Remote procedure calls allow a program to execute subroutines in another address space, such as on another computer. The client-server model partitions tasks between service providers (servers) and requesters (clients).
- Election algorithms are used in distributed systems to choose a coordinator process from among a group of processes. Examples include the bully algorithm and ring
This document discusses two common models for distributed computing communication: message passing and remote procedure calls (RPC). It describes the basic primitives and design issues for each model. For message passing, it covers synchronous vs asynchronous and blocking vs non-blocking primitives. For RPC, it explains the client-server model and how stubs are used to convert parameters and return results between machines. It also discusses binding, parameter passing techniques, and ensuring error handling and execution semantics.
Fault tolerance is important for distributed systems to continue functioning in the event of partial failures. There are several phases to achieving fault tolerance: fault detection, diagnosis, evidence generation, assessment, and recovery. Common techniques include replication, where multiple copies of data are stored at different sites to increase availability if one site fails, and check pointing, where a system's state is periodically saved to stable storage so the system can be restored to a previous consistent state if a failure occurs. Both techniques have limitations around managing consistency with replication and overhead from checkpointing communications and storage requirements.
Overview - Functions of an Operating System – Design Approaches – Types of Advanced
Operating System - Synchronization Mechanisms – Concept of a Process, Concurrent
Processes – The Critical Section Problem, Other Synchronization Problems – Language
Mechanisms for Synchronization – Axiomatic Verification of Parallel Programs - Process
Deadlocks - Preliminaries – Models of Deadlocks, Resources, System State – Necessary and
Sufficient conditions for a Deadlock – Systems with Single-Unit Requests, Consumable
Resources, Reusable Resources.
Distributed Middleware Reliability & Fault Tolerance Support in System SHarini Sirisena
The document discusses techniques for building reliable large-scale distributed systems. It describes how System S achieves reliability through two key building blocks - an inter-component communication infrastructure that handles failures and remote procedure calls, and a data storage mechanism. System S uses CORBA for communication and IBM DB2 for data storage. It also discusses how System S handles component failures through retrying operations, managing component state, and ensuring idempotent and non-idempotent operations are executed correctly.
The document discusses different system models for distributed systems. It describes two main types of models: architectural models and fundamental models. Architectural models consider the placement of components across a network and relationships between components. Variations of the client-server model are presented, including mobile code, mobile agents, network computers, and thin clients. Design requirements for distributed architectures including performance issues, quality of service, caching/replication, and dependability are also covered.
This document proposes a new distributed voting protocol called the timed-buffer distributed voting algorithm (TB-DVA) that aims to provide both security and fault tolerance for distributed systems. The TB-DVA allows any voter to initially commit a result, but then buffers that result for a time to allow other voters to check it and potentially commit a new majority result. This process is repeated until all voters agree on the final result. The goal is to address limitations of existing protocols related to securing the voting process, especially for applications requiring flexible inexact voting schemes.
The document discusses various models for distributed systems including architectural, interaction, failure, software layer, and process models. It describes key aspects of distributed systems like client-server, peer-to-peer, and mobile code architectures. Requirements for distributed designs like performance, quality of service, caching, and dependability are covered. Fundamental models for message passing between processes are defined including states, configurations, computation and delivery events.
This document discusses fault tolerance and distributed systems concepts. It covers availability, reliability, safety, maintainability, and different types of failures like crash, omission, timing, and arbitrary failures. It also discusses failure masking through redundancy, process groups, client-server communication failures, atomic multicast, virtual synchrony, message ordering, distributed commit protocols, and recovery techniques.
The document discusses faults in distributed systems, including different types of faults (transient, intermittent, permanent), fault avoidance, fault removal, and fault tolerance. It also discusses achieving fault tolerance through redundancy, with the goal of avoiding single points of failure. The remainder of the document outlines the specifications and design of a fault-tolerant distributed routing simulator, including front-end and back-end modules, class dependencies, and testing procedures.
A distributed system is a collection of independent computers that appear as a single coherent system to users. Middleware acts as a bridge between operating systems and applications, especially over a network. Examples of distributed systems include the World Wide Web, the internet, and intranets within organizations. Distributed systems provide benefits like increased reliability, scalability, performance, and flexibility compared to centralized systems. However, they also present challenges around security, software complexity, and system failures.
Distributed Systems Introduction and Importance SHIKHA GAUTAM
Distributed Systems Introduction and Importance. It covers the following Topics: Characterization of Distributed Systems: Introduction, Examples of distributed Systems, Resource sharing and the Web Challenges. Architectural models, Fundamental Models.
Theoretical Foundation for Distributed System: Limitation of Distributed system, absence of global clock, shared memory, Logical clocks ,Lamport’s & vectors logical clocks.
Concepts in Message Passing System.
This document provides information about fault tolerance and discusses different approaches to building fault tolerant systems from unreliable components. It begins with an overview of fault tolerance principles like error detection, correction and stopping propagation. It then covers hardware fault tolerance using redundancy, as well as early software approaches like Tandem's nonstop systems. The document discusses the challenges of building reliable software and strategies like defensive programming, process supervision and restarting processes on error. It emphasizes that failure assumptions must be specified and provides a demonstration of error detection in Erlang.
This document summarizes topics related to distributed mutual exclusion and algorithms for coordinating processes to ensure only one can access a shared resource at a time. It describes essential requirements for mutual exclusion including safety, liveness, and ordering. It then summarizes several algorithms for distributed mutual exclusion including a central server algorithm, ring-based algorithm, multicast-based algorithm using logical clocks, and Maekawa's voting algorithm. For each algorithm, it highlights how the requirements are satisfied and discusses performance factors like bandwidth consumption and throughput.
Message Passing, Remote Procedure Calls and Distributed Shared Memory as Com...Sehrish Asif
Message Passing, Remote Procedure Calls and
Distributed Shared Memory as Communication Paradigms for Distributed Systems & Remote Procedure Call Implementation Using Distributed Algorithms
Middleware and Middleware in distributed applicationRishikese MR
The seminar discuss about the common middleware concept and middleware in distributed applications .Also we discuss about 4 different types of middleware. MOM( Message oriented Middleware), ORB (object request broker), TP Monitors, Request procedure calls RPC.
The slide also gives the advantages and disadvantages of each.
This document outlines 7 key challenges in designing distributed systems: heterogeneity, openness, security, scalability, failure handling, concurrency, and transparency. It discusses each challenge in detail, providing examples. Heterogeneity refers to differences in networks, hardware, operating systems, and programming languages that must be addressed. Openness means a system can be extended and implemented in various ways. Security concerns confidentiality, integrity, and availability of resources. Scalability means a system remains effective as resources and users increase significantly. Failure handling techniques include detecting, masking, tolerating, and recovering from failures. Concurrency ensures correct and high performance sharing of resources. Transparency aims to make distributed components appear as a single system regardless of location, access
This document discusses synchronization in distributed systems and various algorithms for achieving mutual exclusion. It covers centralized, distributed, and token ring algorithms for mutual exclusion. The centralized algorithm uses a coordinator but has a single point of failure. Distributed algorithms overcome this but require more messages. The token ring algorithm passes a token between processes but can lose the token if a process crashes. In comparing the algorithms, the document examines their message requirements, delay before entry, and potential problems.
Replication in computing involves sharing information so as to ensure consistency between redundant resources, such as software or hardware components, to improve reliability, fault-tolerance, or accessibility.
This document discusses different architectural approaches for client-server systems, including 2-tier, 3-tier, and N-tier architectures. A 2-tier architecture consists of clients and a single application server, while 3-tier and N-tier architectures separate functionality into distinct presentation, application processing, and data tiers for improved scalability and flexibility.
This document discusses several key concepts in distributed operating systems:
1. Transparency allows applications to operate without regard to whether the system is distributed or implementation details. Inter-process communication enables communication within and between nodes.
2. Process management provides policies and mechanisms for sharing resources between distributed processes like load balancing.
3. Resource management distributes resources like memory and files across nodes and implements policies for load sharing and balancing.
4. Reliability is achieved through fault avoidance, tolerance, and detection/recovery to prevent and recover from errors.
System software module 4 presentation filejithujithin657
The document discusses the various phases of a compiler:
1. Lexical analysis scans source code and transforms it into tokens.
2. Syntax analysis validates the structure and checks for syntax errors.
3. Semantic analysis ensures declarations and statements follow language guidelines.
4. Intermediate code generation develops three-address codes as an intermediate representation.
5. Code generation translates the optimized intermediate code into machine code.
The document summarizes the key phases of a compiler:
1. The compiler takes source code as input and goes through several phases including lexical analysis, syntax analysis, semantic analysis, code optimization, and code generation to produce machine code as output.
2. Lexical analysis converts the source code into tokens, syntax analysis checks the grammar and produces a parse tree, and semantic analysis validates meanings.
3. Code optimization improves the intermediate code before code generation translates it into machine instructions.
This document proposes a new distributed voting protocol called the timed-buffer distributed voting algorithm (TB-DVA) that aims to provide both security and fault tolerance for distributed systems. The TB-DVA allows any voter to initially commit a result, but then buffers that result for a time to allow other voters to check it and potentially commit a new majority result. This process is repeated until all voters agree on the final result. The goal is to address limitations of existing protocols related to securing the voting process, especially for applications requiring flexible inexact voting schemes.
The document discusses various models for distributed systems including architectural, interaction, failure, software layer, and process models. It describes key aspects of distributed systems like client-server, peer-to-peer, and mobile code architectures. Requirements for distributed designs like performance, quality of service, caching, and dependability are covered. Fundamental models for message passing between processes are defined including states, configurations, computation and delivery events.
This document discusses fault tolerance and distributed systems concepts. It covers availability, reliability, safety, maintainability, and different types of failures like crash, omission, timing, and arbitrary failures. It also discusses failure masking through redundancy, process groups, client-server communication failures, atomic multicast, virtual synchrony, message ordering, distributed commit protocols, and recovery techniques.
The document discusses faults in distributed systems, including different types of faults (transient, intermittent, permanent), fault avoidance, fault removal, and fault tolerance. It also discusses achieving fault tolerance through redundancy, with the goal of avoiding single points of failure. The remainder of the document outlines the specifications and design of a fault-tolerant distributed routing simulator, including front-end and back-end modules, class dependencies, and testing procedures.
A distributed system is a collection of independent computers that appear as a single coherent system to users. Middleware acts as a bridge between operating systems and applications, especially over a network. Examples of distributed systems include the World Wide Web, the internet, and intranets within organizations. Distributed systems provide benefits like increased reliability, scalability, performance, and flexibility compared to centralized systems. However, they also present challenges around security, software complexity, and system failures.
Distributed Systems Introduction and Importance SHIKHA GAUTAM
Distributed Systems Introduction and Importance. It covers the following Topics: Characterization of Distributed Systems: Introduction, Examples of distributed Systems, Resource sharing and the Web Challenges. Architectural models, Fundamental Models.
Theoretical Foundation for Distributed System: Limitation of Distributed system, absence of global clock, shared memory, Logical clocks ,Lamport’s & vectors logical clocks.
Concepts in Message Passing System.
This document provides information about fault tolerance and discusses different approaches to building fault tolerant systems from unreliable components. It begins with an overview of fault tolerance principles like error detection, correction and stopping propagation. It then covers hardware fault tolerance using redundancy, as well as early software approaches like Tandem's nonstop systems. The document discusses the challenges of building reliable software and strategies like defensive programming, process supervision and restarting processes on error. It emphasizes that failure assumptions must be specified and provides a demonstration of error detection in Erlang.
This document summarizes topics related to distributed mutual exclusion and algorithms for coordinating processes to ensure only one can access a shared resource at a time. It describes essential requirements for mutual exclusion including safety, liveness, and ordering. It then summarizes several algorithms for distributed mutual exclusion including a central server algorithm, ring-based algorithm, multicast-based algorithm using logical clocks, and Maekawa's voting algorithm. For each algorithm, it highlights how the requirements are satisfied and discusses performance factors like bandwidth consumption and throughput.
Message Passing, Remote Procedure Calls and Distributed Shared Memory as Com...Sehrish Asif
Message Passing, Remote Procedure Calls and
Distributed Shared Memory as Communication Paradigms for Distributed Systems & Remote Procedure Call Implementation Using Distributed Algorithms
Middleware and Middleware in distributed applicationRishikese MR
The seminar discuss about the common middleware concept and middleware in distributed applications .Also we discuss about 4 different types of middleware. MOM( Message oriented Middleware), ORB (object request broker), TP Monitors, Request procedure calls RPC.
The slide also gives the advantages and disadvantages of each.
This document outlines 7 key challenges in designing distributed systems: heterogeneity, openness, security, scalability, failure handling, concurrency, and transparency. It discusses each challenge in detail, providing examples. Heterogeneity refers to differences in networks, hardware, operating systems, and programming languages that must be addressed. Openness means a system can be extended and implemented in various ways. Security concerns confidentiality, integrity, and availability of resources. Scalability means a system remains effective as resources and users increase significantly. Failure handling techniques include detecting, masking, tolerating, and recovering from failures. Concurrency ensures correct and high performance sharing of resources. Transparency aims to make distributed components appear as a single system regardless of location, access
This document discusses synchronization in distributed systems and various algorithms for achieving mutual exclusion. It covers centralized, distributed, and token ring algorithms for mutual exclusion. The centralized algorithm uses a coordinator but has a single point of failure. Distributed algorithms overcome this but require more messages. The token ring algorithm passes a token between processes but can lose the token if a process crashes. In comparing the algorithms, the document examines their message requirements, delay before entry, and potential problems.
Replication in computing involves sharing information so as to ensure consistency between redundant resources, such as software or hardware components, to improve reliability, fault-tolerance, or accessibility.
This document discusses different architectural approaches for client-server systems, including 2-tier, 3-tier, and N-tier architectures. A 2-tier architecture consists of clients and a single application server, while 3-tier and N-tier architectures separate functionality into distinct presentation, application processing, and data tiers for improved scalability and flexibility.
This document discusses several key concepts in distributed operating systems:
1. Transparency allows applications to operate without regard to whether the system is distributed or implementation details. Inter-process communication enables communication within and between nodes.
2. Process management provides policies and mechanisms for sharing resources between distributed processes like load balancing.
3. Resource management distributes resources like memory and files across nodes and implements policies for load sharing and balancing.
4. Reliability is achieved through fault avoidance, tolerance, and detection/recovery to prevent and recover from errors.
System software module 4 presentation filejithujithin657
The document discusses the various phases of a compiler:
1. Lexical analysis scans source code and transforms it into tokens.
2. Syntax analysis validates the structure and checks for syntax errors.
3. Semantic analysis ensures declarations and statements follow language guidelines.
4. Intermediate code generation develops three-address codes as an intermediate representation.
5. Code generation translates the optimized intermediate code into machine code.
The document summarizes the key phases of a compiler:
1. The compiler takes source code as input and goes through several phases including lexical analysis, syntax analysis, semantic analysis, code optimization, and code generation to produce machine code as output.
2. Lexical analysis converts the source code into tokens, syntax analysis checks the grammar and produces a parse tree, and semantic analysis validates meanings.
3. Code optimization improves the intermediate code before code generation translates it into machine instructions.
The document discusses the phases of a compiler and their functions. It describes:
1) Lexical analysis converts the source code to tokens by recognizing patterns in the input. It identifies tokens like identifiers, keywords, and numbers.
2) Syntax analysis/parsing checks that tokens are arranged according to grammar rules by constructing a parse tree.
3) Semantic analysis validates the program semantics and performs type checking using the parse tree and symbol table.
The document discusses the phases of a compiler:
1) Lexical analysis scans the source code and converts it to tokens which are passed to the syntax analyzer.
2) Syntax analysis/parsing checks the token arrangements against the language grammar and generates a parse tree.
3) Semantic analysis checks that the parse tree follows the language rules by using the syntax tree and symbol table, performing type checking.
4) Intermediate code generation represents the program for an abstract machine in a machine-independent form like 3-address code.
The document provides an overview of compilers and interpreters. It discusses that a compiler translates source code into machine code that can be executed, while an interpreter executes source code directly without compilation. The document then covers the typical phases of a compiler in more detail, including the front-end (lexical analysis, syntax analysis, semantic analysis), middle-end/optimizer, and back-end (code generation). It also discusses interpreters, intermediate code representation, symbol tables, and compiler construction tools.
This document provides an introduction to compilers and their construction. It defines a compiler as a program that translates a source program into target machine code. The compilation process involves several phases including lexical analysis, syntax analysis, semantic analysis, code optimization, and code generation. An interpreter directly executes source code without compilation. The document also discusses compiler tools and intermediate representations used in the compilation process.
The document provides an introduction to compilers. It discusses that compilers are language translators that take source code as input and convert it to another language as output. The compilation process involves multiple phases including lexical analysis, syntax analysis, semantic analysis, code generation, and code optimization. It describes the different phases of compilation in detail and explains concepts like intermediate code representation, symbol tables, and grammars.
1. The document describes the 6 main phases of a compiler: lexical analysis, syntax analysis, semantic analysis, intermediate code generation, code optimization, and code generation.
2. Each phase transforms the source program into different representations, with the lexical analyzer identifying tokens, the syntax analyzer constructing a parse tree, and the semantic analyzer performing type checking.
3. The intermediate code generator produces machine-independent code, the code optimizer improves performance, and the code generator outputs machine-specific object code.
The document summarizes the six main phases of a compiler:
1. The lexical analyzer identifies tokens from the source code and removes whitespace and comments.
2. The syntax analyzer checks that the code follows grammar rules of the language and constructs a parse tree.
3. The semantic analyzer verifies type consistency and checks for semantic errors using the symbol table and parse tree.
4. The intermediate code generator produces machine-independent code in a form that can be optimized and executed.
5. The code optimizer improves performance by removing unused code and variables without altering meaning.
6. The code generator produces machine-specific object code by selecting instructions and registers for the target platform.
This document provides an overview of the principles of compiler design. It discusses the main phases of compilation, including lexical analysis, syntax analysis, semantic analysis, intermediate code generation, code optimization, and code generation. For each phase, it describes the key techniques and concepts used, such as lexical analysis using regular expressions and finite automata, syntax analysis using parsing techniques, semantic analysis using symbol tables and type checking, and code optimization methods like dead code elimination and loop optimization. The document emphasizes that compilers are essential tools that translate high-level programming languages into executable machine code.
This document provides an overview of the key concepts and phases in compiler design, including lexical analysis, syntax analysis using context-free grammars and parsing techniques, semantic analysis using attribute grammars, intermediate code generation, code optimization, and code generation. The major parts of a compiler are the analysis phase, which creates an intermediate representation from the source program using lexical analysis, syntax analysis, and semantic analysis, and the synthesis phase, which generates the target program from the intermediate representation using intermediate code generation, code optimization, and code generation.
The phases of a compiler are:
1. Lexical analysis breaks the source code into tokens
2. Syntax analysis checks the token order and builds a parse tree
3. Semantic analysis checks for type errors and builds symbol tables
4. Code generation converts the parse tree into target code
A compiler is a program that translates a program written in a source language into a target language. It has two main parts: analysis and synthesis. The analysis part breaks down the source code using lexical analysis, syntax analysis, and semantic analysis. The synthesis part constructs the target program using intermediate code generation, code optimization, and code generation. A compiler translates the source code into assembly code, which is then assembled into machine code and linked with libraries to create an executable program.
We have learnt that any computer system is made of hardware and software.
The hardware understands a language, which humans cannot understand. So we write programs in high-level language, which is easier for us to understand and remember.
These programs are then fed into a series of tools and OS components to get the desired code that can be used by the machine.
This is known as Language Processing System.
Translation of a program written in a source language into a semantically equivalent program written in a target language
It also reports to its users the presence of errors in the source program
The document provides an overview of compilers by discussing:
1. Compilers translate source code into executable target code by going through several phases including lexical analysis, syntax analysis, semantic analysis, code optimization, and code generation.
2. An interpreter directly executes source code statement by statement while a compiler produces target code as translation. Compiled code generally runs faster than interpreted code.
3. The phases of a compiler include a front end that analyzes the source code and produces intermediate code, and a back end that optimizes and generates the target code.
Data Communication and Computer Networks Management System Project Report.pdfKamal Acharya
Networking is a telecommunications network that allows computers to exchange data. In
computer networks, networked computing devices pass data to each other along data
connections. Data is transferred in the form of packets. The connections between nodes are
established using either cable media or wireless media.
Better Builder Magazine brings together premium product manufactures and leading builders to create better differentiated homes and buildings that use less energy, save water and reduce our impact on the environment. The magazine is published four times a year.
Sri Guru Hargobind Ji - Bandi Chor Guru.pdfBalvir Singh
Sri Guru Hargobind Ji (19 June 1595 - 3 March 1644) is revered as the Sixth Nanak.
• On 25 May 1606 Guru Arjan nominated his son Sri Hargobind Ji as his successor. Shortly
afterwards, Guru Arjan was arrested, tortured and killed by order of the Mogul Emperor
Jahangir.
• Guru Hargobind's succession ceremony took place on 24 June 1606. He was barely
eleven years old when he became 6th Guru.
• As ordered by Guru Arjan Dev Ji, he put on two swords, one indicated his spiritual
authority (PIRI) and the other, his temporal authority (MIRI). He thus for the first time
initiated military tradition in the Sikh faith to resist religious persecution, protect
people’s freedom and independence to practice religion by choice. He transformed
Sikhs to be Saints and Soldier.
• He had a long tenure as Guru, lasting 37 years, 9 months and 3 days
Sachpazis_Consolidation Settlement Calculation Program-The Python Code and th...Dr.Costas Sachpazis
Consolidation Settlement Calculation Program-The Python Code
By Professor Dr. Costas Sachpazis, Civil Engineer & Geologist
This program calculates the consolidation settlement for a foundation based on soil layer properties and foundation data. It allows users to input multiple soil layers and foundation characteristics to determine the total settlement.
We have designed & manufacture the Lubi Valves LBF series type of Butterfly Valves for General Utility Water applications as well as for HVAC applications.
1. SRI RAMAKRISHNA INSTITUTE OF TECHNOLOGY,
COIMBATORE-10
(An Autonomous Institution)
Department of Information Technology
Academic Year 2021-22 III Year 5th Semester
UITC013 - PRINCIPLES OF COMPILER
DESIGN
M. MARIMUTHU, AP/IT
2. What are Compilers?
• Compiler is a program which translates a
program written in one language (the source
language) to an equivalent program in other
language (the target language)
3. Compilers
• Translates from one representation of the
program to another
• Typically from high level source code to low
level machine code or object code.
• Source code is normally optimized for human
readability.
– Expressive: matches our notion of languages
– Redundant to help avoid programming errors
4. Compilers…(2)
• Machine code is optimized for hardware.
– Redundancy is reduced
– Information about the intent is lost.
7. Phases of a Compiler..
• A compiler operates in phases, each of which
transforms the source program from one
representation into another representation.
• They communicate with error handlers.
• They communicate with the symbol table.
8. Symbol Table Management
• An essential function of a compiler is to record
the identifiers used in the source program and
collect information about various attributes of
each identifier.
• These attributes may provide information about
the storage allocated for an identifier, its type, its
scope and in the case of procedure names, such
things as the number and types of its arguments,
the method of passing each argument and the
type returned.
9. Symbol Table Management…
• A symbol table is a data structure containing a
record for each identifier, with fields for the
attributes of the identifier.
• The data structure allows us to find the record
for each identifier quickly and to store or
retrieve data from that record quickly.
• When an identifier in the source program is
detected by the lexical analyzer, the identifier
is entered into the symbol table.
10. Symbol Table Management…
• However, the attributes of an identifier cannot
normally be determined during lexical analysis.
For example, in a Pascal declaration like.
Var a,b,c: real;
The type “real” is not known when a,b and c are
seen by the lexical analyzer.
• The remaining phases enter information about
identifiers into the symbol table and use this
information in various ways.
11. Error Detection and Reporting
• Each phase can encounter errors. However,
after detecting an error, a phase must deal
with that error, so that compilation can
proceed allowing further errors in the source
program to be detected.
• The lexical phase can detect errors where the
characters remaining in the input do not form
any token of the language.
12. Error Detection and Reporting
• Error where the token stream violates the
structure rules of the language are
determined by the syntax analysis phase.
• During semantic analysis the compiler tries to
detect constructs that have the right syntactic
structure but no meaning to the operation
involved.
13. Error Detection and Reporting
• All phases may encounter errors such as,
• Lexical Phase – Unable to proceed because
the next token in the source program may be
misspelled.
• Syntax Phase – Structure of the statement
violates the rules of programming language.
• Semantic – No meaning in the operation
involved.
14. Error Detection and Reporting
• Intermediate – Operands have incompatible
data types.
• Code Optimizer – Certain statements may
never be reached.
• Code Generation – Constant is too long.
• Symbol table – Multiple declared variables.
15. Lexical Analysis
• The lexical analysis phase reads the characters
in the source program and groups them into a
stream of tokens.
• Each token represents a logically cohesive
sequence of characters, such as an identifier, a
keyword, a punctuation character or a
operator, etc.
• The character sequence forming a token is
called the lexeme for the token.
16. Lexical Analysis
• Certain tokens will be augmented by a “lexical
value”. The lexical analyzer not only generates
a token, but also it enters the lexeme into the
symbol table.
• Eg., Consider the expression
a:= b+c*20
The representation of the above expression
after lexical analysis is,
id1 = id2 + id3 * 20
17. Syntax Analysis
• This phase receives the tokens generated by previous
phase (Lexical Analysis) as input and produces a
hierarchical structure called syntax or Parse tree as
output.
• It checks whether the statements are up to the syntax
of the programming language constructs or not.
• A Parse tree represents the syntactic structure of the
input. A Syntax tree is a compressed representation of
the parse tree in which the operators appear as the
interior nodes and the operands as child nodes.
18. Semantic Analysis
• This phase checks the source program for the
meaning of syntax tree, semantic errors and
gathers “type compatible information” for the
subsequent phases.
• Type Checking - “for each operator, the
operands are checked to find whether they
are acceptable for that operator.
• For example, character data type cannot be
used in an arithmetic expression
19. Intermediate Code Generation
• This phase converts the output of semantic
analyzer into an intermediate representation.
• Intermediate representation should have two
important properties:-
– It should be easy to produce,
– Easy to translate into the target program
• Some of the intermediate forms are
– Syntax Trees
– Postfix Notation
– Three address code – having at most three operands
20. Code Optimization
• Object code programs need to be small and
faster than the source program. Hence this
phase optimizes the intermediate
representation of the source program into an
efficient code by reducing the unnecessary
statements and operands.
21. Code Optimization - Examples
• Detection and removal of dead (unreachable)
code.
• Local optimization :- Elimination of common
sub expressions
• Loop optimization :- Finding out loop
invariants and avoiding them.
22. Code Generation
• This phase converts the optimized
intermediate code into target code which can
be either Assembly code or Machine code.
• This phase also allocates memory locations for
the variables used in the program (allocation
of registers and memory)