0% found this document useful (0 votes)
24 views

Chap1 - Operating System

best in computer

Uploaded by

Aman Prajapati
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views

Chap1 - Operating System

best in computer

Uploaded by

Aman Prajapati
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 63

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 goals/functions:


• Execute user programs and make solving user problems
easier.
• Make the computer system convenient to use.
• Use the computer hardware in an efficient manner.
• To prevent error and improper use.
• Provide facility to share the same hardware among the users.

By:- Prajakta Shetye 2


COMPUTER SYSTEM
COMPONENTS

• Provides basic computing resources (CPU,


Hardware memory, I/O devices).

Operating • Controls and coordinates the use of


System hardware among application programs.

• Solve computing problems of users


Application (compilers, database systems, video games,
Programs business programs such as banking
software).

Users • People, machines, other computers

By:- Prajakta Shetye 3


ABSTRACT VIEW OF SYSTEM
User
1 User User User
2 3
... n

compiler assembler Text editor Database


system
System and Application Programs

Operating System

Computer
Hardware

4
OPERATING SYSTEM
DEFINITIONS

• Resource allocator – manages and allocates resources.

• Control program – controls the execution of user


• program and operations of I/O devices

• Kernel – the one program always running (all else


• being application programs).

By:- Prajakta Shetye 5


TYPES OF OPERATING
SYSTEM

• Single:- This OS is single user operating system, so only one user


program can be supported and executed by it.
• Multiprogramming:- This is multi-user program. It supports more than
one user and program.
• Timesharing:- Here each active user program is given a fair share of
CPU time.
• Real Time:- In real time OS job have fixed deadlines and the job must
be done within their deadlines.
• Multiprocessing:- This OS is capable of handling more than one
processor as the job must be executed on more than one processor.

By:- Prajakta Shetye 6


• Windows - 98.

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:

• LINUX is free software.


• Multiuser, Multitasking OS with full set of UNIX compatible tools.
• It’s file system obeys UNIX semantics.
• It runs on wide variety of platforms.
• It supports wide base of applications.
• It provides as much functionality from limited resources.
• It can even run-on machine having 4MB RAM.

1
Operating System 0
OPERATING SYSTEM SERVICES

• The operating system divides its services in the following


three main areas:-

• Process Management [PM]


• Memory Management [MM]
• Information Management [IM]

By:- Prajakta Shetye 11


PROCESS MANAGEMENT
(PM)

• Process is program in execution.


• In multi-user environment, there are many users running different
programs and accessing one CPU.
• OS keeps track of all processes, schedule them and dispatch them one
after another, giving the impression that each user has full control of
CPU.

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.

6. Ready a 7. Dispatch a 8. Suspend a


process. process. process.

9. Resume a 10. Delay a


process. process.

1
3
MEMORY MANAGEMENT (MM)

• Keeping track of memory & allocating - deallocating memory to various


processes.
• OS keeps list of free memory locations.
• Before a program is loaded from disk to memory, MM consults this free
list, and then allocates memory to process and updates this free list.
• Memory is allocated depending on program size.

1
Operating System 4
System Calls in MM

1. Allocate a chunk of memory to a process.

2. Free a chunk of memory from a process.

1
5
INFORMATION MANAGEMENT
(IM)

• IM refers to a set of services used for storing, retrieving, modifying or


removing information on various devices.
• Basically, it deals with organization of information in terms of files &
directories, allocating - deallocating sectors, ensuring right people have
access to information and driving various devices.

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)

5. Read data 6. Write data


7. Move the
4. Close a file. from file to to file from
file pointer.
buffer. buffer.

8. Read & 10. Change


9. Create a
return file working
link.
status. directory.

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.

A program in execution is a known as process.

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.

A process is a program in execution. A process is more than the program code,


which is sometimes known as the text section. It competes for the CPU time and
other resources.

19
Process State
TERMINATE
D
NEW interrupt
exit

admitted

RUNNING
READY
Scheduler dispatch

I/O or event wait


I/O or event completion
WAITING

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:-

• NEW - The process is being created.


• RUNNING - Instructions are being executed
• WAITING - The process is waiting for some event to occur.
• READY - The process is waiting to be assigned to a processor.
• TERMINATED - The process has finished execution.

It is important to realize that only one process can be running on any


processor at any instant, other process may be ready and waiting.

21
PROCESS SCHEDULING

• In a multiuser operating system, several programs are running


• Simultaneously. In this case the OS must keep track of all these
processes and will have to dispatch them one after another. This is known
as process scheduling.
• While scheduling various process, there are many objectives for the
operating system.
• CPU utilization – We want to keep the CPU as busy as possible.
• Throughput – The total amount of work performed by the OS
over a period of time.
• Turnaround time – The interval from the time of submission of a
process to the time of completion is the turnaround time.

By:- Prajakta Shetye 22


• Waiting time – The CPU scheduling algorithm does not affect
the amount of time during which a process executes or
does I/O; it affects only the amount of time that a
process spends waiting in the ready queue.

• Response time – Response time is the time it takes to start


responding, not the time it takes to output the
response.

By:- Prajakta Shetye 23


Considering all these factors, the scheduling technique is chosen.

There are two types of scheduling:


• Preemptive Scheduling
It allows a higher priority process to replace a current running process.
Even it is not over or not interrupted. It is suited for online, real time
processing.

• Non - Preemptive Scheduling


Once the CPU has been allocated to a process, the process keeps the
CPU until it releases the CPU either by terminating or by switching to
the waiting state.

24
PRIORITY

• A priority is associated with each process and the CPU is allocated to


the process with the highest priority. Priorities can be defined either
internally or externally.

• Internal priorities use some measurable quantity or quantities to


compute the priority of a process. Internal priority is based on
calculation of current state of process. It is mostly used by scheduling
algorithm.

• External priorities are set by criteria outside the operating system,


such as the importance of the process etc. It is specified by user
externally at the time of initiating a process.

• .

By:- Prajakta Shetye 25


• Purchase priorities are used in some data center situations
where each user pays for the time used. Normally higher priority
processes are changed at higher rate to prevent each user from firing
his job at the highest priority.

• Time Slice means each process is normally given certain time to


run irrespective of its importance

By:- Prajakta Shetye 26


MULTIPROGRAMMING

• Multiprogramming is an attempt to increase CPU utilization by


always having something for CPU to execute.
• In multiprogramming we can run two process simultaneously.
• The number of processes running simultaneously and hence
competing for CPU is known as degree of multiprogramming.
• As this increase, CPU utilization increase, but then each process may
get a delayed attention.
• The lost in time, in turning the attention of CPU from process to
another is called as context switching.

By:- Prajakta Shetye 27


Context Switching
Switching the CPU to another process requires performing a state save
of the current process and a state restore of a different process. Let A
and B be the two processes ready for execution and requires CPU time
for execution. Let CPU time be given to process A, which is having some
instructions depending on process B. Then, it is the job of OS to halt the
execution of process A and give CPU time for process B. The lose in time
in turning the attention of CPU from process A to process B is known as
context switching.

Run Run Run Run


process 1 process2 process 1 process 2

Context switching

28
MULTITASKING

• Multitasking is a logical extension of multiprogramming.


• The CPU executes multiple jobs by switching among them, but the
switches occur so frequently that the users can interact with each
program while it is running.
• In multitasking, a process can consist of tasks, which run
simultaneously.
• Multitasking allows programmer flexibility and improves CPU
utilization.

By:- Prajakta Shetye 29


For example:-
Consider a process consisting of two tasks:-
Task 0 : Read a record Task 1 : Write a record
task 1 end.
Process a record
Task 0 end.

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.

Logical address – generated by the CPU; also referred to as


virtual address.
Physical address – address seen by the memory unit.

The memory allocation is done in two ways:-

• Contiguous Memory Allocation


• Non - Contiguous Memory Allocation

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.

By:- Prajakta Shetye 33


Contiguous Memory Allocation

In contiguous memory allocation, a memory – resident program occupies a


single contiguous block of physical memory. The memory is partitioned into
blocks of different sizes, for accommodating the programs. The partitioning is
of two kinds.

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).

By:- Prajakta Shetye 35


Partition Id Partition Base Partition Size Partition
Status

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:-

• Here number of partitions and their sizes are variable.


• They are not defined at the time of system generation.
• These partitions are created by the OS at run time, so they differ in size.
• Each job is allocated a partition size according to its requirements.

By:- Prajakta Shetye 37


0 0 0
Monitor Monitor
Monitor 40k 40k
40K Monitor
100k JOB 1 100k
JOB 1 Job1 terminates
100 JOB 1
K
170k JOB 4
JOB 2 JOB 4
170k
job2 terminates
200
allotted to job 4 200k
K
200k
Job3
JOB3
230 230k
230k JOB3
K JOB3
256
K
256k 256k

38
Non- Contiguous memory allocation

In non- contiguous memory allocation model, several non- adjacent


memory areas are allocated to a process. None of these areas is large
enough to hold the complete process, hence a part of the process is
loaded in each of these areas. We call each such part a component of a
process.
Two approaches are used to implement noncontiguous memory
allocation:-
• Paging
• Segmentation
• Virtual Memory

39
Paging

• In paging, each process consists of fixed sized components called


pages.
• The size of a page is specified in the architecture of the computer
system.
• The memory can accommodate an integral number of pages in it.
• Memory allocation is performed with a page as a unit – a memory
area whose size is the same as the page size is allocated to it.

40
• Partitions suffer from external fragmentation because of available

memory is not contiguous (adjacent). Paging permits a program memory


to be non-contiguous allowing a program to be allocated physical
memory wherever it is available.
• Physical memory is divided into fixed size blocks called page frames.
• Logical memory is also broken in fixed size called page.
• When program is to be executed its pages are loaded into any available
frames and the page map tables defined to translate from user pages to
memory frames.
• The page size is defined by hardware. It is typically power of 2.

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

Page P Page Frame F

0 1
1 4
2 3
3 0

Page map table(PMT)

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.

Logical memory (process p1)


Logical memory (process p2)

program
program
data1 data2
Segment 0 Segment 0
Segment 1 Segment 1

limit Base X limit Base


0 1000 1400 0 1000 1400
Segment table
1 400 3400 Segment table 1 300 2900
(process p2)
(process p1) 45
0

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.

Virtual memory is difficult to implement, and it decreases performance. They can be


implemented by paging, segmentation. Mostly virtual memory is implemented by paging.

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.

Demanding page: A page is loaded into memory only when it is demanded.

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

 Provides a uniform, logical view of information storage.

 Abstracts from the physical properties of its storage devices to define


a logical storage unit, the file.

 Maps files onto physical media and accesses these files via the
storage devices.

Information management consists of two modules:

• File systems

• Device management / Device Driver

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.

The file system consists of two distinct parts:

• a collection of files; each storing related data,


• a directory structure; which organizes and provides information about
all the files in the system.

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.

Information about files is kept in the directory structure, which is


maintained on the disk.

52
File Operations

A file is an abstract data type. To define a file properly, we need to


consider the operations that can be performed on files. The OS can
provide system calls to create, write, read, rewind, delete file.

• 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:-

•Tape based system


Early file system were tape based. They are simple but inefficient. A tape file
system is a file system and tape format designed to store files on tape in a self-
describing form. In these systems, files are stored on to reels of physical tapes. But
most of the files are small so more number of files is stored on one tape. Tape requires
linear motion to wind and unwind potentially very long reels of media. This tape motion
may take several seconds to several minutes to move the read/write head from one end
of the tape to the other. A directory is added to tape which lists the name and location
of each file on the tape. But finding a file on tape is time consuming as we need to go
through each file. Another problem was regarding modification of a file. If file is to be
modified it requires copying the entire tape over. Tapes are used for transport of data
from one computer to another.

•Disk based system


A disk file system takes advantages of the ability of disk storage media to
randomly address data in a short amount of time. The problems with tape based
systems are resolved with disk based systems. In disk based systems, a disk is used. A
disk is divided into tracks .Each track is further divided into number of sectors. Number
of tracks and size of sectors varies from one drive to another. This permits multiple
users (or processes) access to various data on the disk without regard to the sequential
location of the data

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:-

1. Input unit 2. Output unit

The terminal can be dumb terminal or an intelligent terminal. The


dumb terminal consists of microprocessor and limited memory. It is
responsible for basic input and output of characters. It is called dumb,
because it does no processing on input characters. Intelligent terminal
can carry out some processing on the input. Intelligent terminal has
more powerful hardware and software.
55
GRAPHICAL USER INTERFACE (GUI)

In earlier computers the operating system used to have a set of cryptic


(puzzling) commands to perform operation, user need to type command.
Users were expected to remember command and its meaning. Later on
attempts were made to replace command into graphic. The interface which
cryptic replaces commands by their graphical representation are called
graphical user interface.

Advantages of GUI:-

• Easy to use consistent GUI for almost all programs.


• User can communicate and exchange data between programs without
transferring or copying files.
• Commands are replaced by graphics.
• User can run several programs simultaneously.

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.

The following operations can be carried out on a window.

Dragging window
Resizing window
Minimize/Maximize window

The essential components of GUI are:-

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

The elements of security are:

• Confidentiality: Ensures the information is not accessed in an unauthorized


manner.

• Integrity: Ensure that the information is not amended or deleted by


unauthorized manner.

• Availability: Ensure that the information is available to authorized users at


right time only.

58
Security Threats

Sharing and protection are requirements of modern computing environment.


But these two are contradictory (differing) to each other as more sharing give
rise to possibility of more security threats (terrorization). The major threats to
security can be categorized as:

• Tapping: Unauthorized use of servicing.


• Disclosure: Unauthorized disclosure of information (leak of information)
• Amendment: Unauthorized alteration or deletion of information
• Fabrication: Unauthorized fabrication of information(untruth)
• Denial: Denial of service to authorized users.

Attacks on security

The security system can be attacked and prevented in a number of ways as


follows:-

• 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

Methods by which virus can infect other programs

• Append
• Replace
• Insert
• Delete
• Redirect

62
THANK YOU

63

You might also like