As a computer science student what basic terms of hardware system you should know will be discussed in this post. This post will briefly touch the following terms —
Binary Number System, OS, Compiler, RAM, CPU, BUS, Process, Thread, Deadlock, Memory Hierarchy, CPU Scheduling
Binary Number System
Number systems are intended to express numbers in different formats. The most commonly used is the Decimal Number System. But Computers can only understand Binary Numbers (0 and 1).
An operating system is layer in between software and hardware. The main responsibility of an OS is to use hardware to accomplish software's tasks.
We write code in a higher-level language which is not understandable by computer hardware. As we know computer only knows how to execute binary numbers. So, the compiler is responsible for converting higher-level terms to lower-level terms (machine understandable code).
Random Access Memory. To store something, computer uses different types of space like RAM, Hard Disk, etc. Ram is volatile. It stores data temporally. At first data is available in Hard Disk. When a task needs to be done, the instructions of that task is loaded into the memory (RAM). Data swap between Ram and Hard Disk by following proper scheduling methods.
As I said when a task is needed to be executed, it must be available in RAM. But who executes the task mainly. Its CPU which is actually executing task. CPU is a short term of Central Processing Unit. To execute an instruction, CPU has two core parts, ALU (Arithmetic Logic Unit) and CU (Control Unit). Control unit at first interprets an instruction and based on the interpreted results ALU performs arithmetic or logical operations.
BUSes are used to interconnect between hardware components. Basically these are some sort of wires. They are mostly used for data sharing, address passing.
Processes are the essential for executing any tasks. Suppose, a C code you write, is responsible for checking a number is prime or not. It is not able to execute until it is loaded into the memory. So, in short executable program in memory is called Process. A process has 5 states.
new: process is being created
ready: process is ready for execution
running: process is being run in the processor
waiting: process is waiting for some event to occur
terminated: process is done with execution
Process control block contains details of a particular process like its state, process scheduling information, PC-next instruction to execute, etc.
In a sense, process and thread are same. Main difference is Multiple processes have different memory space whereas Multiple threads can have shared memory space. Threads are lightweight.
Thread T1 is requesting a resource 1 and holding resource 2. It will leave the resource 2 if it gets the resource 1. On the other hand, thread T0 is waiting for resource 2 and holding resource 1. By this way, both are locked and cant move forward. This is called Deadlock.
In short, to run any process, it is loaded into main memory from secondary memory. And then, CPU runs instructions of a process from main memory. Registers are closer to the CPU than Cache, Main Memory and Secondary Memory. Capacity increases from top to bottom. Access time decreases from bottom to top.
What process will go next to the CPU is selected based on some scheduling algorithms, such as, FCFS (first come first serve), SJF (shortest job first), RR (Round Robin), Priority Scheduling, etc.
FCFS: The process that requests the CPU first is allocated the CPU
SJF: When the CPU is available it is assigned to the process that
has the smallest next CPU burst time.
RR: Each process gets a small unit of CPU time. After this time has elapsed, the process is swapped with the next process in list which is going to be in CPU for fixed unit of time.
I will keep updating the terms in the coming days. Till then go through the post, to sharp your brain on basic Operating System terms.
Thank you for your time. If you liked this article, make sure to follow my Medium profile and check out some other articles of mine!