01: The Computer System
The Computer System
Before getting into programming, we should understand how a computer system works. We will go into it in depth, but some basic knowledge is necessary first.
- A computer is an electronic device.
- A computer is used for calculations.
- A calculator is also an electronic machine but it can only perform one operation and waits for the next operation instructed by a human.
- A computer has the ability to store a set of instructions and load these instructions one by one and continue to perform operations accordingly until the list is finished.
- Every operation produces a result, and the computer has the ability to use this result for the next operation.
- The set or list of instructions is also called software, an app, or a program.
- We have different types of computers such as desktops, laptops, mobile phones, but all kinds of computers are the same, and they run computer programs in a similar fashion.
- Their basic components are also similar.
- The only difference between different computers is their appearance. Mobile phones are small and compact but desktops are large.
- Although all computers are the same, when developing a program, we should consider which kind of computing environment it will run in. We have four basic kinds of computing environments.
- Embedded Devices: Â These are very small computers such as calculators, digital sensors, CCTV cameras or health monitoring devices. These computers are not general-purpose, and the user only uses them for the specific purpose for which they were designed. For example, a CCTV camera is designed for capturing videos, not for playing games.
- Mobile Devices: Our common smart phones general-purpose. We can use a single device for different purposes such as listening to music, communication, or playing games. These are compact and are considered lower-end devices. Smart TV is also considered as a mobile device.
- Desktop / Laptops: These are also general-purpose devices with advanced capabilities like playing high-end games. Their larger screen provides a much better view and helps us manage many things at a single glance.
- Servers / Cloud: Normally, servers are a bunch of desktop computers that provide collective processing power. These are very expensive and difficult to maintain. These computers are managed by large organizations. These are also general-purpose but not for individual use. For example, we will not play games on these computers.
- All computers have specific software which manages its resources and allows applications to run on them with ease and security. This software is called an Operating System (OS).
- Windows, Linux, iOS, and Android are common examples of operating systems.
- Embedded computers require no operating system due to simplicity and limited resources. Â
- The computer consists of 3 basic hardware components.
- Processing Unit: This is a collection of different circuits that perform mathematical operations. For example, it contains the circuit for “Addition” that sums two numbers or may have a special circuit to calculate square root. A computer may have installed multiple CPUs in it.
- Memory: It is used for instruction and data storage before sending to the processing unit. It also stores the result produced by any operation. For example, when you want to add two numbers, it will hold the “Add” instruction and the numbers to be added. When instruction is executed, the processing unit stores the sum into memory.
- Input / Output devices: These devices use to send data in memory and also for getting data from memory. Any device can be used as an input or output device.
Figure 1: Working of Computer System
General Execution Procedure
- In the first step, instructions and data will be loaded to memory from an input device e.g. keyboard.
- Then this data is sent to the processing unit to perform mathematical operations by electronic circuits.
- After processing, the result is sent back to memory.
- In the final step, it is sent to an output device like monitor to show.
- You can also imagine that these steps are followed by all kinds of instructions and data. For example, if you want to play an audio file in VLC player, then the procedure works like this.
- When you double-click on the VLC player icon on your desktop, the VLC Player starts. In fact, the CPU sends an instruction to the hard disk (or SSD) to load VLC Player into memory.
- VLC Player is a software that plays audio and video files. Its instructions are loaded into memory.
- Then the CPU picks instructions from memory one by one and executes them. These instructions may be showing a splash screen, creating a player window and its components, and preparing an audio file to play.
- When you provide an audio file to play, data from this file is also loaded to memory from the hard disk.
- The VLC Player contains instructions on how to convert data from the file into sound.
- The application reads the file and sends data to the CPU, where the instructions are already loaded.
- CPU applies the instructions on data and produces the result.
- This result is sent back to the memory and the audio device picks up this result to produce sound.
Processing Unit
- The processing unit is the most important unit of a computer system. It is a collection of electronic circuits that have the ability to perform mathematical operations for example addition, subtraction, multiplication, division, and many others. A normal processor has the ability to perform hundreds of operations. This collection of circuits is called an instruction set.
- There are three types of processing units based on their working scheme.
- CPU (Central Processing Unit): These are considered general-purpose processors that are used in desktop, laptops, mobiles, and servers.
- GPU (Graphical Processing Unit): These processors are specifically designed for graphical processing and are used as assistant units of CPU. These units gained popularity in the 1980s by showing GUI (Graphical User Interface).
- ECU (Electronic Control Unit): These are small processors used in embedded systems that are also similar to CPU but very low data processing capability.
- Consider that the CPU (or any other type of processor) only executes a single instruction at once.
Memory
- Main memory is another vital part of any computer system; it is also called RAM or simply memory.
- It holds the instructions and data before and after processing.
- Its capacity is an important property.
- Its capacity is measured in the number of bytes. Each byte is an addressable location.
- Normally, the size of memory fits in a computer is a power of 2 like 2, 4, 8, 16, …
- Larger memory means better performance.
- GPUs have their own memory called VRAM.
- Different computers installed with different capacity of memory. Embedded devices require small memory (in KBs) and large computing devices require large memory.
Input / Output Devices
- Any device in the world may be attached to a computer as an input or output device.
- Keyboard, mouse, touch screen, monitor, WIFI, microphone and speaker are common devices which can be attached to the general-purpose computer.
- Every I/O system has three basic components to work with a computer.
- Hardware Device: This is the actual device which can be used with a computer. This device has the ability to convert real world data into electric signals. For example, a microphone converts the sound into electric signals.
- Interface Card: This is also a hardware device that converts electric signals to binary signals for input devices and also convert binary signals to electric signals for output devices.
- Driver: This is software that provides the set of rules of communication between operating system and interface card.
- Secondary storage like HDD or SSD has a special role in computer systems.
Operating System
- Operating System (OS) also has an important role in app development.
- OS is the resource manager of computer systems; no app is allowed to run without an OS.
- When you start your computer, the OS is first software that loads into memory and the CPU.
- All resources (CPU, memory and I/O) are under the custodianship of the OS.
- When developers complete the code, they create different runnable apps for different OSs. For example, developers have to build EXE for Windows and APK for Android. They also build an APP for iOS.
- This means app development is more about OS rather than the hardware.
- The operating system manages four basic components, CPU management, memory management, I/O management and file system management.
- Although the operating system is capable enough to manage and smoothly run all kinds of applications, sometimes, to increase the management performance, language vendors provide extra facilities.
- A system that provides computer management facilities with respect to some programming language is called “Framework”.
- Java, .Net, Node and Ruby on Rails are the popular frameworks.
- In many cases, app users must install the required framework on their machine before installing the application.
- Every framework is associated with one or more programming languages. Like .Net support multiple languages like VB.Net or C# but Java only support one language called Java.
- Some programming languages are supported by multiple frameworks. For instance, Python is a widely used language with many frameworks like Django, Flask, and FastAPI developed by different vendors. Similarly, PHP has several frameworks such as Laravel, CodeIgniter, Drupal, and Zend.
- Frameworks can be general-purpose or domain-specific. General-purpose frameworks like Java and .NET allow developers to build desktop, mobile, and web applications, while domain-specific frameworks such as Django are designed only for web development.








