Chap1 - Operating System
Chap1 - Operating System
1
WHAT IS OPERATING
SYSTEM?
• An operating system is a program that manages the computer
hardware.
• It acts as an mediator between the computer user and
hardware.
Operating System
Computer
Hardware
4
OPERATING SYSTEM
DEFINITIONS
DIFFERENT
OPERATING • Windows - NT.
SYSTEMS
• LINUX.
7
OPERATING SYSTEM –
WINDOWS 98
Features of Windows-98:
1. Easier to use: Single User Multitasking OS.
Because of GUI, it is more user friendly and hence one can open
program by single click.
2. Faster: By using maintenance wizard & FAT32 file system, one can
efficiently store & save hard disk space and hence can improve computer
speed.
3. True Web Integration: Connection to web is simple, web pages can
be viewed in windows and hence is easier and faster.
4. More Entertaining: It supports DVD and digital audio and hence one
can play digital movies and audio and also television on computer.
Operating System 8
OPERATING SYSTEM –
WINDOWS NT
Features of Windows-NT:
1. 32-bit OS.
2. Multiuser, Multitasking & Multithreading OS.
3. Symmetric Multiprocessing allows to schedule various tasks on any
CPU in multiprocessor system.
4. Supports virtual memory management, File transfer, E-mail services
and resource sharing on network.
5. This OS uses New Technology File Transfer (NTFS).
6. NTFS implements fault tolerance, security and has support for very
large files.
Operating System 9
OPERATING SYSTEM – LINUX
Features of LINUX:
1
Operating System 0
OPERATING SYSTEM SERVICES
1
Operating System 2
1. Create a child 2. Wait for child
System Calls
process identical process to
in PM
to parent. terminate.
4. Change the
3. Terminate a 5. Block a
priority of a
process. process.
process.
1
3
MEMORY MANAGEMENT (MM)
1
Operating System 4
System Calls in MM
1
5
INFORMATION MANAGEMENT
(IM)
1
Operating System 6
3. Open a file
System Calls 2. Create a
1. Create a file. (for read, write
in IM directory.
or both)
1
7
PROCESS MANAGEMENT
18
Process management means managing the process or processor i.e. the CPU.
A program does nothing unless its instructions are executed by a CPU.
In multiuser OS, several users located at different terminals run same or the
different programs. In such case, the operating system must keep track of all these
programs/process.
19
Process State
TERMINATE
D
NEW interrupt
exit
admitted
RUNNING
READY
Scheduler dispatch
20
As a process executes, it changes state. The state of a process is defined in
part by the current activity of that process. Each process may be in one of
the
following state:-
21
PROCESS SCHEDULING
24
PRIORITY
• .
Context switching
28
MULTITASKING
Here, two task are defined within the same process. They run
concurrently within the same process if synchronized properly. If task 0
is blocked, instead of blocking entire process, the OS will find out
whether task 1 can be scheduled. When both tasks are blocked, only
then entire process is blocked. Again, if one task is ready, the process can
be moved to ready list and then scheduled.
30
MEMORY
MANAGEMENT
31
• The services in memory management keep track of all memory
locations.
• They determine memory allocation policy and use various techniques
and algorithms to achieve this.
• To use various techniques and algorithms to allocate or deallocate
memory allocations.
32
MEMORY MAP OF SINGLE
OS
• The operating system like DOS is a single operating user system.
• The memory map of such operating systems consists of program to be
executed
• The command interpreter of the single user operating system is invoked
when the computer started.
• The OS load program to be executed in main memory and assigns as
much memory as possible to it.
• If program is terminated, then its is removed from memory.
• The kernel of such OS provides basic operating systems services, while
the command interpreter interprets the commands.
Partitioning
• Certain OS uses partitioned memory management method, to
allow multiprogramming.
• Partitioning means dividing main memory into various sections.
These sections are called partitions.
• There are two types of partitions:-
1. Fixed Partitions
2.Variable Partitions
34
• Fixed Partitions:-
• Here partitions could be of different sizes. But once decided, their size
cannot be changed.
• In this method partitions are fixed at the time of system generation.
• It is also called as static partitions.
• Once declaring fixed partition, the OS creates Partition
• Description Table (PDT). This table indicates the base and size of
each partition, along with its status.(whether F: Free or A: Allocated).
0 0 50 K A
1 50 K 50 K F
2 100 K 50 K A
3 150 K 100 K A
Advantages
1. The implementation is very simple.
2. The processing overheads are low.
Disadvantages
1. The degree of multiprogramming is fixed as the number of
partitions is fixed.
2. Suffers from internal fragmentation.
36
Variable Partitions:-
38
Non- Contiguous memory allocation
39
Paging
40
• Partitions suffer from external fragmentation because of available
41
Page 0 0 Page 3
1 Page 0
Page 1
2
Page 2
3 Page 2
Page 3
4 Page 1
Logical memory
5
Physical memory
0 1
1 4
2 3
3 0
42
Address generated by CPU is divided into:
Page number (p) – used as an index into a page table which contains base
address of each page in physical memory.
Page offset (d) – combined with base address to define the physical memory
address that is sent to the memory unit.
43
Segmentation
A program is a collection of segments. A segment is a logical unit such
as:
main program,
procedure,
function,
local variables, global variables,
common block,
stack,
symbol table, arrays
As segments are logical divisions of programs so they are of variable
size.
Each segment has number and length.
Each executable program may consist or belong to different segments.
44
Segment table – maps two-dimensional physical addresses; each
table entry has:
base – contains the starting physical address where the segments
reside in memory.
limit – specifies the length of the segment.
program
program
data1 data2
Segment 0 Segment 0
Segment 1 Segment 1
500
700
1400
MEMORY LOCATIONS
2400
2900
3200
3400
3800
46
Virtual Memory
Virtual memory is a technique which allows the execution of process that may not be
completely in memory. Some part of it can be on disk. The memory management
techniques are simple to implement but major drawback is that if the physical memory
is limited then number of process it can hold at any time reduces. The main advantage of
virtual memory is that user can execute programs, whose size is larger than physical
memory.
A program consists of number of logical or virtual pages. i.e., a program is divided into
pages and some pages are loaded in memory while rest remain on disk. Whenever they
are required, they are loaded in memory.
47
The following terms are used with virtual memory:-
Locality of reference: The basic principle behind virtual memory. This give forecast
whether a page is likely to be referenced soon not, depending on its behavior in past. Thus, it
helps to decide whether the page should be thrown out from main memory to make space.
Page fault: When a process is executing with only a few pages in memory and when
instruction is encountered which refers to page outside the memory then page fault occurs.
Working set: A process have number of pages in physical memory not all of these pages are
referred actively. The set of pages which are referred actively is called working set.
Page replacement policy: As the number of process and number of pages in the main
memory increases all the page frames becomes occupied. At that time if some new page is to
brought in memory, then it need to overwrite an existing page in memory. It is called page
replacement policy.
Dirty page: If the page in memory has been altered or modified after it was loaded from the
disk is called dirty page.
48
Information Management
49
Information management (IM) is the collection and management of
information from one or more sources. To make the computer system
convenient for users, the OS
Maps files onto physical media and accesses these files via the
storage devices.
• File systems
50
File Systems
Since main memory is usually too small to accommodate all the data
and programs permanently, the computer system must provide
secondary storage to back up main memory. The file system provides
the mechanism for on-line storage of and (multiple) access to both data
and programs residing on the disks. A file system (or file system) is a
type of data store which can be used to store, retrieve and update a set
of files. The file system in Information management allows the user to
define files and directories and allocate/deallocate the disk space to
each file. It uses various data structures to achieve this. The operating
system implements the abstract concept of file by managing mass
storage devices, such as tapes and disks.
51
A file is a collection of related information. It can be programs and
data. Data may be numeric alphabets or alpha numeric. Each file has
a specific name, which is used to refer that file system.
File Attributes
A file's attributes vary from one OS to another but typically consist of
these:
Name – only information kept in human-readable form.
Type – needed for systems that support different types.
Location – pointer to file location on device.
Size – current file size.
Protection – controls who can do reading, writing,
executing.
Time, date, and user identification – data for protection,
security, and usage monitoring.
52
File Operations
• Creating a file.
Space in the file system must be found for the file. An entry for the new file
must be made in the directory.
• Writing a file.
There is command in which name of the file is given. Then OS search for
that file in directory entry and write to it.
• Reading a file.
To read from a file, we use a system call that specifies the name of the
file. Then OS searches for that file in directory entry and read it.
• Rewind a file.
The directory is searched for appropriate entry and file is reset to the
beginning of file.
• Deleting a file.
To delete a file, we search the directory for the named file. Having found
the associated directory entry, we release all file space, so that it can be
reused by other files, and erase the directory entry.
53
There are two types of file systems:-
54
Device Management / Device Driver
The routines which performed input and output are important. Each I/O
device has its own characteristics, requiring careful programming.
Special subroutine was written for each I/O device such a subroutine is
called device driver. Device drivers are software programs required for
each device. Each device will require different drivers as per
functionality. A device driver knows how the buffers, flags, register
control and status bits should be used for particular devices.
Terminal – I/O
A terminal or visual display unit (VDU) is common I/O medium. Terminal
hardware can be divided into two parts:-
Advantages of GUI:-
56
Different applications are shown on computer screen by icons. User can
open one or more application at a time by clicking on them. The computer
screen is divided into different partitions. Each partition can be of different
size. Each of these partitions is called window.
Dragging window
Resizing window
Minimize/Maximize window
Menu Bar
Scroll Bar
Controls push button (option button, radio button, checkbox, list
box, combo box)
Dialogue box
Feedback pointer
57
ACCESS AND SECURITY ASPECTS OF OPERATING SYSTEM
The term security is defined as: Security is concerned with the ability of the
operating system to enforce control over the storage and transportation of data
in and between the objects that the operating system support.
Informal: Security is keeping unauthorized entities from doing things you don’t
want them to do
58
Security Threats
Attacks on security
• Authentication
Authentication is the act of confirming the truth of an attribute of a data or
entity. It means verification of access to the system. Following are some of
the ways in which authentication may take place:-
Accepting proof of identity given by a credible person.
59
By stealing and using somebody else’s password.
• Browsing
In some systems there exist files with access controls which are very
permissive. One can browse through the system files to get this information
after which unprotected files could be easily accessed.
• Trap doors
A trap door is an entrance point in an information processing system which
circumvents the normal safety measures. It is generally a hidden program or
an electronic component which makes the protection system ineffective.
• Invalid parameters
Passing invalid parameters may cause serious security violations.
• Line trapping
A special terminal is used to tap into a communication line.
• Waste Recovery
By using some technique, deleted files can be recovered, password may be
recollected.
60
Computer Worms
A worm is a computer program that has the ability to copy itself from machine
to machine. A worm usually exploits some sort of security hole in a piece of
software or the operating system. Worms normally move around and infect
other machines through computer networks. Many worms that have been
created are designed only to spread, and do not attempt to change the
systems they pass through A "payload" is code in the worm designed to do
more than spread the worm–it might delete files on a host system, encrypt
files, or send documents via e-mail.
Computer Virus
A computer virus is a computer program that can replicate itself and spread
from one computer to another. Depend on the nature of a virus, it may cause
damage of your hard disk contents, and/or interfere normal operation of your
computer. This means that the virus multiplies on a computer by making
copies of itself. This replication is intentional; it is part of the virus program. In
most cases, if a file that contains virus is executed or copied onto another
computer, then that computer will also be "infected" by the same virus.
61
There are several types of virus:-
• File virus
• Boot sector virus
• General purpose virus
• Memory resident virus
• Append
• Replace
• Insert
• Delete
• Redirect
62
THANK YOU
63