Unit 1 OS
Unit 1 OS
Unit-1
• Computer Basics: Understanding Operating Systems
https://www.youtube.com/watch?v=fkGCLIQx1MI
https://www.youtube.com/watch?v=ACsLvXuaKxw&t=34s
• OS
• Classifications of OS
• Systems of OS
• Hardware refers to the physical devices of a computer system. The input, storage,
processing and output devices are hardware.
• Application software
• System software
System Programs
• System software is a set of one or more programs, designed to control the operation
of a computer system.
• These system software perform tasks such as controlling an application programs and
all of the operations required to move data into and out of a computer.
System Programs
• The program included in a system software is called system program and the person
who prepares system software is referred to as a system programmer.
• System software can run independently. It provides platform for running application
software's.
• Some examples of system software are compiler, assembler, debugger, driver, etc.
Application Programs
• The programs that create an application package are called application programs
and the person who prepares application programs is known as application
programmer.
Application Programs
• Application software can’t run independently. They can’t run without the presence
of system software.
• Some examples of application software are word processor, web browser, media
player, etc.
S. No. System Software Application Software
System software is used for operating Application software is used by user to perform
1.
computer hardware. specific task.
System software can run independently. It Application software can’t run independently.
4. provides platform for running application They can’t run without the presence of system
software's. software.
Some examples of system software's are Some examples of application softwares are
5.
compiler, assembler, debugger, driver, etc. word processor, web browser, media player, etc.
2. OS
• An operating system is a program that acts as an interface between the user and
computer hardware.
• OS is a first program that gets loaded into the memory through a process called
booting.
• OS is an integrated set of program that manages the various hardware resources and
overall operation of a computer system.
2. OS
• Its primary objective is to improve the performance and efficiency of a computer
system and make it user friendly. Like a manager of a company, OS is responsible for
smooth and efficient running of a computer system.
• The most common OS are – UNIX, Windows 98, Window 2000, Window 7.
2.1 OS act as an Extended Machine
• This operating system manages all parts of the system, and act as an interface to the user
or virtual machine/ Extended Machine, that is easier to program and use.
• It means, that the operating system hides the details of the hardware resources from the
programmer and provides the programmer with a interface for using the computer
system is called abstraction.
• Thus, the abstraction feature of operating system hides the lower level details from users.
• The operating system acts as an intermediary between the hardware and its users, and
making it easier for the programmer and other users to access and use those resources.
2.2 OS as Resource Manager
• A computer system usually has many hardware and software resources such as
processor, memory, disks, printers, I/O devices etc. The operating system acts as a
manager of these resources.
• The operating system is responsible for controlling and allocating various hardware
and software resources to different users in an optimal and efficient manner.
2.2 OS as Resource Manager
• Operating system manages resources in two ways :
• Time Multiplexing. It defines the sharing of resources on the basis of fixed time
slices. For example, the operating system allocates the resources, such as CPU to
program A for a fixed time slice. After that time slice is over, the CPU is allocated
to another program B and so on.
• Space Multiplexing. It defines the concurrent sharing of resources among
different programs. For example, sharing of hard disk and main memory is space
multiplexing.
3. Functions of OS
• The primary function of OS is to provide an environment for the execution of user
program.
• 1. Process Management
• 5. I/O Management
• 2. Main Memory Management
• 6. Protection and Security
• 3. Secondary Storage
• 7. Networking
Management
• 8. Command Interpretation
• 4. File Management
3.1. Process Management
• The process management refers to the assignment of processor to different tasks being
performed by the computer system.
3.1. Process Management
• The OS is responsible for the following activities in connection with process
management-
• 1. Creating and deleting both user and system processes.
• In such a situation, where several programs reside in the main memory at the same
time, memory management is important.
3.2. Main Memory Management
• The operating system is responsible for the following .activities in connection with
memory management:
• 1. Keeping track of which parts of memory are currently being used and by which process.
• 2. Deciding which processes are to be loaded into memory when memory space becomes
available.
• 3. Allocating and de-allocating memory spaces as needed.
3.3. Secondary Storage Management
• The main memory has a limited size and cannot store all the user programs at once.
Moreover, when the power is lost, the data it holds are also lost. So computer system
Provides secondary storage devices such as magnetic disks and tapes to back up main
memory.
3.3. Secondary Storage Management
• The secondary storage devices store system programs, such as compiler, editor and
assembler and user programs that are not used frequently.
• The operating System performs following functions in connection with disk management :
• 1. Free space management i.e., manages free space on disk.
• 2. Storage allocation i.e., allocates storage area for storing new programs.
• 3. Disk scheduling
3.4. File Management
• File is a storage unit and is a collection of information.
• Files are categorized on the basis of information stored in it such as data file, source
file and object file.
• 3. Providing operations for manipulating files and directories such as read, write,
execute, copy, append etc.
• 4. Backing up files on stable (non-volatile) storage media so that they can be restored
if original file is lost.
3.5. I/O Management
• I/O management refers to the coordination and assignment of the different I/O devices
to the various programs that are being executed.
• Security deals with protecting the various resources and information of a computer
system against destruction and unauthorized access.
3.7. Networking
• Networking is used for exchanging information among different computer that are
distributed across various locations.
• Thus a distributed system enables us to share the various resources of the network.
• Command interpreter provides a set of commands using which the user can give instruction to the
computer for getting some job done by it.
• There arc two different user interfaces supported by various operating systems:
• 1. Command Line Interface (CLI)- It is the textual user interface in which user gives instruction to
computer by typing the commands.
• 2. Graphical User Interface (GUI)- It provide the user a screen full of graphical icons or menus, and
allows the user to make a fast selection of icons or menus to give instruction to computer.
Types of OS
Classifications of OS
•The OS may be classified into different types depending upon the interaction between
user and program.
• The computer, that are based on this OS, have only single processor and execute only
a single program at all the time.
• This system provide all the resources such as CPU,I/O devices to a single user at all
the time.
• The Single User, Multi-tasking OS allows a single user to execute multiple program
at a same time. For e.g a user can perform different task such as making calculations
in excel sheet, printing a word document and download a file from the internet at the
same time.
• The main disadvantage of this OS is that CPU sits idle for most of the time and is not
utilized to its maximum.
2. Multi-user OS
• In a multi-user OS, multiple number of users can access different resources of a
computer at a same time.
• The access is provided using a network that consists of various personal computer
attached to a mainframe computer system.
• The various personal computers can send and receive information to mainframe
computer system.
• Thus, the mainframe computer acts as the server and other personal computers act as
client for that server.
3. Batch Processing OS
• Batch processing is one of the oldest method of running the program.
• The computers in the past were very large in size and their I/O devices were very
different from those that are used today.
• The users prepare their job and job was usually in form of punched cards.
3. Batch Processing OS
• The users submit their job to a computer system. when a batch of programs have been
collected, the operator loads this batch of programs into the computer at one time where
they are executed one after the other.
• Finally, the operator retrieves the output of these jobs and return them to the concerned
users.
• In this way many different jobs are processed, one after the other without any interaction
from the users during program execution.
• In such a batch processing system, the various jobs of the users are collected in a
queue. This process is known as spooling. Spooling is a short form of Simultaneous
Peripheral Operations On Line.
• The method of batch processing reduces the idle time of computer system because
transition from one job to another does not require operator intervention.
• Such an operating system also provides the provision to set the priorities for different
batch and the highest priority job is executed before other batches.
4. Multiprogramming System
• Multiprogramming operating system allows multiple users to execute multiple
programs using a single CPU concurrently i.e. at the same time.
• In multiprogramming several processes are kept in the main memory and CPU execute
all these processes concurrently. It means, the CPU immediately switches from one
process to next that are ready to get executed.
• Multiprogramming does not mean that CPU executes the instructions from several
programs at the same time. Rather, it means that there are number of programs
available to CPU and that a portion of one is executed, then a segment of other and so
on.
• Although two or more users programs reside in the main memory simultaneously, the
CPU is capable of executing only one instruction at a time. Hence, at any given time,
only one of the programs has control of CPU and is executing instructions.
Simultaneous execution of more than one program with single CPU is impossible
• Advantages
• Increased throughput
• Disadvantages
• We can also say, multitasking is the system's capability to work on more than one
job or process at the same time. It means that whenever a job needs to perform I/0
operations, the CPU can be used for executing some other job or process that is also
residing in the system and is ready to use the CPU.
5 Multitasking OS
• The term multiprogramming is used for multi-user systems i.e., systems that are
simultaneously used by many users such as mainframe and server class system and
the term multitasking is used for single user system i.e., systems that are used by
only one user at a time such as a personal computer or a notebook computer.
• 1. Cooperative Multitasking
• 2. Pre-emptive Multitasking
2 It refers to the concurrent execution of multiple jobs It refers to the concurrent execution of multiple jobs
that may be of same user or different users. of a same user.
6. Multiprocessing OS
• Multiprocessor system is the system that contains two or more processors or CPUs and
has ability to simultaneously execute several programs. Hence the name 'multi-
processor'.
• In such a system, multiple processors share the clock, bus, memory and peripheral
devices.
• In this system, the CPUs may simultaneously execute different instructions from the
same program.
• Each user program is allocated a very- short period of CPU time one-by-one,
beginning from the first user program and proceeding the last one, and then again
beginning from the first one.
• This short period of time during which user gets the attention of the CPU is known as
a time slice/time slot /quantum. It is typically of the order of 10 to 100 milliseconds.
7. Timesharing OS
• Thus, in timesharing, when the CPU is allocated to a user program, the user uses
the CPU for the period of time slot.
• When the execution of the program is over during the time slice
8. Distributed OS
• 1. Client-Server Model
• 2. Peer-to-Peer Model
• 1.Client-Server Model- In client server model, client send a request to
the server and the server provide the response back to client .
• 2. Peer-to-Peer Model- In peer-to-Peer model, all the computers behave as client
and can communicate with each other for exchange of their resources.
9. Real time OS
• In a real time OS, a job is to be completed within the rigid time constraints otherwise
job loses its meaning.
• A real time system functions correctly only if it return the correct result within its
time constraints.
• A real time system is often used as a central device in applications like robotics, air-
traffic control, industrial control system, medical system.
9. Real time OS
• Real time system are categorized into-
• 1. Hard Real Time System- complete the critical task within the definite interval
of constraints . If the task is not completed within time constraints then hard real
time system fails.
• For e.g. Flight Controller system in which any miss in deadline leads to crash
or an unstable aircraft
• 2. Soft Real Time System- are not affected by the lapse of time interval and do not
cause any critical failure.
• For e.g.- traffic signal
10. Multi-Threaded OS
• A thread represents a light weight process and is the smallest unit of CPU
utilization. It is like a ‘mini-process’.
• 2. Standby-A thread that has been selected to run next on a particular processor is said to
be in standby state. The thread waits in this state until the processor is made available. If
the priority of standby thread is higher the the running thread may be preempted.
• 3. Running- The thread that is currently utilizing CPU is in running state. It keeps the
processor until
• It is preempted by a higher priority thread
• It is blocked on an event(I/O)
When waiting condition is satisfied, the thread moves back to ready state if all the
resources are available.
• 5. Transition- A thread enter this state after waiting if it is ready to run but sources
are not available. When resources are available , the thread goes to the ready state.
• Each subsystem performs a specific task and manage various resources like CPU,
memory, I/O, processes and files.
• All these subsystem are organized into three different horizontal layers: bottom,
middle and top layer.
• In the bottom layer there are three subsystem, one for each type of hardware resource
: CPU manager, the memory manager and device manager. The software's in this
layer directly manages the hardware resources.
SUBSYSTEMS OF OS
• The middle-layer is the head and heart of the OS. It contains three subsystems :
process management, virtual memory management and file management. These
three subsystems are interdependent and usually interact with each other. The middle
layer also includes other subsystems such as bootstrap, shutdown, time management,
security, module management etc.
• The top layer contains external interfaces consisting of system call, interrupt and
exception handling routines. It also contains utilities that enable the users to use
different components of computer system. For example compilers, assemblers,
database management system etc.
1. Bottom Layer Subsystem
• This layer manages the hardware devices like CPU, main memory and I/O devices.
• A. CPU Management- The software component that is responsible for this subsystem is
called CPU manager.
• CPU manager is responsible for allocating the CPU to one of the various processes that
are waiting for their turn to get CPU.
• It decide which process will get the CPU and for how much duration .
1. Bottom Layer Subsystem
• B. Memory Management- This subsystem manage another important hardware resource
called main memory and usually shared by operating system and application programs.
• The memory manager keeps track of area of main memory where operating system
resides and where application programs reside.
• The memory manager also implements various protection techniques in order to protect
the allocated memory from unauthorized access.
1. Bottom Layer Subsystem
C. I/O Device Management- I/O devices attached to the computer system are used to enter
the data into the system and get the output.
• This subsystem contains a collection of device drivers. A device driver is a software
module that manages the communication and controls the specific I/O device. Device
driver converts the logical requests from the user into specific commands directed to the
device itself.
• This subsystem also implements device allocation policies. I/O device management
subsystem, keeps an account to determine which device is allocated to which process.
2. Middle Layer Subsystem
• This layer is the head and heart of an operating system. It handles processes, virtual memory management and
files management system.
• A. Process Management- It keeps track of all the resources allocated to various processes in a system. It
creates certain data structures such as PCB (Process Control Block) to store information about various
processes.
• It also looks after the various operations that can be performed on process such as process creation,
termination, suspend, resume block etc.
• This subsystem also looks after the inter process communication and process synchronization.
• Inter-process communication is a technique by which the various processes can communicate with each other
and is called cooperating processes.
• It means it is not necessary to load all of a process into main memory during its
execution. Only those portions which are actually being used at any instant need
to be present in memory. The rest of program is kept in secondary memory.
• Virtual memory enhances the CPU utilization and throughput by executing as
many programs as possible almost simultaneously.
• C. File Management System-An information is stored in a file. A file is a collection
of similar records. A file is treated as a single entity by users and applications.
• It enable users to give user defined name, to create, to modify and to delete files.
• It also ensure the security of files such that the file is not accessed by
unauthorized users.
3. Top Layer Subsystem
• This layer also includes utilities, command interpreter or shell and system libraries.
• A. Interrupt, System Call and Exception- An interrupt is a signal from an I/O device
or from a program that causes the OS to stop the execution.
3. Top Layer Subsystem
• System Calls –The purpose of system call is to request the operating system to
perform some activity.
• The execution of a system call requires the user process to save its current state and
pass the control of the CPU to the operating system to perform some function.
• After the task has been performed the operating system saves its state and give control
of the CPU back to the user process.
• Whenever an application performs some illegal action such as executing some
unrecognized or privileged instruction (e.g. dividing a number by zero or referring an
entity outside their own address space), it enters into inaccurate or abnormal state.
This illegal action is called an exception.
3. Top Layer Subsystem
• B. Utilities- Utilities are special system programs that are used for specific purpose.
• Utilities are standalone executable programs that come with operating system.
• Thus bootstrap program, after loading the OS, transfers the execution control to
OS. The OS initializes hardware devices appropriately. This initialization is done
before users begin using the computer.
• The purpose was to limit each user’s program to its assigned area of memory so
that the program cannot interfere and harm with each other.
• Protection also ensure that only those processes that have gained proper
authorization from the OS can operate on memory segments, the CPU, files and
other resources.
• Security refers to method of protecting information stored in the system as well as physical
resources of the computer system from unauthorized access, destruction or alteration or
accidental introduction of inconsistency
• Authorized users are those, whose identity are known and are allowed to use system
resources whereas unauthorized users are those who are not allowed to use system
resources.
• Thus securing a system involves following measures:
• Theft of information
• The term security is often associated with protection. However, there is a difference
between them.
• Protection is defined as guarding the user information against other authorized users within
the system whereas security is defined as guarding the user information against
unauthorized users outside the system.