Computer Architecture
The basic components of a computer are - Processor, Memory, Input / Output Devices & Buses
Processor
A central processing unit (CPU), also called as a processor, is the electronic circuitry within a computer that executes instructions that make up a computer program. The processor consists of -
- Arithmetic & Logic Unit - The arithmetic logic unit is that part of the CPU that handles all the calculations the CPU may need, e.g. Addition, Subtraction, Comparisons. It performs Logical Operations, Bit Shifting Operations, and Arithmetic Operation.
- Control Unit - A control unit (CU) handles all processor control signals. It directs all input and output flow, fetches the code for instructions and controls how data moves around the system.
- Registers - A processor register is a quickly accessible location available to a computer's processor. The various types of registers are - Accumulator, Program Counter (PC), Instruction Register (IR), etc.
Memory
The memory holds the instructions and the data that the program currently being executed by CPU requires. In a computer system this is the Random Access Memory (RAM).
Input / Output Devices
An input device is a piece of equipment that is used to provide data and control signals to the system. The most basic example for input devices is the keyboard and mouse.
An output device is any peripheral that receives data from a computer, usually for display, projection, or physical reproduction. The most basic example for output devices is the monitor and speaker.
Buses
Data is transmitted from one part of a computer to another, connecting all major internal components to the CPU and memory, by the means of Buses. Types:
- Data Bus: It carries data among the memory unit, the I/O devices, and the processor.
- Address Bus: It carries the address of data (not the actual data) between memory and processor.
- Control Bus: It carries control commands from the CPU (and status signals from other devices) in order to control and coordinate all the activities within the computer.

Basic architecture of a computer

Connection of various components via buses

A more detailed image of the architecture of a computer
Types of Systems
We first need to identify what out target system is. A target system can be a desktop, server or an embedded system. Depending on what our target system is, we choose the operating system.
Generally a GPOS is chosen for desktop and servers because desktops & servers are required to be perform multiple tasks that the user demands. On the other hand, embedded systems are made for once specific use case, say the control board in a washing maching, and hence a dedicated OS is required for this system. So, an RTOS is generally chosen for embedded systems.
(Source 1) (Source 2)
General Purpose Operating System (GPOS)
A GPOS is an essential component of any mobile device, server, or computer system, and is responsible for running all the applications in an installation. GPOS is great for performing multiple tasks at the same time, but issues with latency and synchronization make them less than ideal for time-sensitive applications.
Platforms like Linux, Windows, and Mac OS examples of GPOS.
Real-time Operating System (RTOS)
RTOS are software platforms designed for use cases in which time is of the essence, for example, in a nuclear power plant. Processing time must be far shorter than in a GPOS, and the execution pattern for applications and processes needs to be predictable.
Generally, RTOS runs on smaller, more lightweight hardware than GPOS, as larger hardware configurations tend to be less agile.
Two basic types of RTOS are -
- Hard RTOS - Here, the deadline is handled very strictly which means that given task must start executing on specified scheduled time, and must be completed within the assigned time duration. Here, a delay in obtaining a result from a task renders the result useless.
- Soft RTOS - In this type of RTOS, there is a deadline assigned for a specific job, but a delay for a small amount of time is acceptable by soft RTOS i.e., deadlines are handled softly. Here, a delay in obtaining a result will affect the throughput of the system.

GPOS vs RTOS
- In a GPOS, task scheduling is not always based on which application or process has priority. They typically use a “fairness” policy to dispatch threads and processes. An RTOS, on the other hand, always utilizes priority-based scheduling.
- The more threads that are running in a GPOS, the longer it will take to schedule and start executing a thread.
- In a GPOS, a high-priority thread cannot preempt a kernel call. In an RTOS, a low-priority task will be preempted by a high-priority one if necessary, even if it’s executing a kernel call.
- Where development is concerned, GPOS code generally isn’t modular in nature. RTOS kernel code, on the other hand, is designed to be scalable, so that developers can pick and choose kernel objects selectively.
Linux
- We know that Linux is a GPOS but then the Linux kernel can be configured to work on embedded systems as well. The modified kernel can be flashed into flash memory of the device and can be used to run the device.
- The linux kernel can also be configured into a RTOS. Patches such as PREEMPT_RT patch can be used to configure linux to be a RTOS.
- Linux Distros that are POSIX compliant are a soft RTOS. (More on this)
<aside>
💡 POSIX stands for Portable Operating System Interface to Unix Systems. This is a family of standards specified by the IEEE Computer Society for maintaining compatibility between operating systems. (Source)
</aside>