Unit1: Introduction To Linux Operating System
Unit1: Introduction To Linux Operating System
INTRODUCTION TO LINUX
OPERATING SYSTEM
Introduction and types of OS
• An Operating System (OS) is a software that
acts as an interface between computer
hardware components and the user.
• Every computer system must have at least one
operating system to run other programs.
• Applications like Browsers, MS Office, Notepad
Games, etc., need some environment to run
and perform its tasks.
Types of OS
Types of Operating System (OS)
• Single user
• Multiuser
• Batch Operating System
• Multitasking/Time Sharing OS
• Real Time OS
• Distributed OS
• Network OS
• Mobile OS
Linux operating system
• Linux, computer operating system develped in
the early 1990s by Finnish software engineer
Linus Torvalds.
• On October 5, 1991, Linus announced the first
“official” version of Linux, version 0.02.
• Linux distributions can be broadly categorized
into two groups:
First is commercial distros, and the second
includes the noncommercial distros,or spins.
Linux Operating System
• Examples of commercial flavors of Linux-based
distros are RHEL, SuSE Linux Enterprise (SLE),
etc.
• The noncommercial distros, on the other
hand, are free and open source.
• Examples of noncommercial flavors of Linux-
based distros are Fedora,OpenSuSE, Ubuntu,
goBuntu, Debian, etc.
Linux Operating System
• Linux is one of popular version of UNIX operating
System.
• It is open source and free.
• Linux can run on any x86 or x64 based PC.
• Ubuntu, federo,Redhat linux are some of the linux
distributions.
• Every Linux distribution comes with basic
applications like text editor, media player, office
applications and games like soltaire, chess etc.
Who uses Linux
• Linux can be used in super computers, smart
phones, servers,PC etc.
• Android is the most popular mobile O.S which
is based on linux kernel.
• The main use of Linux in all these is
maintenance cost is less.
Features
• Portable
• Opensource
• Multiuser
• Multiprogramming
• Shell
• Hierarchical File system
• Security
Architecture of Linux
Architecture of Linux
The architecture of a Linux System consists of
the following layers :
• Hardware Layer
• Kernel
• Shell
• Utilities
Shell interface
• Shell is a program which provides the interface
between the user and an operating system.
• The shell accepts and interprets commands and
forwards them to the kernel.
• Users cant interface with the OS without the shell.
• We can access a shell through a program called
Terminal.
• There are number of shells developed for UNIX like
systems each with different commands, syntax and
functions.
• In Unix, there are two major types of shells −
Bourne shell − If you are using a Bourne-type shell, the $ character is the
default prompt.
C shell − If you are using a C-type shell, the % character is the default prompt.
• The Bourne Shell has the following subcategories −
Bourne shell (sh)
Korn shell (ksh)
Bourne Again shell (bash)
POSIX shell (sh)
• The different C-type shells follow −
C shell (csh)
TENEX/TOPS C shell (tcsh)
Linux System calls
• A system call is a request made by a program
to the operating system.
• It is a way in which the user request a service
from the kernel of OS.
• System calls are the only entry points into the
kernel system. All programs needing resources
must use system calls.
Linux System calls
• Types of System Calls : There are 5 different
categories of system calls –
– Process control: end, abort, create, terminate,
allocate and free memory.
– File management: create, open, close, delete,
read file etc.
– Device management
– Information maintenance
– Communication
Linux System Calls
System Call Services
• Process Control • fork()
exit()
wait()
exec()
• File Manipulation • open()
read()
write()
close()
• Device Manipulation • ioctl()
read()
write()
Linux System Calls
• Information • getpid()
Maintenance alarm()
sleep()
• Communication • pipe()
shmget()
mmap()
• chmod()
• Protection
umask()
chown()
Shared memory management
• Shared memory is a memory shared between
two or more processes.
• It is an extra piece of memory that is attached
to some address spaces.
• Shared memory is a feature supported by
UNIX system V,including Linux,SunOS,Solarsis.
• The following figure shows two processes and
their address spaces.
Shared Memory Management
Process 1 Process2
Shared Memory
chmod 777 myfile Will assign read, write and execute permissions to
all owner, group and others (rwxrwxrwx)
chown -R ali mydir It will change the ownership of the Directory mydir for
the user ali, -R option will change ownership of the
sub directories residing inside mydir as well.
chgrp -R usman mydir It will change the group ownership of the directory mydir
for the user usman, -R option will change group
ownership of the sub directories residing inside mydir
as well.
Multiprocessing in Linux
• A computers capability to process more than one task
simultaneously is called multiprocessing.
• A multiprocessor operating system is capable of
running many programs simultaneously.
• Main objective of using multiprocessor operating
system is to consume high computing power and
increase the execution speed of system.
• There are mainly two types of multiprocessor systems.
These are −
Symmetric Multiprocessor System
Asymmetric Multiprocessor System
• Multiprocessing systems can be represented
as:
Word Web antivirus
Email
processor browser
Operating System
CPU1 CPU2
• Operating systems which can run multiple
applications/processes are example of
Multitasking. Eg.) Windows OS can run Word
Processor and play music in a media player
simultaneously.
• In symmetric multiprocessing, multiple processors
share a common memory and operating system.
• Symmetric multiprocessing is also known as tightly
coupled multiprocessing as all the CPU’s are
connected at the bus level and have access to a
shared memory.
• All the parallel processors in symmetric
multiprocessing have their private cache memory to
decrease system bus traffic and also reduce the data
access time.
• Symmetric multiprocessing is useful for time sharing
systems as these have multiple processes running in
parallel.
• Asymmetric Multiprocessing system is a
multiprocessor computer system where not all
of the multiple interconnected central
processing units (CPUs) are treated equally.
• In asymmetric multiprocessing, only a master
processor runs the tasks of the operating
system.
• Asymmetric multiprocessor system contains a
master slave relationship.
Load sharing
• load sharing entails sending a portion of the
traffic to one server and another portion
elsewhere.
• The loads do not need to be equal, they just
need to be set up in a way that does not
overwhelm the entire system.
• It improves total network performance.
Multithreading
• "Multithreading is a conceptual programming paradigm
where a process is divided into a number of sub-
processes called as threads.
• A single application/process can do multiple operations
simultaneously is example of Multithreading. Eg.) Word
Processor can print text on editor while user typing and
same time spell check will happen.
• One thread listens to Keyboard events and write text on
editor and another thread runs the spell check algorithm.
• "Thread is the path followed while executing a program.
Each thread has its own program counter, stack and
register."
• A thread is a light weight process.
Capabilities of superuser
• root is the superuser on Linux system. root is the first user
created during the process of installing any Linux distro like
Ubuntu for example.
• Most administration tasks, such as adding users or
managing file systems require that you first log in as root
(UID=0) .
• The root account, also known as the superuser account, is
used to make system changes and can override user file
protection.
• root has unlimited powers, and can do anything on system
hence the term superuser is used.
• The root user can do many things an ordinary user cannot,
such as installing new software, changing the ownership of
files, and managing other user accounts.