Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 41

LECTURE-16

Working with command line interface In LINUX


MULTIPROGRAMMING
 Goal of multiprogramming is to efficiently utilize all of the
computing resources.
 I/O devices very slow
 When a job issues an I/O request (e.g., open a file, read data
from a file), it cannot continue until the request is fulfilled.
 The CPU then becomes idle (the job is blocked on the request).
 When one program is waiting for I/O, another can use the CPU
MULTIPROGRAMMING:
 Multiprogramming is a technique to execute number of
programs simultaneously by a single processor.
 In Multiprogramming, number of processes reside in main
memory at a time.
 The OS picks and begins to executes one of the jobs in the
main memory.
 If any I/O wait happened in a process, then CPU switches from
that job to another job.
 Hence CPU in not idle at any time.
MULTIPROGRAMMING
(CONTD…):
OS • Figuredepicts the layout of
multiprogramming system.
Job 1
• The main memory consists of 5
Job 2 jobs at a time, the CPU executes
one by one.
Job 3
Advantages:
Job 4 •Efficient memory utilization

Job 5 •Throughput increases


•CPU is never idle, so
performance increases.
MULTITASKING
 Using multiprogramming to handle multiple interactive
jobs
 Processor’s time is shared among multiple users

 Multiple users simultaneously access the system through


terminals
TIME SHARING SYSTEMS:
 Time sharing, or multitasking, is a logical extension of
multiprogramming.
 Multiple jobs are executed by switching the CPU between
them.
 In this, the CPU time is shared by different processes, so it is
called as “Time sharing Systems”.
 Time slice is defined by the OS, for sharing CPU time between
processes.
 Examples: Multics, Unix, etc.,
User 2

User 3 Shared
User1
Computer

User 4
User 2

User 3 Shared
User1
Computer

User 4
User 2

User 3 Shared
User1
Computer

User 4
User 2

User 3 Shared
User1
Computer

User 4
ADVANTAGES
 User Interact to the system
 Context Switching is introduced
MULTIPROCESSING
 There are multiple processors
 These processors share same main memory and I/O facilities
 All processors can perform the same functions
MULTIPROCESSING
 Running program, job and process almost interchangeably.
 Independent process cannot affect or be affected by the execution of
another process.
 Cooperating process can affect or be affected by the execution of
another process
 Perhaps exchanging info or control via some mechanisms (comm &
sync)
 – Advantages of process cooperation (concurrency)
 • Information sharing
 • Computation speed-up
 • Modularity
 • Convenience
MODERN OPERATING SYSTEMS
 Multithreading
 Process is divided into threads that can run concurrently

15
 Thread
 Dispatchable unit of work
 executes sequentially and is interruptable

 Process is a collection of one or more threads


TYPES OF OS:
Operating System can also be classified as,-

 Single User Systems

 Multi User Systems


SINGLE USER SYSTEMS:

 Provides a platform for only one user at a time.

 They are popularly associated with Desk Top operating


system which run on standalone systems where no user
accounts are required.
 Example: DOS
MULTI-USER SYSTEMS:

 Provides regulated access for a number of users by


maintaining a database of known users.

 Refers to computer systems that support two or more


simultaneous users.

 Another term for multi-user is time sharing.

 Ex: All mainframes and  are multi-user systems.


 Example: Unix
WHAT IS LINUX
 Linux is, in simplest terms, an operating system.
 Linux is an open source software.

 Linux is a multitask and multiuser operating system.

 The Linux operating system is written in the C


programming language.
WHY USE LINUX/UNIX?

 System is written in a high-level language => easy to read,

20
understand, change and port to other machines.
 Simpler user interface or user services
 Provides simple routines to write complex programs/develop
utilities
 Hierarchical file system for easy maintenance
 Consistent format for files (byte streams) making application
development easier
 Simple, consistent interface to peripheral devices
THE BIRTH OF LINUX

 On August 25, 1991,


 By LINUS Torvalds: a Finn computer science student

 Torvalds built the core of the Linux operating system,


known as the kernel.
UNIX Architecture

• Kernel
Application Programs
• Shell
UNIX commands and

22
libraries
• Utilities
System call
interface

bash

H/W

who
Kernel

wc

vi
Some Basic Characteristics of Linux

• Multi-user System

23
• Multiprogramming/Multitasking system

• Uses Time Sharing

• Access rights for Files and Processes

• Uses File and Process hierarchies


Linux File System

Characteristics:

• Hierarchical structure

24
• Consistent treatment of file data
• Ability to create, modify and delete files
• Dynamic growth of files
• Protection of file data
• Treating peripheral devices (terminals, tapes, etc.) as
files
Linux File System Layout (RedHat)

25
Directory Structure of Linux File System

Directory Content
Common programs, shared by the system, the system administrator and
/bin
the users.

26
The startup files and the kernel, vmlinuz. In recent distributions also grub
/boot data. Grub is the GRand Unified Boot loader and is an attempt to get rid
of the many different boot-loaders we know today.
Contains references to all the CPU peripheral hardware, which are
/dev
represented as files with special properties.
Most important system configuration files are in /etc, this directory
/etc
contains data similar to those in the Control Panel in Windows
/home Home directories of the common users.
/initrd (on some distributions) Information for booting. Do not remove!
Library files, includes files for all kinds of programs needed by the
/lib
system and the users.
Directory Structure of Linux File System
Directory Content
Every partition has a lost+found in its upper directory. Files that were saved during
/lost+found
failures are here.
/misc For miscellaneous purposes.

27
/mnt Standard mount point for external file systems, e.g. a CD-ROM or a digital camera.
/net Standard mount point for entire remote file systems
/opt Typically contains extra and third party software.
A virtual file system containing information about system resources. More information
/proc about the meaning of the files in proc is obtained by entering the command man proc in
a terminal window.
The administrative user's home directory. Mind the difference between /, the root
/root
directory and /root, the home directory of the root user.
/sbin Programs for use by the system and the system administrator.
/tmp Temporary space for use by the system.
/usr Programs, libraries, documentation etc. for all user-related programs.
Storage for all variable files and temporary files created by users, such as log files, the
/var mail queue, the print spooler area, space for temporary storage of files downloaded
from the Internet, or to keep an image of a CD before burning it.
Types of files in a Linux System

"On a UNIX system, everything is a file; if something is not a file, it is a


process."

28
Regular files : they contain normal data, for example text files, executable files
or programs, input for or output from a program and so on.
Directories: files that are lists of other files.
Special files: Devices treated as files, used for input and output. They exist
in /dev.
Links: a system to make a file or directory visible in multiple parts of the
system's file tree.
(Domain) sockets: a special file type, similar to TCP/IP sockets, providing inter-
process networking protected by the file system's access control.

Named pipes: act more or less like sockets and form a way for processes to
communicate with each other, without using network socket semantics.
Permissions of a file

•Read

29
•Write

•execute
Listing files in a Linux System
The -l option to ls displays the file type, using the first character of each input line:

psdg/Documents> ls –l

30
total 8
-rw-rw-r-- 1 psdg faculty 31744 Feb 21 17:56 samplefile1.doc
lrw-rw-r-- 1 psdg faculty 41472 Feb 21 17:56 samplefile2
drwxrwxr-x 2 psdg faculty 4096 Feb 25 11:50 os-course/
crw-rw-r-- 1 psdg faculty 41472 Feb 21 17:56 /dev/tty00

Symbol Meaning
- Regular file
d Directory
l Link
c Special file
s Socket
p Named pipe
User Accounts

• login nmes

31
• passwords

• user id

• group id

• Home directory
EVVIRONMENTS
 Gnome: GNU Network Object Model Environment
 KDE: K Desktop Environment.

 XFCE: XForms Common Environment

 LXDE. Lightweight X11 Desktop Environment


GNOME ENVIRONMENT
KDE ENVIRONMENT
TERMINOLOGIES USED IN LINUX
• Shell:
this is a program in the system that allows you to give
the commands you want to execute. It is the basic
programs that connects you to the operating system.
Types of shells :BASH , CSH,KSH
• Terminal:
A terminal consists of a screen and keyboard that one
uses to communicate remotely with a computer (the
host).
Types of terminal:
• Text , dumb , GUI
TERMINOLOGIES USED IN LINUX.
 Prompts:  
A prompt is a character or string of characters (such as $
or #) that the shell displays when it is ready to receive a
new command. You'll learn about the different types of
prompts and how to customize them to suit you and the
way you work.
SHELL COMMANDS
 ls: Displays a list of files in the current working
directory, like the dir command in DOS

• ls-l: Adding the option -l will give you a long listing


which includes the permissions, ownership, size, date/time,
and name of the files and directories...
SHELL COMMANDS
 Another example would be adding -a (ls -a) to list ALL the files in
the current directory, including hidden files.

-d list the name of the current directory


-f show directories with a trailing '/' executable files with a trailing
'*‘
-g show group ownership of file in long listing -i print the inode
number of each file
-r list all subdirectories encountered
-t sort by time modified instead of name
SHELL COMMANDS
 cd- Change Directories

 Touch- Creates a file known as "newfile.txt", if the file


does not already exist. If the file already exists the
accessed / modification time is updated for the file
newfile.txt
SHELL COMMANDS
rm- rm is the command used, to remove the file from
directory.
SHELL COMMANDS
mv: To move or rename a file

You might also like