Linux os concepts internals applications in a nutshell


Article contents

Linux Operating System

Why Linux operating system?

Linux is the most commonly used open source operating system today. As an operating system, it sits underneath all of the other software, receiving requests from other software programs and relaying these requests to the computer's hardware.

In this article we will go through linux operating systems concepts and applications. You will get guidance with relevant theory and practical source code programs, illustrations to understand how linux is practically used in the system to implement project requirements.

Online courses related to this article


Course description

Learn to develop embedded systems, interfacing electronic peripherals through real time projects and get required practical skills for software jobs



Course description

Learn to develop software solutions for linux environment, implement requirements through real time projects and get required practical skills for software jobs

Hardware

Hardware basics.

An operating system works closely with the hardware system. The operating system acts as the interface between user and hardware. So in order to fully understand the Linux operating system, you need to understand the basics of the underlying hardware. At minimum a computer system consists of a CPU or microprocessor, the memory and a number of slots for the peripheral controllers.

CPU calculates, performs logical operations and manages data flows by reading instructions from memory and then executing them. CPU operates on binary data where each digit represents a power of 2. Generally numbers are represented by hexadecimal where each digit represents a power of 16. So 8 is written in binary as 0b1000 and in hex as 0x08. Similary 14 is written in binary as 0b1110 and in hex as 0x0E.

The CPU execution is driven by the system clock(e.g. 100MHz) which generates regular clock pulses to the processor and at each clock pulse, the cpu does some work. For example an instruction can be to read the contents of memory at location A into register B. So CPU executes one or more instruction every clock pulse. Registers are the CPU's internal storage, used for storing data and performing operations on it and can be 32 bit/64 bit wide.

Most CPUs have special purpose registers such as Program Counter which points to the next instruction to be executed, Stack pointer which helps in accessing, saving and restoring large amount of external read/write RAM for facilitating temporary storage of data, processor status to hold information like the current state of the processor(e.g. kernel mode and user mode).

Instructions have to be fetched from memory as they are executed. Read only memory(ROM) are used to store permanent data and RAM is used for temporary storage of data. System bus is divided into three logical functions, the address bus which specifies the memory locations (addresses) for the data transfers, the data bus((bidirectional and allows data to be read into the CPU and written from the CPU) which holds the data transfered and the control bus contains various lines used to route timing and control signals throughout the system. Peripherals are real devices, such as graphics cards or disks controlled by controller chips on the system board or on cards plugged into it.

Linux command line interface

Linux commands usage illustrations.

Linux is a unix-like operating system. In linux all commands are run using a terminal provided by the linux system. The linux terminal can be used to do all administrative tasks. The linux commands are broadly divided into File System Commands, Process Management Commands, File Permission Commands, Searching commands, System Info Commands, File Compression Commands, Networking Commands, Process Management commands. All these category of commands are illustrated by examples.

Process, thread in linux

A process in linux.

A process is an active program i.e. a program that is under execution. It is more than the program code as it includes the program counter, process stack, registers, program code etc. Compared to this, the program code is only the text section. All the practical aspects of how to create different types of processes, running the process and observing the process in the linux process list are illustrated

A thread in linux.

A thread is a lightweight process that can be managed independently by a scheduler. It improves the application performance using parallelism. A thread has to be created by a parent process. All the practical aspects of how to create threads, managing threads are illustrated here

Difference between process and thread

Following are the difference between a linux process and thread.

  • A process is a program under execution i.e an active program. A thread is a lightweight process that can be managed independently by a scheduler.
  • Processes require more time for context switching as they are more heavy. Threads require less time for context switching as they are lighter than processes.
  • Processes are totally independent and don’t share memory. A thread may share some memory with its peer threads.
  • Communication between processes requires more time than between threads. Communication between threads requires less time than between processes.
  • If a process gets blocked, remaining processes can continue execution. If a user level thread gets blocked, all of its peer threads also get blocked.
  • Processes require more resources than threads. Threads generally need less resources than processes.
  • Individual processes are independent of each other. Threads are parts of a process and so are dependent.
  • Processes have independent data and code segments. A thread shares the data segment, code segment, files etc. with its peer threads.
  • All the different processes are treated separately by the operating system. All user level peer threads are treated as a single task by the operating system.
  • Processes require more time for creation and termination. Threads require less time for creation and termination.
  • To Read Full Article

    Start any course from the following
    Share