KEMBAR78
4 Sem B.tach System Programming | PDF | Assembly Language | Programming
0% found this document useful (0 votes)
28 views1 page

4 Sem B.tach System Programming

The document discusses the general machine structure based on the Von Neumann architecture, emphasizing the stored program concept where programs and data are stored in the same memory. It explains the necessity of multi-pass assemblers, detailing Pass 1's function of creating a symbol table and assigning addresses. Additionally, it covers the anatomy and types of device drivers in UNIX systems, highlighting their role as interfaces between the OS and hardware.

Uploaded by

Shahjad pathan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views1 page

4 Sem B.tach System Programming

The document discusses the general machine structure based on the Von Neumann architecture, emphasizing the stored program concept where programs and data are stored in the same memory. It explains the necessity of multi-pass assemblers, detailing Pass 1's function of creating a symbol table and assigning addresses. Additionally, it covers the anatomy and types of device drivers in UNIX systems, highlighting their role as interfaces between the OS and hardware.

Uploaded by

Shahjad pathan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

1. Explain general machines structure in details we it is called as stored program concept? 3.

3. Why does assembler require more than one pass or input program example your answer with 4 . Explain pass 1 of assembler in details with the help of flowchart and database.
1. General Machine Structure suitable example . Pass 1 of Assembler
A general-purpose computer follows the Von Neumann architecture, which includes: 1. Introduction An assembler converts assembly language into machine code. Pass 1 of a two-pass assembler scans
Central Processing Unit (CPU) – Executes instructions and consists of: An assembler converts assembly language into machine code. It may require multiple passes to handle the source code to generate a symbol table and determine memory addresses. It does not generate
ALU (Arithmetic and Logic Unit) – Performs calculations and logical operations. forward references, where a symbol is used before being defined. final machine code but lays the foundation for Pass 2.
Control Unit (CU) – Manages execution by fetching, decoding, and executing instructions. 2. Need for Multi-Pass Assemblers 2. Functions of Pass 1
Registers – Temporary storage for quick data access. Assemblers often require more than one pass due to forward references, where a symbol (such as a Scans source code line by line.
Memory Unit – Stores both data and program instructions. It includes: label or variable) is used before it is defined. A single-pass assembler cannot handle such cases Assigns addresses to labels (symbols).
Primary Memory (RAM, ROM) – RAM is volatile; ROM stores permanent instructions. efficiently. Creates a Symbol Table.
Secondary Storage (HDD, SSD) – Holds long-term data. 3. Example Assembly Processes assembler directives (e.g., ORG, EQU).
Input and Output Devices – Enable user interaction with the system. START MOV A, DATA ; Load DATA into A Ignores actual opcode translation.
System Bus – Facilitates data transfer between CPU, memory, and I/O. ADD A, B ; Add B to A 3. Flowchart for Pass 1
2. Stored Program Concept STORE A, RESULT ; Store result
Proposed by John von Neumann, it states that: HALT ; Stop execution
Programs and data are stored in the same memory. DATA DW 10 ; Define DATA
The CPU fetches and executes instructions sequentially from memory. B DW 5 ; Define B
Programs can be modified and executed without hardware changes. RESULT DW ? ; Memory for result
2. Explain evolution of component of programming system Pass 1: Creates a symbol table.
Evolution of Programming Components Pass 2: Generates machine code using actual addresses.
1. Machine Language (1st Generation) : - Programs were written in binary (0s and 1s). Label Address Value
- Difficult to read, write, and debug. START 1000 -
2. Assembly Language (2nd Generation) :- Introduced mnemonics (e.g., MOV, ADD). DATA 1004 10
- Required an assembler to convert code into machine language. B 1006 5 4. Database Representation of Symbol Table
3. High-Level Languages (3rd Generation):- Introduced languages like C, FORTRAN, COBOL. RESULT 1008 ? Symbol Address Type
- Required a compiler or interpreter for execution. Pass 2 (Code Generation) DATA 1004 Variable
4. Operating Systems and Linkers (4th Generation) :- OS managed system resources. Now, the assembler replaces symbols like DATA, B, and RESULT with their actual addresses from the B 1006 Variable
- Linkers combined multiple code modules into a single executable. symbol table. RESULT 1008 Storage
5. Modern Integrated Development Environments (IDEs) (5th Generation) :- Include compilers, The final machine code is generated.
debuggers, and editors in one interface.
- Support for automation, version control, and intelligent code completion.
OS managed system resources.
Linkers combined multiple code modules into a single executable.
5. Explain in detail the two pass microprocessor with the help of neat and clean flowchart what micro 5. What database are used by the two pass of micro processor ? explain advantage and Write short note on Assembler , Loader , Compiler , Macro , linking , editor , Memory allocation ,
Modern Integrated Development Environments (IDEs) (5th Generation)
facility are restricted in the design ? disadvantage of combining micro processor with assembler . Component of System Programming
Include compilers, debuggers, and editors in one interface.
A two-pass assembler is used in microprocessors to convert assembly language into machine code in A two-pass assembler in a microprocessor uses the following databases: Assembler: -
Support for automation, version control, and intelligent code completion.
two passes. This method is required to handle forward references, where labels or addresses are used Symbol Table :- Stores labels, memory addresses, and variables. • An assembler is a type of computer program that interprets software programs
before being defined. Used in Pass 2 to replace symbols with actual addresses. written in assembly language into machine language, code and instructions that
2. Working of a Two-Pass Assembler Opcode Table (OPTAB) :- Contains instruction mnemonics and their machine code equivalents. can be executed by a computer.
Pass 1: Symbol Table Creation :- Reads the source code line by line. Used to translate assembly instructions into machine code. • An assembler enables software and application developers to access, operate and
- Identifies labels and symbols and assigns memory addresses. Literal Table (LITTAB) : - Stores constant values and their assigned memory locations. manage a computer's hardware architecture and components.
- Stores this information in the symbol table. Location Counter (LOCCTR) :- Keeps track of memory addresses for instructions and data. Loader:- A loader is a program used by an operating system to load programs from a
Does not generate the final machine code. Advantages of Combining Microprocessor with Assembler secondary to main memory so as to be executed.
Pass 2: Machine Code Generation :- Reads the source code again. Efficient Code Execution – Direct conversion to machine code improves performance. Compiler:- A compiler is a computer program (or a set of programs) that transforms source
Uses the symbol table to replace labels with actual memory addresses. Hardware-Specific Optimization – Ensures better instruction set utilization. code written in a programming language (the source language) into another
Generates final machine code for execution. Faster Program Development – Automates address resolution and instruction encoding. computer language (the target language), with the latter often having a binary
4. Microprocessor Facilities Restricted in Two-Pass Design Error Detection – Helps identify syntax and label errors during assembly. form known as object code.
Self-Modifying Code – Since machine code is generated after Pass 2, real-time code modification is not Disadvantages of Combining Microprocessor with Assembler Macro:- • A macro is a single line abbreviation for group of statement.
possible. Limited Flexibility – Assembly programs are hardware-dependent. • A macro processor is a program that substitutes and specialized macro definitions
Immediate Execution – Execution must wait until both passes are completed. Difficult Debugging – Low-level programming makes debugging complex. for macro calls.
Memory Constraints – Extra memory is required for the symbol table. Increased Development Time – Requires detailed knowledge of processor architecture. 5. Linking : - Linking is the process of combining multiple object files into a single executable file. A
Longer Compilation Time – Since the assembler scans the source code twice, processing time increases. Memory Constraints – Symbol tables and other assembler databases consume memory. linker resolves references between modules, assigns memory addresses, and integrates library
functions. It can be static or dynamic.
6. Editor :- An editor is a software tool used to write and modify source code. Examples include
Notepad++, Visual Studio Code, and Vim. Advanced editors provide features like syntax highlighting,
auto-completion, and debugging support.
7. Memory Allocation
Memory allocation refers to the process of assigning memory space to programs and data. It can be
static (fixed memory size during compilation) or dynamic (allocated at runtime using functions like
malloc in C).

What is compiler draw a block diagram for the face of compiler and indicste the main function of Describe in detail the anatomy and type device driver in UNIX system ? Draw and example general machine structure ?
1. Introduction to Device Drivers
each face . A device driver is a specialized software module that allows the UNIX operating system to interact with hardware devices. It acts as an
A compiler is a system software that converts high-level programming language code into machine interface between the operating system kernel and the hardware components such as disk drives, printers, network cards, and other
code that can be executed by a computer. It operates through multiple phases, each performing a peripherals.
2. Anatomy of a Device Driver in UNIX
specific function in the translation process. Device drivers in UNIX are typically implemented as kernel modules and follow a structured architecture that includes:
Block Diagram of Compiler Phases a. User Space and Kernel Space
User Space: Applications run in user mode and communicate with device drivers via system calls.
Kernel Space: The device driver resides in the kernel space and directly interacts with the hardware.
b. Device Driver Components
A UNIX device driver consists of the following key components:
 Initialization Routine
 Major and Minor Numbers
 File Operations
 Interrupt Handling
The components of a general machine are as follows:
 Memory Management
 Device Control Interface 1. Instruction interpreter: A group of electronic circuits performs the intent of instruction of fetched
 Error Handling and Logging from memory.
3. Types of Device Drivers in UNIX
2. Location counter: LC otherwise called as program counter PC or instruction counter IC, is a hardware
UNIX systems classify device drivers based on the type of devices they manage:
Main Functions of Each Phase a. Character Device Drivers memory device which denotes the location of the
Lexical Analysis (Scanning) :- Converts source code into a sequence of tokens. Used for devices that transfer data in a character-by-character manner. current instruction being executed.
Example: Serial ports (/dev/ttyS0), keyboards, and mice.
Removes whitespace and comments. 3. Instruction register: A copy of the content of the LC is stored in IR.
Does not support random access.
Syntax Analysis (Parsing) :- Checks the grammatical structure of the tokens. b. Block Device Drivers 4. Working register: are the memory devices that serve as “scratch pad” for the instruction interpreter.
Constructs a parse tree based on syntax rules. Used for devices that store data in fixed-size blocks. 5. General register: are used by programmers as storage locations and for special functions.
Example: Hard disks (/dev/sda), SSDs, USB drives.
Semantic Analysis :- Ensures logical correctness (e.g., type checking). Supports random access and buffered I/O.
6. Memory address registers (MAR): contains the address of the memory location that is to read from
Detects semantic errors (e.g., undeclared variables). c. Network Device Drivers or stored into.
Intermediate Code Generation :- Converts the parse tree into an intermediate representation (IR). Manages network interfaces such as Ethernet, Wi-Fi, and Bluetooth adapters. 7. Memory buffer register (MBR): contain a copy of the content of the memory location whose address
Example: Network interface cards (eth0, wlan0).
IR is independent of the target machine. is stored in MAR. The primary interface between the memory and the CPU is through memory buffer
Uses socket-based communication.
Code Optimization :- Improves performance by reducing redundancy. d. Pseudo Device Drivers register.
Enhances execution speed and memory efficiency. Virtual drivers that do not control actual hardware but provide kernel services. 8. Memory controller: is a hardware device whose work is to transfer the content of the MBR to the
Example: /dev/null, /dev/zero, /dev/random.
Code Generation:- Converts IR into machine-level code. core memory location whose address is stored in MAR.
e. Loadable Kernel Modules (LKM)
Produces executable code for the target hardware. Dynamically loadable device drivers that can be inserted and removed without rebooting. 9. I/O channels: may be thought of as separate computers which interpret special instructions for
Example: USB drivers that load when a USB device is plugged in. inputting and outputting information from the memory.

You might also like