Software Application Software Interrupts Programming language, translators and IDEs
Software, Application Software, and Interrupts
- Unit 3 discussed hardware; this unit covers how hardware and software work together.
- Two types of software:
- System software: fulfills computer needs (OS, utility programs).
- Application software: provides user-specific features.
- Application software requires hardware, firmware, and an operating system.
- Operating system supports applications.
- Firmware enables operating system functionality.
- Hardware hosts the boot loader (firmware or BIOS).
Interrupts
- Interrupts are signals sent to the processor for specific events, originating from software or hardware.
- Software Interrupts:
- Division by 0.
- Two processes accessing the same memory.
- Program request for input.
- Hardware Interrupts:
- Data input (keyboard press, mouse click).
- Printer out of paper.
- Hardware failure.
- Output required.
- Hard drive signal (data read).
- Data required from memory.
- New hardware connected.
- Interrupt Priority:
- High-priority: Urgent matters (hardware failure).
- Low-priority: Less urgent needs (data input).
- Interrupt Handling Process:
- Processor checks the interrupt queue before/after Fetch-Decode-Execute (FDE) cycle.
- If a higher priority interrupt is found:
- Saves the current process state.
- Retrieves the interrupt.
- Identifies the source.
- Executes the Interrupt Service Routine (ISR).
Programming Languages
- High-Level Language (HLL):
- Uses English-like commands.
- Advantages:
- Easier to understand, write, and amend.
- Easier and quicker to debug code.
- Portable, machine independent.
- One statement represents many low-level instructions.
- Quicker to write programs.
- Easier to maintain programs.
- Disadvantages:
- Programs take longer to execute.
- Cannot directly manipulate hardware.
- Programs can be larger.
- Low-Level Language:
- Aligned with machine code (assembly or binary).
- Assembly Language:
- Uses mnemonics; requires an assembler to convert to machine code.
- Advantages:
- Direct hardware manipulation.
- Code written rapidly.
- Code occupies minimal primary memory space.
- Disadvantages:
- Challenging to understand, read, write, and modify.
- Debugging is more difficult.
- Not portable; machine-dependent.
- Multiple instructions per high-level statement.
- Writing programs takes more time.
Translators: Compilers and Interpreters
- Translators convert High-Level Language (HLL) into machine code.
- Compiler:
- Converts the entire code into an executable file in one go.
- Generates an error report detailing all issues.
- Advantages:
- Compiled program can be stored for reuse.
- Can be executed without the compiler.
- Takes up less memory when executed.
- Executed faster.
- Disadvantages:
- Takes longer to write, test, and debug.
- Must be recompiled if the program is changed.
- Designed for a specific processor.
- Takes time to compile if there is not enough memory space.
- Interpreter:
- Translates and runs the code one line at a time.
- Halts execution upon encountering an error.
- Advantages:
- Easier and quicker debugging and testing.
- Simplified program editing.
- Disadvantages:
- Cannot be executed without the interpreter.
- Programs may take longer to execute.
Compiler vs. Interpreter
- Process:
- Compiler: Translates entire code in a single operation.
- Interpreter: Translates code sequentially, line by line.
- Error Handling:
- Compiler: Generates an error report after translation.
- Interpreter: Stops translation on error.
- Executable File:
- Compiler: Produces an executable file.
- Interpreter: No executable file; direct execution.
- Error Handling during Execution:
- Compiler: Will not execute any code if errors are found.
- Interpreter: Executes code until it encounters an error.
- Retranslation:
- Compiler: Requires retranslation after error correction.
- Interpreter: Allows real-time error correction.
- Dependency on Compiler/Interpreter:
- Compiler: Compiled programs run independently.
- Interpreter: Interpreted programs require the interpreter.
- Efficiency and Performance:
- Compiler: No need for recompilation to perform the same task repeatedly.
- Interpreter: Must be interpreted each time, impacting performance.
- Suitability:
- Compiler: Suitable for sharing or selling finished work.
- Interpreter: Primarily used during code development and testing.
Integrated Development Environment (IDE)
- Software application aiding programmers in writing and testing code.
- Simplifies error identification and fixing.
- Popular IDEs: Visual Studio, Eclipse, and PyCharm.
- Features:
- Editor for writing and modifying code.
- Translator to convert code into machine instructions.
- Run-time environment to execute code and observe behavior.
- Error diagnostics to identify and rectify programming errors.
- Auto-completion features for suggesting and completing code snippets.
- Auto-correction capabilities to fix syntax and logical errors.
- Pretty printing functionality to format code for improved readability.