Introduction to Programming
Programming is a way to address a specific problem using the Computer. Programs should be written with readability and reusability in mind. A program provides instructions to the computer on what operations need to be carried out but at the same time it should also provide clean and concise information about different functionalities that it carries out.
We need to stress on readability and reusability of a program so that any future programmer who comes across your program should be able to understand what your program does and also he should be able to reuse your program to build another useful program.
For any programmer it is important to understand how a computer executes your program. Programmer needs to have at-least a very basic understanding of how a computer loads the program and executes it.
Kernel vs Operating System
A kernel and an operating system (OS) are closely related concepts in computer science, but they refer to different things:
Kernel:
- The kernel is the core, low-level part of an operating system.
- It acts as a bridge between hardware and software, managing resources like CPU, memory, and devices.
- The kernel handles tasks such as process scheduling, memory management, device drivers, and system calls.
- It operates in a privileged mode, with direct access to hardware.
- Examples: Linux kernel.
Operating System (OS):
- The OS is the complete software layer that manages computer hardware and provides services for computer programs.
- It includes the kernel plus additional components: user interfaces (like GUIs and shells), utilities, libraries, and application support.
- The OS provides a user environment and tools for running applications.
- Examples: Linux distributions (like Ubuntu, Fedora), Android.
In summary:
The kernel is the core part of the operating system responsible for interacting with hardware, while the OS is the whole package that includes the kernel and other software to provide a usable computing environment. The kernel cannot be used alone by end-users, but the OS (which includes the kernel) provides the functionality users interact with. So Together, the user applications and the kernel make up the entire Operating System.
Programming Languages
1. Machine Language (Low-Level Language)
Description: The most basic type of programming language, consisting entirely of binary code (0s and 1s) that the computer’s CPU can execute directly.
Characteristics:
- Fastest and most efficient.
- Very hard for humans to read and write.
- Each instruction is specific to a particular computer architecture.
Example:
- `10110000 01100001` (a binary instruction for an x86 processor)
2. Assembly Language (Low-Level Language)
Description: A step above machine language, assembly language uses symbolic names (mnemonics) instead of binary codes to represent instructions.
Characteristics:
- Easier to read than machine language but still closely tied to hardware.
- Requires an assembler to translate code into machine language.
- Each assembly language is specific to a particular CPU architecture.
Example:
- `MOV AL, 61h` (moves the hexadecimal value 61 into the AL register on an x86 CPU)
3. High-Level Language
Description: These languages are closer to human languages and further from machine code. They allow programmers to write instructions using more natural language and abstract concepts.
Characteristics:
- Easier to learn, use, and maintain.
- Platform-independent (can run on different types of hardware with little or no modification).
- Require a compiler or interpreter to translate into machine code.
Examples:
- Python: `print(“Hello, World!”)`
- Java: `System.out.println(“Hello, World!”);`
- C++: `cout << “Hello, World!”;`
Summary Table:
Type | Abstraction | Example Code | Human Readable | Hardware Specific |
Machine Language | Lowest | 10110000 01100001 | No | Yes |
Assembly Language | Low | MOV AL, 61h | Partially | Yes |
High-Level | High | print(“Hello”) | Yes | No |
Learning basics about Assembly Language programming would be a great starting point to understand how a computer loads and executes any program by using different components such as CPU, Memory and Hard Disk.
Hope you enjoyed reading this article. Thank you..
Leave a Reply
You must be logged in to post a comment.