SlideShare a Scribd company logo
Sanjivani Rural Education Society’s
Sanjivani College of Engineering, Kopargaon-423 603
(An Autonomous Institute, Affiliated to Savitribai Phule Pune University, Pune)
NAAC ‘A’ Grade Accredited, ISO 9001:2015 Certified
Department of Computer Engineering
(NBA Accredited)
Prof. A. V. Brahmane
Assistant Professor
E-mail : brahmaneanilkumarcomp@sanjivani.org.in
Contact No: 91301 91301 Ext :145, 9922827812
Subject- Operating System and Administration (CO2013)
Unit I- Introduction to Operating System
Content
• General Overview
• History of Unix,
• System Structure User perspective,
• Operating system Services Assumptions about Hardware,
• Basic Concepts of Operating Systems,
• Kernel, shell and file system structure,
• Basic Concepts of Linux,
• Basic Commands of Linux, Advanced Linux Commands,
• Installation of Linux, Interactive Installation,
DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
General Overview
• Why UNIX became so popular
• The system is written in a high-level language, making it easy to read, understand, change, and
move to other machines.
• It has a simple user interface that has the power to provide the services that users want.
• It provides primitives that permit complex programs to be built from simpler programs.
• It uses a hierarchical file system that allows easy maintenance and efficient implementation.
• It uses a consistent format for files, the byte stream, making application programs easier to write.
• It provides a simple, consistent interface to peripheral devices.
• It is a multi-user, multiprocess system; each user can execute several processes simultaneously.
• It hides the machine architecture from the user, making it easier to write programs that run on
different hardware implementations.
DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
History
• 1969 - The Beginning The history of UNIX starts back in 1969, when Ken
Thompson, Dennis Ritchie and others started working on the "little-used PDP-7 in
a corner" at Bell Labs and what was to become UNIX.
• 1971 - First Edition It had a assembler for a PDP-11/20, file system, fork(), roff
and ed. It was used for text processing of patent documents.
• 1973 - Fourth Edition It was rewritten in C. This made it portable and changed the
history of OS's.
• 1975 - Sixth Edition UNIX leaves home. Also widely known as Version 6, this is the
first to be widely available out side of Bell Labs. The first BSD version (1.x) was
derived from V6.
• 1979 - Seventh Edition It was a "improvement over all preceding and following
Unices" [Bourne]. It had C, UUCP and the Bourne shell. It was ported to the VAX
and the kernel was more than 40 Kilobytes (K).
DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
• 1980 – Xenix Microsoft introduces Xenix. 32V and 4BSD introduced.
• 1982 - System IIIAT&T's UNIX System Group (USG) release System III, the first public
release outside Bell Laboratories. SunOS 1.0 ships. HP-UX introduced. Ultrix-11
Introduced.
• 1983 - System V Computer Research Group (CRG), UNIX System Group (USG) and a third
group merge to become UNIX System Development Lab. AT&T announces UNIX System
V, the first supported release. Installed base 45,000.
• 1984 - 4.2 BSD University of California at Berkeley releases 4.2BSD, includes TCP/IP, new
signals and much more. X/Open formed.
• 1984 - SVR2 System V Release 2 introduced. At this time there are 100,000 UNIX
installations around the world.
• 1986 - 4.3 BSD4.3BSD released, including internet name server. SVID introduced. NFS
shipped. AIX announced. Installed base 250,000.
DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
• 1987 - SVR3 System V Release 3 including STREAMS, TLI, RFS. At this time there
are 750,000 UNIX installations around the world. IRIX introduced.
• 1988 - POSIX.1 published. Open Software Foundation (OSF) and UNIX
International (UI) formed. Ultrix 4.2 ships.
• 1989 - AT&T UNIX Software Operation formed in preparation for spinoff of USL.
Motif 1.0 ships.
• 1989 - SVR4 UNIX System V Release 4 ships, unifying System V, BSD and Xenix.
Installed base 1.2 million.
• 1990 - XPG3X/Open launches XPG3 Brand. OSF/1 debuts. Plan 9 from Bell Labs
ships.
• 1991- UNIX System Laboratories (USL) becomes a company - majority-owned by
AT&T. Linus Torvalds commences Linux development. Solaris 1.0 debuts.
DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
Summary
• The Unix operating system found its beginnings in MULTICS, which stands for Multiplexed
Operating and Computing System. The MULTICS project began in the mid 1960s as a joint effort
by General Electric, Massachusetts Institute for Technology and Bell Laboratories. In 1969 Bell
Laboratories pulled out of the project.
• One of Bell Laboratories people involved in the project was Ken Thompson. He liked the potential
MULTICS had, but felt it was too complex and that the same thing could be done in simpler way.
In 1969 he wrote the first version of Unix, called UNICS. UNICS stood for Uniplexed Operating and
Computing System. Although the operating system has changed, the name stuck and was
eventually shortened to Unix.
• Ken Thompson teamed up with Dennis Ritchie, who wrote the first C compiler. In 1973 they
rewrote the Unix kernel in C. The following year a version of Unix known as the Fifth Edition was
first licensed to universities. The Seventh Edition, released in 1978, served as a dividing point for
two divergent lines of Unix development. These two branches are known as SVR4 (System V) and
BSD.
DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
• Ken Thompson spent a year's sabbatical with the University of California at
Berkeley. While there he and two graduate students, Bill Joy and Chuck Haley,
wrote the first Berkely version of Unix, which was distributed to students. This
resulted in the source code being worked on and developed by many different
people. The Berkeley version of Unix is known as BSD, Berkeley Software
Distribution. From BSD came the vi editor, C shell, virtual memory, Sendmail, and
support for TCP/IP.
• For several years SVR4 was the more conservative, commercial, and well
supported. Today SVR4 and BSD look very much alike. Probably the biggest
cosmetic difference between them is the way the ps command functions.
• The Linux operating system was developed as a Unix look alike and has a user
command interface that resembles SVR4.
DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
Architecture of UNIX Systems
DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
User perspective
• High level features of Unix OS such as ;
1. The File System
2. The processing environment
3. The Building Block Primitives
DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
The File System
• The Unix File System is Characterized by;
1. A hierarchical structure
2. consistent treatment of file data
3. the ability to create and delete files
4. dynamic growth of files
5. the protection of file data
6. the treatment of peripheral devices as files
• The file system is organized as a tree with a single root node called root (written '/'). Every non-
leaf node of the file system structure is a directory of files, and files at the leaf nodes of the tree
are either directories, regular files, or special device files.
DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
• Programs in the UNIX system have no knowledge of the internal format in which
the kernel stores file data, treating the data as an unformatted stream of bytes.
Programs may interpret the byte stream as they wish, but the interpretation has
no bearing on how the operating system stores the data.
• Directories are like regular files in this respect; the system treats the data in a
directory as a byte stream, but the data contains the names of the files in the
directory in a predictable format so that the operating system and programs such
as Is (list the names and attributes of files) can discover the files in a directory.
• Permission to access a file is controlled by access permissions associated with the
file. To the user, the UNIX system treats devices as if they were files.
DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
• root “ / “
• Non – leaf node is directory of files
• Files at leaf node are directories / regular files / special device files.
• Pathnames
• Current directory
• Directories
• Access permission
• The program to copy a file
DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
The Processing Environment
• Processes in Unix
• A program is just a file to Unix. In other words, when a user creates a source program
and then compiles it, the program resides on disk as an executable file. The
term process is used to describe a program that is actually running within the purview of
Unix. For example, when a user requests that a program be run in Unix, Unix must load
the program from the executable file on disk where it resides, build appropriate data
structures to keep track of that program as it runs, and then start it running. To Unix,
then, a process is just a (fairly complex) data structure in which Unix keeps all of the
information about the status of the program that is running.
• Process Creation in Unix: The fork System Call
• In order to begin understanding how Unix deals with processes, one must learn how Unix
creates processes in the first place. That is, how does Unix start a program (an
executable file on disk) running? We used the following two examples to discuss this.
•
DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
• In this example of Figure 1.3 we see how a program must call various functions in
order to do tasks that require accessing hardware and are therefore only
available through services provided by the operating system. the printf, exit, and
open are all examples of such calls. Internally the functions accessed by these
calls must have, in their machine language form, the equivalent of a TRAP
instruction, which does the actual call to the Unix system service in question.
• In Figure 1.4 we see an example of the fork() system call. The fork call accesses
the fork service in Unix, which
• creates a new complete copy of program main, including all of its data and code
areas as they exist right now as the current process for main is running. That is, if
the current process that is the code for main is P25 (the parent process), then a
new process, say, P50 (the child process) is created which looks exactly like P25
right now (all of the registers, data values, etc. are the same...this is not a fresh
copy of main but a copy of this process as it now is).
DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
• sets up the call stack for the newly created child process P50 to make it appear that P50 has been
executed into the fork() call and is about to return from fork() with a return value of zero
• sets up the call stack for the parent process P25 to have a return value that is not zero from fork()
• allows either the child process or the parent process to run, putting the other on the ready to run
queue.
• When the child process, P50, starts running it does so by returning from the call to fork() with a
return value of zero. This means that it executes the exec1 system call, which
• replaces the program and data areas of P50 with a new program (program copy in this case)
• starts the new program running (copy)
• When the parent process, P25, resumes running it does so by returning from the call to fork()
with a nonzero return value. This means that P25 executes the wait system call. This again
causes a Unix service to be accessed which "puts this process to sleep" by putting its data
structure into a wait queue. When the child process (P50) finishes executing, Unix will wake up
any process (including P25) that was waiting for P50 to finish and put the data structure for that
process (e.g., P25) on the ready to run queue.
DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
Building Block Primitives
• List the building block primitives of UNIX with examples.
• Unix enables to Write Small modular Program that can be Used as building block to build more complex programs. There 2
Primitives:
• 1. I/O redirection
2. Pipe(|)
• I/O REDIRECTION
• Most unix command read input, such as a file or another attribute for the command, and write output. By default, input is
being given with the keyboard, and output is displayed on your screen. Your keyboard is your standard input (stdin) device,
and the screen or a particular terminal window is the standard output (stdout) device.
• Output redirection with > and | :
• Sometimes you will want to put output of a command in a file, or you may want to issue another command on the output
of one command. This is known as redirecting output. Redirection is done using either the “>” (greater-than symbol), or
using the “|” (pipe) operator which sends the standard output of one command to another command as standard input.
The file descriptor 0 is assigned to the standard output file.
• Eg: cat1 test1 > test2
• the cat command concatenates files and puts them all together to the standard output. By redirecting this output to a file,
this file name will be created - or overwritten if it already exists, so take care.
DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
• Input redirection
• In another case, you may want a file to be the input for a command that normally
wouldn't accept a file as an option. This redirecting of input is done using the “<”
(less-than symbol) operator. The file descriptor 1 is assigned to the standard input
file.
• Eg: cat <test1
• In this the cat will take each line of file test1 as input and display it on the
monitor.
• Error Redirection
• When invalid command is typed at the $prompt the shell displays error message
on the monitor.Thus the monitor is reffered as standard error file. The file
descriptor 2 is assigned to the standard error file.
DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
• PIPES
• Unix has a feature by which filters and other commands can be combined in such
a way that the standard output of 1 filter command can be sent as standard input
to another filter or command.
• $ ls –l|wc –l
• It is the command to display the no of total lines in current directory.
• $ grep –n `and’ test
• Command to display the no of lines where the word ‘and’ occurs in a file test.
DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
Operating system Services Assumptions about Hardware
• These are the services provided by the kernel:
• Controlling the execution of processes by allowing their creation, termination or
suspension, and communication.
• Scheduling processes fairly for execution of the CPU. Processes share the CPU in
a time-shared manner: the CPU executes a process, the kernel suspends it when
its time quantum elapses, and the kernel schedules another process to execute.
The kernel later reschedules the suspended process.
DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
• Allocating main memory for an executing process. The kernel allows processes to
share portions of their address space under certain conditions, but protects the
private address space of a process from outside tampering. If the system runs low
on free memory, the kernel frees memory by writing a process temporarily to
secondary memory, called a swap device. If the kernel writes entire processes to
a swap device, the implementation of the UNIX system is called
a swapping system; if it writes pages of memory to a swap device, it is called
a paging system.
• Allocating secondary memory for efficient storage and retrieval of user data. This
service constitutes the file system. The kernel allocates secondary storage for
user files, reclaims unused storage, structures the file system in a well understood
manner, and protects user files from illegal access.
• Allowing processes controlled access to peripheral devices such as terminals, tape
drives, disk drives, and network devices.
DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
Assumptions about Hardware
• The execution of user processes in a UNIX system is divided in two levels: user
and kernel. When a process executes a system call, its execution mode changes
from user mode to kernel mode. Even if the user process doesn't make a system
call, the operating system still does bookkeeping work that relates to the user
process, handling interrupts, scheduling processes, managing memory, and so on.
• Processes in user mode can access their own instructions and data. Processes in
kernel mode however, can access kernel and user addresses.
• Some machine instructions are privileged and result in an error when executed in
user mode.
• In the diagram (on next slide), the operating system views from the top (or
bottom), it sees which processes are running. However, the hardware view if
from the left (or right), it sees which mode is currently active.
DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
Multiple processes and modes of execution
DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
• Interrupts and Exceptions
• The UNIX system allows devices such as I/O peripherals or the system clock to
interrupt the CPU asynchronously. On receipt of an interrupt, the kernel saves its
current context (a frozen image of what the processor was doing), determines the
cause of the interrupt, and services the interrupt. After servicing the interrupt, it
restores its interrupted context and begins execution as if nothing had happened.
The hardware usually prioritizes devices according to the order that interrupts
should be handled: When the kernel services an interrupt, it blocks out lower
priority interrupts but services higher priority interrupts.
DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
• An exception condition refers to unexpected events caused by a process, such as
addressing illegal memory, executing privileged instructions, dividing by zero, and
so on. They are distinct from interrupts, which are caused by events that are
external to a process.
• Exceptions happen "in the middle" of the execution of an instruction, and the
system attempts to restart the instruction after handling the exception; interrupts
are considered to happen between the execution of two instruction, and the
system continues with the next instruction after servicing the interrupt. The UNIX
system uses one mechanism to handle interrupts and exception conditions.
DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
• Processor Execution Levels
• The kernel sometimes wants to prevent occurrence of interrupts
when it is doing some important work (such as modifying kernel data
structures). In such situations, if the interrupts are not prevented, the
kernel itself might get corrupt. Computers typically have a set of
privileged instructions that set the processor execution level in the
processor status word. Setting the processor execution level to
certain values masks off interrupts from the level and lower levels,
allowing only higher-level interrupts.
• In fig on next slide, typical interrupts levels are shown.
DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
• Memory Management
• The kernel permanently resides in the main memory. When compiling a program,
the compiler generates a set of addresses in the program that represent
addresses of variables and data structures of the addresses of instructions such
as functions. The compiler generates the addresses for a virtual machine as if no
other program will execute simultaneously on the physical machine. When the
program is run on the machine, the kernel allocates space in main memory for it,
but the virtual addresses generated by the compiler need not be identical to the
physical addresses that they occupy in the machine. The kernel coordinates with
the machine hardware to set up a virtual to physical address translation that
maps the compiler-generated addresses to the physical machine addresses.
DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
Basic concept of OS
• An operating system (OS) is a collection of software that manages computer
hardware resources and provides common services for computer programs. The
operating system is a vital component of the system software in a computer
system. This tutorial will take you through step by step approach while learning
Operating System concepts.
• Why to Learn Operating System?
• An Operating System (OS) is an interface between a computer user and computer
hardware. An operating system is a software which performs all the basic tasks
like file management, memory management, process management, handling
input and output, and controlling peripheral devices such as disk drives and
printers.
• Some popular Operating Systems include Linux Operating System, Windows
Operating System, VMS, OS/400, AIX, z/OS, etc.
DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
• Following are some of important functions of an operating System.
• Memory Management
• Processor Management
• Device Management
• File Management
• Security
• Control over system performance
• Job accounting
• Error detecting aids
• Coordination between other software and users
DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
• Applications of Operating System
• Following are some of the important activities that an Operating System performs −
• Security − By means of password and similar other techniques, it prevents unauthorized
access to programs and data.
• Control over system performance − Recording delays between request for a service and
response from the system.
• Job accounting − Keeping track of time and resources used by various jobs and users.
• Error detecting aids − Production of dumps, traces, error messages, and other debugging
and error detecting aids.
• Coordination between other softwares and users − Coordination and assignment of
compilers, interpreters, assemblers and other software to the various users of the
computer systems.
DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
Kernel
• Operating System
• An operating system (OS) is a collection of software that manages computer
hardware resources and acts as an interface between user and hardware of the
computer. It provides common services for computer programs. The OS is a
crucial component of the system software in a computer system.
• Kernel
• Kernel is the core part of operating system and responsible for all major activities
of this operating system. Kernel consists of various modules and it interacts
directly with the low level hardware. It also provides the required abstraction to
hide low level hardware details to system or application programs. An operating
system is unable to run without the kernel as it is the important program for the
working of the computer system.
DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
• The differences between kernel and OS are;
DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
Sr.No. Kernel OS
1 Kernel is the core part of operating system Operating system (OS) is a collection of software that
manages computer hardware resources
2 It acts as an interface between software and
hardware of the computer system.
It acts as an interface between user and hardware of
the computer
3 It plays an important role in memory
management, task management, process
management and disk management.
It responsible for protection and security of the
computer system.
4 Monolithic Kernel and Micro kernel are the
two types of kernel.
Single and Multiprogramming batch system,
Distributed operating system, Real-time operating
system are the types of operating system.
Shell
• A shell script is a computer program designed to be run by the Unix/Linux shell
which could be one of the following:
• The Bourne Shell
• The C Shell
• The Korn Shell
• The GNU Bourne-Again Shell
• A shell is a command-line interpreter and typical operations performed by shell
scripts include file manipulation, program execution, and printing text.
DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
• Extended Shell Scripts
• Shell scripts have several required constructs that tell the shell environment what
to do and when to do it. Of course, most scripts are more complex than the
above one.
• The shell is, after all, a real programming language, complete with variables,
control structures, and so forth. No matter how complicated a script gets, it is still
just a list of commands executed sequentially.
DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
• The following script uses the read command which takes the input from the keyboard and assigns
it as the value of the variable PERSON and finally prints it on STDOUT.
• #!/bin/sh
• # Author : Zara Ali
• # Copyright (c) Tutorialspoint.com
• # Script follows here:
• echo "What is your name?"
• read PERSON echo "Hello, $
• PERSON"
DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
• Here is a sample run of the script −
• $./test.sh What is your name?
• Zara Ali
• Hello, Zara Ali
• $
DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
• Shell prompts –
• The prompt, $, which is called the command prompt, is issued by the shell. While
the prompt is displayed, you can type a command.
• Shell Types –
• 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.
DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
• 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)
DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
• Shell Scripts – The basic concept of a shell script is a list of commands, which
are listed in the order of execution. A good shell script will have comments,
preceded by # sign, describing the steps.
• There are conditional tests, such as value A is greater than value B, loops allowing
us to go through massive amounts of data, files to read and store data, and
variables to read and store data, and the script may include functions.
• We are going to write many scripts in the next sections. It would be a simple text
file in which we would put all our commands and several other required
constructs that tell the shell environment what to do and when to do it.
• Shell scripts and functions are both interpreted. This means they are not
compiled.
•
DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
Basic concept of Linux
• Linux is one of popular version of UNIX operating System. It is open source as its source
code is freely available. It is free to use. Linux was designed considering UNIX
compatibility. Its functionality list is quite similar to that of UNIX.
• Components of Linux System
• Linux Operating System has primarily three components
• Kernel − Kernel is the core part of Linux. It is responsible for all major activities of this
operating system. It consists of various modules and it interacts directly with the
underlying hardware. Kernel provides the required abstraction to hide low level
hardware details to system or application programs.
• System Library − System libraries are special functions or programs using which
application programs or system utilities accesses Kernel's features. These libraries
implement most of the functionalities of the operating system and do not requires kernel
module's code access rights.
• System Utility − System Utility programs are responsible to do specialized, individual
level tasks.
DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
• Kernel Mode Vs User Mode
• Kernel component code executes in a special privileged mode called kernel
mode with full access to all resources of the computer. This code represents a
single process, executes in single address space and do not require any context
switch and hence is very efficient and fast. Kernel runs each processes and
provides system services to processes, provides protected access to hardware to
processes.
• Support code which is not required to run in kernel mode is in System Library.
User programs and other system programs works in User Mode which has no
access to system hardware and kernel code. User programs/ utilities use System
libraries to access Kernel functions to get system's low level tasks.
DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
• Basic Features - Following are some of the important features of Linux Operating System.
• Portable − Portability means software can works on different types of hardware in same way. Linux
kernel and application programs supports their installation on any kind of hardware platform.
• Open Source − Linux source code is freely available and it is community based development project.
Multiple teams work in collaboration to enhance the capability of Linux operating system and it is
continuously evolving.
• Multi-User − Linux is a multiuser system means multiple users can access system resources like
memory/ ram/ application programs at same time.
• Multiprogramming − Linux is a multiprogramming system means multiple applications can run at same
time.
• Hierarchical File System − Linux provides a standard file structure in which system files/ user files are
arranged.
• Shell − Linux provides a special interpreter program which can be used to execute commands of the
operating system. It can be used to do various types of operations, call application programs. etc.
• Security − Linux provides user security using authentication features like password protection/
controlled access to specific files/ encryption of data.
DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
Basic Linux Commands
pwd vi grep passwd
ls sudo head wc
cd df tail clear
mkdir and rmdir du diff date
rm tar chown cal
touch zip , unzip jobs who
man uname kill whoami
cp apt-get wget reboot
mv chmod top tty
locate hostname history ps
echo ping useradd
cat find userdel
DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
Advanced Linux Commands
netstat
ip
ifconfig
nslookup
dig
mkfs.ext4
rsync
mysqldump
uptime
talk
DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
Installation of Linux, Interactive Installation,
• How to Dual Boot Ubuntu 20.04 LTS and Windows 10
• Youtube Link –
• https://www.youtube.com/watch?v=-iSAyiicyQY&t=637s
DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
• Thank you …
DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon

More Related Content

PPT
Spsl unit1
PPTX
Ch1-Unix.pptx
PPT
Introduction to Unix operating system Chapter 1-PPT Mrs.Sowmya Jyothi
DOC
Introduction to unix
PDF
unixoperatingsystem-130327073532-phpapp01.pdf
PPTX
UNIX_module1.pptx
PPTX
PPTX
Introduction to unix (1).pptx
Spsl unit1
Ch1-Unix.pptx
Introduction to Unix operating system Chapter 1-PPT Mrs.Sowmya Jyothi
Introduction to unix
unixoperatingsystem-130327073532-phpapp01.pdf
UNIX_module1.pptx
Introduction to unix (1).pptx

Similar to Unit 1 Introduction to Operating System.ppt (20)

PPT
PPTX
Unix seminar
PPTX
Unix Introduction
PPTX
Introduction to Unix Concets.pptx
PPTX
Introduction to Unix Concets.pptx
PPTX
Introduction to Unix
PPTX
Unix operating system
PDF
Unix - An Introduction
PDF
cse-iv-unix-and-shell-programming-10cs44-notes.pdf
PPT
Module1-UNIX architecture; FEATURES OF UNIX OS
PPTX
Unix Introduction
PPT
Intro tounix (1)
DOCX
Unix seminar
PDF
Kernel linux lab manual feb (1)
PPTX
Chapter 1: Introduction to Unix / Linux Kernel
PPTX
Unix case-study
PPTX
Unix and shell programming | Unix File System | Unix File Permission | Blocks
PDF
UNIX_Module 1.pdf
PDF
DOC_LM_Chap 1 and 2. document -1 unix.pdf
PPT
UNIX introduction
Unix seminar
Unix Introduction
Introduction to Unix Concets.pptx
Introduction to Unix Concets.pptx
Introduction to Unix
Unix operating system
Unix - An Introduction
cse-iv-unix-and-shell-programming-10cs44-notes.pdf
Module1-UNIX architecture; FEATURES OF UNIX OS
Unix Introduction
Intro tounix (1)
Unix seminar
Kernel linux lab manual feb (1)
Chapter 1: Introduction to Unix / Linux Kernel
Unix case-study
Unix and shell programming | Unix File System | Unix File Permission | Blocks
UNIX_Module 1.pdf
DOC_LM_Chap 1 and 2. document -1 unix.pdf
UNIX introduction
Ad

More from AnilkumarBrahmane2 (20)

PPT
Data Mining and Warehousing Concept and Techniques
PPT
Data Mining and Warehousing Concept and Techniques
PPT
Data Mining and Warehousing Concept and Techniques
PPT
Data Mining and Warehousing Concept and Techniques
PPT
Data Mining and Warehousing Concept and Techniques
PPT
Data Mining and Warehousing Concept and Techniques
PPT
Data Mining and Warehousing Concept and Techniques
PPT
Data Mining and Warehousing Concept and Techniques
PPT
Data Mining and Warehousing Concept and Techniques
PPTX
Unit - I Sentiment anlysis with logistic regression.pptx
PDF
Unit - II Sentiment Analysis with Naive Bayes.pdf
PPTX
Unit - III Vector Space Model in Natura Languge Processing .pptx
PPTX
Unit - II Sentiment Analysis with Naive Bayes.pptx
PPTX
Unit - IV Machine Translation in Natural Languge Processing .pptx
PDF
Unit_ 5.3 Interprocess communication.pdf
PDF
Unit 5.2 Device Driver.pdf (Device Driver)
PPT
Unit 5.1 Memory Management_Device Driver_IPC.ppt
PPT
Unit 4 File Management System.ppt (File Services)
PPT
Unit 3.2 Process Control.ppt (Process Control and Scheduling)
PPT
Unit 3.1 The Structure of Process, Process Control, Process Scheduling.ppt
Data Mining and Warehousing Concept and Techniques
Data Mining and Warehousing Concept and Techniques
Data Mining and Warehousing Concept and Techniques
Data Mining and Warehousing Concept and Techniques
Data Mining and Warehousing Concept and Techniques
Data Mining and Warehousing Concept and Techniques
Data Mining and Warehousing Concept and Techniques
Data Mining and Warehousing Concept and Techniques
Data Mining and Warehousing Concept and Techniques
Unit - I Sentiment anlysis with logistic regression.pptx
Unit - II Sentiment Analysis with Naive Bayes.pdf
Unit - III Vector Space Model in Natura Languge Processing .pptx
Unit - II Sentiment Analysis with Naive Bayes.pptx
Unit - IV Machine Translation in Natural Languge Processing .pptx
Unit_ 5.3 Interprocess communication.pdf
Unit 5.2 Device Driver.pdf (Device Driver)
Unit 5.1 Memory Management_Device Driver_IPC.ppt
Unit 4 File Management System.ppt (File Services)
Unit 3.2 Process Control.ppt (Process Control and Scheduling)
Unit 3.1 The Structure of Process, Process Control, Process Scheduling.ppt
Ad

Recently uploaded (20)

PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
RMMM.pdf make it easy to upload and study
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PDF
O7-L3 Supply Chain Operations - ICLT Program
PPTX
Cell Structure & Organelles in detailed.
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
Basic Mud Logging Guide for educational purpose
PDF
VCE English Exam - Section C Student Revision Booklet
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PDF
Classroom Observation Tools for Teachers
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PPTX
GDM (1) (1).pptx small presentation for students
PDF
TR - Agricultural Crops Production NC III.pdf
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
Pre independence Education in Inndia.pdf
PDF
Computing-Curriculum for Schools in Ghana
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
RMMM.pdf make it easy to upload and study
Pharmacology of Heart Failure /Pharmacotherapy of CHF
O7-L3 Supply Chain Operations - ICLT Program
Cell Structure & Organelles in detailed.
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
Microbial diseases, their pathogenesis and prophylaxis
Basic Mud Logging Guide for educational purpose
VCE English Exam - Section C Student Revision Booklet
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
Classroom Observation Tools for Teachers
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
STATICS OF THE RIGID BODIES Hibbelers.pdf
GDM (1) (1).pptx small presentation for students
TR - Agricultural Crops Production NC III.pdf
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Final Presentation General Medicine 03-08-2024.pptx
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
Pre independence Education in Inndia.pdf
Computing-Curriculum for Schools in Ghana

Unit 1 Introduction to Operating System.ppt

  • 1. Sanjivani Rural Education Society’s Sanjivani College of Engineering, Kopargaon-423 603 (An Autonomous Institute, Affiliated to Savitribai Phule Pune University, Pune) NAAC ‘A’ Grade Accredited, ISO 9001:2015 Certified Department of Computer Engineering (NBA Accredited) Prof. A. V. Brahmane Assistant Professor E-mail : brahmaneanilkumarcomp@sanjivani.org.in Contact No: 91301 91301 Ext :145, 9922827812 Subject- Operating System and Administration (CO2013) Unit I- Introduction to Operating System
  • 2. Content • General Overview • History of Unix, • System Structure User perspective, • Operating system Services Assumptions about Hardware, • Basic Concepts of Operating Systems, • Kernel, shell and file system structure, • Basic Concepts of Linux, • Basic Commands of Linux, Advanced Linux Commands, • Installation of Linux, Interactive Installation, DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
  • 3. General Overview • Why UNIX became so popular • The system is written in a high-level language, making it easy to read, understand, change, and move to other machines. • It has a simple user interface that has the power to provide the services that users want. • It provides primitives that permit complex programs to be built from simpler programs. • It uses a hierarchical file system that allows easy maintenance and efficient implementation. • It uses a consistent format for files, the byte stream, making application programs easier to write. • It provides a simple, consistent interface to peripheral devices. • It is a multi-user, multiprocess system; each user can execute several processes simultaneously. • It hides the machine architecture from the user, making it easier to write programs that run on different hardware implementations. DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
  • 4. History • 1969 - The Beginning The history of UNIX starts back in 1969, when Ken Thompson, Dennis Ritchie and others started working on the "little-used PDP-7 in a corner" at Bell Labs and what was to become UNIX. • 1971 - First Edition It had a assembler for a PDP-11/20, file system, fork(), roff and ed. It was used for text processing of patent documents. • 1973 - Fourth Edition It was rewritten in C. This made it portable and changed the history of OS's. • 1975 - Sixth Edition UNIX leaves home. Also widely known as Version 6, this is the first to be widely available out side of Bell Labs. The first BSD version (1.x) was derived from V6. • 1979 - Seventh Edition It was a "improvement over all preceding and following Unices" [Bourne]. It had C, UUCP and the Bourne shell. It was ported to the VAX and the kernel was more than 40 Kilobytes (K). DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
  • 5. • 1980 – Xenix Microsoft introduces Xenix. 32V and 4BSD introduced. • 1982 - System IIIAT&T's UNIX System Group (USG) release System III, the first public release outside Bell Laboratories. SunOS 1.0 ships. HP-UX introduced. Ultrix-11 Introduced. • 1983 - System V Computer Research Group (CRG), UNIX System Group (USG) and a third group merge to become UNIX System Development Lab. AT&T announces UNIX System V, the first supported release. Installed base 45,000. • 1984 - 4.2 BSD University of California at Berkeley releases 4.2BSD, includes TCP/IP, new signals and much more. X/Open formed. • 1984 - SVR2 System V Release 2 introduced. At this time there are 100,000 UNIX installations around the world. • 1986 - 4.3 BSD4.3BSD released, including internet name server. SVID introduced. NFS shipped. AIX announced. Installed base 250,000. DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
  • 6. • 1987 - SVR3 System V Release 3 including STREAMS, TLI, RFS. At this time there are 750,000 UNIX installations around the world. IRIX introduced. • 1988 - POSIX.1 published. Open Software Foundation (OSF) and UNIX International (UI) formed. Ultrix 4.2 ships. • 1989 - AT&T UNIX Software Operation formed in preparation for spinoff of USL. Motif 1.0 ships. • 1989 - SVR4 UNIX System V Release 4 ships, unifying System V, BSD and Xenix. Installed base 1.2 million. • 1990 - XPG3X/Open launches XPG3 Brand. OSF/1 debuts. Plan 9 from Bell Labs ships. • 1991- UNIX System Laboratories (USL) becomes a company - majority-owned by AT&T. Linus Torvalds commences Linux development. Solaris 1.0 debuts. DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
  • 7. Summary • The Unix operating system found its beginnings in MULTICS, which stands for Multiplexed Operating and Computing System. The MULTICS project began in the mid 1960s as a joint effort by General Electric, Massachusetts Institute for Technology and Bell Laboratories. In 1969 Bell Laboratories pulled out of the project. • One of Bell Laboratories people involved in the project was Ken Thompson. He liked the potential MULTICS had, but felt it was too complex and that the same thing could be done in simpler way. In 1969 he wrote the first version of Unix, called UNICS. UNICS stood for Uniplexed Operating and Computing System. Although the operating system has changed, the name stuck and was eventually shortened to Unix. • Ken Thompson teamed up with Dennis Ritchie, who wrote the first C compiler. In 1973 they rewrote the Unix kernel in C. The following year a version of Unix known as the Fifth Edition was first licensed to universities. The Seventh Edition, released in 1978, served as a dividing point for two divergent lines of Unix development. These two branches are known as SVR4 (System V) and BSD. DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
  • 8. • Ken Thompson spent a year's sabbatical with the University of California at Berkeley. While there he and two graduate students, Bill Joy and Chuck Haley, wrote the first Berkely version of Unix, which was distributed to students. This resulted in the source code being worked on and developed by many different people. The Berkeley version of Unix is known as BSD, Berkeley Software Distribution. From BSD came the vi editor, C shell, virtual memory, Sendmail, and support for TCP/IP. • For several years SVR4 was the more conservative, commercial, and well supported. Today SVR4 and BSD look very much alike. Probably the biggest cosmetic difference between them is the way the ps command functions. • The Linux operating system was developed as a Unix look alike and has a user command interface that resembles SVR4. DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
  • 9. Architecture of UNIX Systems DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
  • 10. User perspective • High level features of Unix OS such as ; 1. The File System 2. The processing environment 3. The Building Block Primitives DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
  • 11. The File System • The Unix File System is Characterized by; 1. A hierarchical structure 2. consistent treatment of file data 3. the ability to create and delete files 4. dynamic growth of files 5. the protection of file data 6. the treatment of peripheral devices as files • The file system is organized as a tree with a single root node called root (written '/'). Every non- leaf node of the file system structure is a directory of files, and files at the leaf nodes of the tree are either directories, regular files, or special device files. DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
  • 12. DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
  • 13. • Programs in the UNIX system have no knowledge of the internal format in which the kernel stores file data, treating the data as an unformatted stream of bytes. Programs may interpret the byte stream as they wish, but the interpretation has no bearing on how the operating system stores the data. • Directories are like regular files in this respect; the system treats the data in a directory as a byte stream, but the data contains the names of the files in the directory in a predictable format so that the operating system and programs such as Is (list the names and attributes of files) can discover the files in a directory. • Permission to access a file is controlled by access permissions associated with the file. To the user, the UNIX system treats devices as if they were files. DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
  • 14. • root “ / “ • Non – leaf node is directory of files • Files at leaf node are directories / regular files / special device files. • Pathnames • Current directory • Directories • Access permission • The program to copy a file DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
  • 15. DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
  • 16. The Processing Environment • Processes in Unix • A program is just a file to Unix. In other words, when a user creates a source program and then compiles it, the program resides on disk as an executable file. The term process is used to describe a program that is actually running within the purview of Unix. For example, when a user requests that a program be run in Unix, Unix must load the program from the executable file on disk where it resides, build appropriate data structures to keep track of that program as it runs, and then start it running. To Unix, then, a process is just a (fairly complex) data structure in which Unix keeps all of the information about the status of the program that is running. • Process Creation in Unix: The fork System Call • In order to begin understanding how Unix deals with processes, one must learn how Unix creates processes in the first place. That is, how does Unix start a program (an executable file on disk) running? We used the following two examples to discuss this. • DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
  • 17. • In this example of Figure 1.3 we see how a program must call various functions in order to do tasks that require accessing hardware and are therefore only available through services provided by the operating system. the printf, exit, and open are all examples of such calls. Internally the functions accessed by these calls must have, in their machine language form, the equivalent of a TRAP instruction, which does the actual call to the Unix system service in question. • In Figure 1.4 we see an example of the fork() system call. The fork call accesses the fork service in Unix, which • creates a new complete copy of program main, including all of its data and code areas as they exist right now as the current process for main is running. That is, if the current process that is the code for main is P25 (the parent process), then a new process, say, P50 (the child process) is created which looks exactly like P25 right now (all of the registers, data values, etc. are the same...this is not a fresh copy of main but a copy of this process as it now is). DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
  • 18. • sets up the call stack for the newly created child process P50 to make it appear that P50 has been executed into the fork() call and is about to return from fork() with a return value of zero • sets up the call stack for the parent process P25 to have a return value that is not zero from fork() • allows either the child process or the parent process to run, putting the other on the ready to run queue. • When the child process, P50, starts running it does so by returning from the call to fork() with a return value of zero. This means that it executes the exec1 system call, which • replaces the program and data areas of P50 with a new program (program copy in this case) • starts the new program running (copy) • When the parent process, P25, resumes running it does so by returning from the call to fork() with a nonzero return value. This means that P25 executes the wait system call. This again causes a Unix service to be accessed which "puts this process to sleep" by putting its data structure into a wait queue. When the child process (P50) finishes executing, Unix will wake up any process (including P25) that was waiting for P50 to finish and put the data structure for that process (e.g., P25) on the ready to run queue. DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
  • 19. DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
  • 20. Building Block Primitives • List the building block primitives of UNIX with examples. • Unix enables to Write Small modular Program that can be Used as building block to build more complex programs. There 2 Primitives: • 1. I/O redirection 2. Pipe(|) • I/O REDIRECTION • Most unix command read input, such as a file or another attribute for the command, and write output. By default, input is being given with the keyboard, and output is displayed on your screen. Your keyboard is your standard input (stdin) device, and the screen or a particular terminal window is the standard output (stdout) device. • Output redirection with > and | : • Sometimes you will want to put output of a command in a file, or you may want to issue another command on the output of one command. This is known as redirecting output. Redirection is done using either the “>” (greater-than symbol), or using the “|” (pipe) operator which sends the standard output of one command to another command as standard input. The file descriptor 0 is assigned to the standard output file. • Eg: cat1 test1 > test2 • the cat command concatenates files and puts them all together to the standard output. By redirecting this output to a file, this file name will be created - or overwritten if it already exists, so take care. DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
  • 21. • Input redirection • In another case, you may want a file to be the input for a command that normally wouldn't accept a file as an option. This redirecting of input is done using the “<” (less-than symbol) operator. The file descriptor 1 is assigned to the standard input file. • Eg: cat <test1 • In this the cat will take each line of file test1 as input and display it on the monitor. • Error Redirection • When invalid command is typed at the $prompt the shell displays error message on the monitor.Thus the monitor is reffered as standard error file. The file descriptor 2 is assigned to the standard error file. DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
  • 22. • PIPES • Unix has a feature by which filters and other commands can be combined in such a way that the standard output of 1 filter command can be sent as standard input to another filter or command. • $ ls –l|wc –l • It is the command to display the no of total lines in current directory. • $ grep –n `and’ test • Command to display the no of lines where the word ‘and’ occurs in a file test. DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
  • 23. Operating system Services Assumptions about Hardware • These are the services provided by the kernel: • Controlling the execution of processes by allowing their creation, termination or suspension, and communication. • Scheduling processes fairly for execution of the CPU. Processes share the CPU in a time-shared manner: the CPU executes a process, the kernel suspends it when its time quantum elapses, and the kernel schedules another process to execute. The kernel later reschedules the suspended process. DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
  • 24. • Allocating main memory for an executing process. The kernel allows processes to share portions of their address space under certain conditions, but protects the private address space of a process from outside tampering. If the system runs low on free memory, the kernel frees memory by writing a process temporarily to secondary memory, called a swap device. If the kernel writes entire processes to a swap device, the implementation of the UNIX system is called a swapping system; if it writes pages of memory to a swap device, it is called a paging system. • Allocating secondary memory for efficient storage and retrieval of user data. This service constitutes the file system. The kernel allocates secondary storage for user files, reclaims unused storage, structures the file system in a well understood manner, and protects user files from illegal access. • Allowing processes controlled access to peripheral devices such as terminals, tape drives, disk drives, and network devices. DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
  • 25. Assumptions about Hardware • The execution of user processes in a UNIX system is divided in two levels: user and kernel. When a process executes a system call, its execution mode changes from user mode to kernel mode. Even if the user process doesn't make a system call, the operating system still does bookkeeping work that relates to the user process, handling interrupts, scheduling processes, managing memory, and so on. • Processes in user mode can access their own instructions and data. Processes in kernel mode however, can access kernel and user addresses. • Some machine instructions are privileged and result in an error when executed in user mode. • In the diagram (on next slide), the operating system views from the top (or bottom), it sees which processes are running. However, the hardware view if from the left (or right), it sees which mode is currently active. DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
  • 26. Multiple processes and modes of execution DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
  • 27. • Interrupts and Exceptions • The UNIX system allows devices such as I/O peripherals or the system clock to interrupt the CPU asynchronously. On receipt of an interrupt, the kernel saves its current context (a frozen image of what the processor was doing), determines the cause of the interrupt, and services the interrupt. After servicing the interrupt, it restores its interrupted context and begins execution as if nothing had happened. The hardware usually prioritizes devices according to the order that interrupts should be handled: When the kernel services an interrupt, it blocks out lower priority interrupts but services higher priority interrupts. DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
  • 28. • An exception condition refers to unexpected events caused by a process, such as addressing illegal memory, executing privileged instructions, dividing by zero, and so on. They are distinct from interrupts, which are caused by events that are external to a process. • Exceptions happen "in the middle" of the execution of an instruction, and the system attempts to restart the instruction after handling the exception; interrupts are considered to happen between the execution of two instruction, and the system continues with the next instruction after servicing the interrupt. The UNIX system uses one mechanism to handle interrupts and exception conditions. DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
  • 29. • Processor Execution Levels • The kernel sometimes wants to prevent occurrence of interrupts when it is doing some important work (such as modifying kernel data structures). In such situations, if the interrupts are not prevented, the kernel itself might get corrupt. Computers typically have a set of privileged instructions that set the processor execution level in the processor status word. Setting the processor execution level to certain values masks off interrupts from the level and lower levels, allowing only higher-level interrupts. • In fig on next slide, typical interrupts levels are shown. DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
  • 30. DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
  • 31. • Memory Management • The kernel permanently resides in the main memory. When compiling a program, the compiler generates a set of addresses in the program that represent addresses of variables and data structures of the addresses of instructions such as functions. The compiler generates the addresses for a virtual machine as if no other program will execute simultaneously on the physical machine. When the program is run on the machine, the kernel allocates space in main memory for it, but the virtual addresses generated by the compiler need not be identical to the physical addresses that they occupy in the machine. The kernel coordinates with the machine hardware to set up a virtual to physical address translation that maps the compiler-generated addresses to the physical machine addresses. DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
  • 32. Basic concept of OS • An operating system (OS) is a collection of software that manages computer hardware resources and provides common services for computer programs. The operating system is a vital component of the system software in a computer system. This tutorial will take you through step by step approach while learning Operating System concepts. • Why to Learn Operating System? • An Operating System (OS) is an interface between a computer user and computer hardware. An operating system is a software which performs all the basic tasks like file management, memory management, process management, handling input and output, and controlling peripheral devices such as disk drives and printers. • Some popular Operating Systems include Linux Operating System, Windows Operating System, VMS, OS/400, AIX, z/OS, etc. DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
  • 33. • Following are some of important functions of an operating System. • Memory Management • Processor Management • Device Management • File Management • Security • Control over system performance • Job accounting • Error detecting aids • Coordination between other software and users DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
  • 34. • Applications of Operating System • Following are some of the important activities that an Operating System performs − • Security − By means of password and similar other techniques, it prevents unauthorized access to programs and data. • Control over system performance − Recording delays between request for a service and response from the system. • Job accounting − Keeping track of time and resources used by various jobs and users. • Error detecting aids − Production of dumps, traces, error messages, and other debugging and error detecting aids. • Coordination between other softwares and users − Coordination and assignment of compilers, interpreters, assemblers and other software to the various users of the computer systems. DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
  • 35. Kernel • Operating System • An operating system (OS) is a collection of software that manages computer hardware resources and acts as an interface between user and hardware of the computer. It provides common services for computer programs. The OS is a crucial component of the system software in a computer system. • Kernel • Kernel is the core part of operating system and responsible for all major activities of this operating system. Kernel consists of various modules and it interacts directly with the low level hardware. It also provides the required abstraction to hide low level hardware details to system or application programs. An operating system is unable to run without the kernel as it is the important program for the working of the computer system. DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
  • 36. • The differences between kernel and OS are; DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon Sr.No. Kernel OS 1 Kernel is the core part of operating system Operating system (OS) is a collection of software that manages computer hardware resources 2 It acts as an interface between software and hardware of the computer system. It acts as an interface between user and hardware of the computer 3 It plays an important role in memory management, task management, process management and disk management. It responsible for protection and security of the computer system. 4 Monolithic Kernel and Micro kernel are the two types of kernel. Single and Multiprogramming batch system, Distributed operating system, Real-time operating system are the types of operating system.
  • 37. Shell • A shell script is a computer program designed to be run by the Unix/Linux shell which could be one of the following: • The Bourne Shell • The C Shell • The Korn Shell • The GNU Bourne-Again Shell • A shell is a command-line interpreter and typical operations performed by shell scripts include file manipulation, program execution, and printing text. DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
  • 38. • Extended Shell Scripts • Shell scripts have several required constructs that tell the shell environment what to do and when to do it. Of course, most scripts are more complex than the above one. • The shell is, after all, a real programming language, complete with variables, control structures, and so forth. No matter how complicated a script gets, it is still just a list of commands executed sequentially. DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
  • 39. • The following script uses the read command which takes the input from the keyboard and assigns it as the value of the variable PERSON and finally prints it on STDOUT. • #!/bin/sh • # Author : Zara Ali • # Copyright (c) Tutorialspoint.com • # Script follows here: • echo "What is your name?" • read PERSON echo "Hello, $ • PERSON" DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
  • 40. • Here is a sample run of the script − • $./test.sh What is your name? • Zara Ali • Hello, Zara Ali • $ DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
  • 41. • Shell prompts – • The prompt, $, which is called the command prompt, is issued by the shell. While the prompt is displayed, you can type a command. • Shell Types – • 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. DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
  • 42. • 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) DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
  • 43. • Shell Scripts – The basic concept of a shell script is a list of commands, which are listed in the order of execution. A good shell script will have comments, preceded by # sign, describing the steps. • There are conditional tests, such as value A is greater than value B, loops allowing us to go through massive amounts of data, files to read and store data, and variables to read and store data, and the script may include functions. • We are going to write many scripts in the next sections. It would be a simple text file in which we would put all our commands and several other required constructs that tell the shell environment what to do and when to do it. • Shell scripts and functions are both interpreted. This means they are not compiled. • DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
  • 44. Basic concept of Linux • Linux is one of popular version of UNIX operating System. It is open source as its source code is freely available. It is free to use. Linux was designed considering UNIX compatibility. Its functionality list is quite similar to that of UNIX. • Components of Linux System • Linux Operating System has primarily three components • Kernel − Kernel is the core part of Linux. It is responsible for all major activities of this operating system. It consists of various modules and it interacts directly with the underlying hardware. Kernel provides the required abstraction to hide low level hardware details to system or application programs. • System Library − System libraries are special functions or programs using which application programs or system utilities accesses Kernel's features. These libraries implement most of the functionalities of the operating system and do not requires kernel module's code access rights. • System Utility − System Utility programs are responsible to do specialized, individual level tasks. DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
  • 45. DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
  • 46. • Kernel Mode Vs User Mode • Kernel component code executes in a special privileged mode called kernel mode with full access to all resources of the computer. This code represents a single process, executes in single address space and do not require any context switch and hence is very efficient and fast. Kernel runs each processes and provides system services to processes, provides protected access to hardware to processes. • Support code which is not required to run in kernel mode is in System Library. User programs and other system programs works in User Mode which has no access to system hardware and kernel code. User programs/ utilities use System libraries to access Kernel functions to get system's low level tasks. DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
  • 47. • Basic Features - Following are some of the important features of Linux Operating System. • Portable − Portability means software can works on different types of hardware in same way. Linux kernel and application programs supports their installation on any kind of hardware platform. • Open Source − Linux source code is freely available and it is community based development project. Multiple teams work in collaboration to enhance the capability of Linux operating system and it is continuously evolving. • Multi-User − Linux is a multiuser system means multiple users can access system resources like memory/ ram/ application programs at same time. • Multiprogramming − Linux is a multiprogramming system means multiple applications can run at same time. • Hierarchical File System − Linux provides a standard file structure in which system files/ user files are arranged. • Shell − Linux provides a special interpreter program which can be used to execute commands of the operating system. It can be used to do various types of operations, call application programs. etc. • Security − Linux provides user security using authentication features like password protection/ controlled access to specific files/ encryption of data. DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
  • 48. Basic Linux Commands pwd vi grep passwd ls sudo head wc cd df tail clear mkdir and rmdir du diff date rm tar chown cal touch zip , unzip jobs who man uname kill whoami cp apt-get wget reboot mv chmod top tty locate hostname history ps echo ping useradd cat find userdel DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
  • 50. Installation of Linux, Interactive Installation, • How to Dual Boot Ubuntu 20.04 LTS and Windows 10 • Youtube Link – • https://www.youtube.com/watch?v=-iSAyiicyQY&t=637s DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon
  • 51. • Thank you … DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon