0% found this document useful (0 votes)
23 views53 pages

Unit 1 Part 1 Operating System

Uploaded by

Ayush Garg
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
23 views53 pages

Unit 1 Part 1 Operating System

Uploaded by

Ayush Garg
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 53

BCA V SEM

BCA 301
What Is an Operating System?
 A computer system has many resources (hardware and
software), which may be require to complete a task. The
commonly required resources are input/output devices,
memory, file storage space, CPU etc.

 The operating system acts as a manager of the above


resources and allocates them to specific programs and
users, whenever necessary to perform a particular task.

 Therefore operating system is the resource manager i.e. it


can manage the resource of a computer system internally.
What Is an Operating System?
 An Operating System can be defined as an interface
between user and hardware. It is responsible for the
execution of all the processes, Resource Allocation,
CPU management, File Management and many other
tasks.

 The purpose of an operating system is to provide an


environment in which a user can execute programs in
convenient and efficient manner.
What Is an Operating System?
Objectives of Operating Systems

 Convenient to use: One of the objectives is to make the


computer system more convenient to use in an efficient manner.
 User Friendly: To make the computer system more interactive
with a more convenient interface for the users.
 Easy Access: To provide easy access to users for using resources
by acting as an intermediary between the hardware and its users.
 Management of Resources: For managing the resources of a
computer in a better and faster way.
 Controls and Monitoring: By keeping track of who is using
which resource, granting resource requests, and mediating
conflicting requests from different programs and users.
 Fair Sharing of Resources: Providing efficient and fair sharing
of resources between the users and programs.
Structure of a Computer System
A Computer System consists
of:
 Users (people who are using
the computer)
 Application Programs
(Compilers, Databases,
Games, Video player,
Browsers, etc.)
 System Programs (Shells,
Editors, Compilers, etc.)
 Operating System ( A
special program which acts
as an interface between user
and hardware )
 Hardware ( CPU, Disks,
Memory, etc)
Two Views of Operating System

 User's View
 System View
Operating System: User View
 The user view of the computer refers to the interface
being used.
 Such systems are designed for one user to monopolize
its resources, to maximize the work that the user is
performing.
 In these cases, the operating system is designed mostly
for ease of use, with some attention paid to
performance, and none paid to resource utilization
Operating System: System View

 Operating system can be viewed as a resource allocator


also.
 A computer system consists of many resources like -
hardware and software - that must be managed
efficiently.
 The operating system acts as the manager of the
resources, decides between conflicting requests,
controls execution of programs etc
What does an Operating system do?
Following are some of important functions of an operating
System.

 Processor management which involves putting the tasks


into order and pairing them into manageable size before
they go to the CPU.
 Memory management which coordinates data to and
from RAM (random-access memory) and determines the
necessity for virtual memory.
 Device management which provides interface between
connected devices.
 Storage management which directs permanent data
storage.
 Application which allows standard communication
between software and your computer.
 User interface which allows you to communicate with
your computer.
Functions of Operating System
 It boots the computer
 It performs basic computer tasks e.g. managing the various
peripheral devices e.g. mouse, keyboard
 It provides a user interface, e.g. command line, graphical user
interface (GUI)
 It handles system resources such as computer's memory and
sharing of the central processing unit(CPU) time by various
applications or peripheral devices.
 It provides file management which refers to the way that the
operating system manipulates, stores, retrieves and saves data.
 Error Handling is done by the operating system. It takes
preventive measures whenever required to avoid errors
Memory Management
 In a computer system, we have primary memory, which is also
called main memory, and it is made by the sequence of bytes.
 Each byte in the main memory has a unique address which helps
it to check if it is occupied or not.
 For executing each program in its computer system, it should be
in the main memory.
 Operating systems can easily check which bytes of main memory
are empty and which are not.
 So it allocates the main memory for the program execution, and
when the program is completed or terminated, then it
deallocates the memory.
 Operating systems also keep a record that which byte of memory
is assigned to which program.
Device Management
 The operating system manages the communication
between the computer system and the peripheral devices
connected to the I/O port of the system. Peripheral devices
use their respective drivers to communicate with the
system. The operating system determines which program
or process is accessed by which connection and device. It
also makes sure when a program is executed or terminated,
it will stop the communication between the device and the
computer system.
 Coordination between other software and the user
 There is other software in the system which is coordinated
by the operating system so that users can access them
efficiently, like assemblers, compilers, etc.
Process Management
 The process is a program under the execution. The
operating system manages all the processes so that
each process gets the CPU for a specific time to execute
itself, and there will be less waiting time for each
process. This management is also called process
scheduling.
Process Management
 For process scheduling operating system uses various algorithms:
 First Come First Serve (FCFS) Algorithm: In this algorithm, which comes
first is served first by the CPU until it is completed. It is a non-preemptive
algorithm which means it cannot be terminated without completing it.
 Shortest Job First (SJF) Algorithm: The process which has the shortest burst
time (execution time) that will be served first by the CPU.
 Longest Job First (LJF) Algorithm: This algorithm is based on the
phenomenon that the process that has the longest execution time will be
served first by the processor.
 Round Robin Algorithm: In this algorithm, there is a specific time quanta
assigned for each process. If the process is not executed in time quanta, it is
sent to the waiting queue for its next turn.
 Priority Scheduling Algorithm: Processes are given the priority based on
different criteria and scheduled according to the highest priority. Criteria can
be burst time or arrival time etc.
Security
 An OS by using password and other similar techniques
prevents and checks unauthorized users to access the
data and program.
 Computer security is a very important aspect of any
operating system. The reliability of an operating
system is determined by how much better security it
provides us. Modern operating systems use a firewall
for security. A firewall is a security system that
monitors every activity happening in the computer
and blocks that activity in case of any threat.
Error Detection

 Errors can occur anytime and anywhere. An error may


occur in CPU, in I/O devices or in the memory
hardware. Following are the major activities of an
operating system with respect to error handling −
 The OS constantly checks for possible errors.
 The OS takes an appropriate action to ensure correct
and consistent computing.

 By using various error detecting aids an operating


system helps in prevention of errors.
Coordination among Software and
Users

 In case of distributed systems which are a collection of processors that


do not share memory, peripheral devices, or a clock, the operating
system manages communications between all the processes. Multiple
processes communicate with one another through communication
lines in the network.
 The OS handles routing and connection strategies, and the problems of
contention and security. Following are the major activities of an
operating system with respect to communication −
 Two processes often require data to be transferred between them
 Both the processes can be on one computer or on different computers,
but are connected through a computer network.
 Communication may be implemented by two methods, either by
Shared Memory or by Message Passing.

 It Coordinates and assigns compilers, assemblers, interpreters and


other software to users.
File Management
 A file represents a collection of related information. Computers can store files
on the disk (secondary storage), for long-term storage purpose. Examples of
storage media include magnetic tape, magnetic disk and optical disk drives like
CD, DVD. Each of these media has its own properties like speed, capacity, data
transfer rate and data access methods.
 A file system is normally organized into directories for easy navigation and
usage. These directories may contain files and other directions. Following are
the major activities of an operating system with respect to file management −
 Program needs to read a file or write a file.
 The operating system gives the permission to the program for operation on file.
 Permission varies from read-only, read-write, denied and so on.
 Operating System provides an interface to the user to create/delete files.
 Operating System provides an interface to the user to create/delete directories.
 Operating System provides an interface to create the backup of file system.
Handling the I/O Operations
 Input/output devices like mouse, keyboards, printers
etc., are external I/O devices, and there are different
natures of each device. The operating system
appropriately manages the input and output operation
of these devices.
Examples of Operating Systems

 Windows (GUI-based, PC)


 GNU/Linux (Personal, Workstations, ISP, File, and
print server, Three-tier client/Server)
 macOS (Macintosh), used for Apple’s personal
computers and workstations (MacBook, iMac).
 Android (Google’s Operating System for
smartphones/tablets/smartwatches)
 iOS (Apple’s OS for iPhone, iPad, and iPod Touch)
Types of Operating Systems
Following are some of the most widely used types of
Operating system.
 Simple Batch System
 Multiprogramming Batch System
 Time-Sharing Systems
 Multiprocessor System
 Desktop System
 Parallel systems
 Distributed Operating System
 Real-time Operating System
 Handheld System
Simple Batch System
 In the era of 1970s, the Batch processing was very popular. The Jobs
were executed in batches. People were used to have a single
computer which was called mainframe.
 In Batch operating system, access is given to more than one person;
they submit their respective jobs to the system for the execution.
 The system put all of the jobs in a queue on the basis of first come
first serve and then executes the jobs one by one. The users collect
their respective output when all the jobs get executed.
 A batch Processing Operating System (BatchOS) is an open-
source operating system designed to manage multiple jobs in
sequence.
 Batch processing operating systems are designed to execute a
large number of similar jobs or tasks without user intervention.
Simple Batch System
Working of Batch System
Advantages of Simple Batch Systems
 No interaction between user and computer.
 No mechanism to priorities the processes.
 Efficient use of resources: Batch processing operating systems allow for the efficient use
of computing resources, as jobs are processed in batches and scheduled to run when
resources are available.
 High throughput: Batch processing operating systems can process a large number of jobs
quickly, allowing for high throughput and fast turnaround times.
 Reduced errors: As batch processing operating systems do not require user intervention,
they can help reduce errors that may occur during manual job processing.
 Simplified job management: Batch processing operating systems simplify job
management by automating job submission, scheduling, and execution.
 Cost-effective: Batch processing operating systems can be cost-effective, as they allow for
the efficient use of resources and can help reduce errors and processing time.
 Scalability: Batch processing operating systems can easily handle a large number of jobs,
making them scalable for large organizations that require high-volume data processing.
Disadvantages of Batch OS
 Starvation
 Batch processing suffers from starvation. If there are five jobs J1, J2, J3, J4, J4 and J5
present in the batch. If the execution time of J1 is very high then other four jobs will never
be going to get executed or they will have to wait for a very high time. Hence the other
processes get starved.
 2. Not Interactive
 Batch Processing is not suitable for the jobs which are dependent on the user's input. If a
job requires the input of two numbers from the console then it will never be going to get
it in the batch processing scenario since the user is not present at the time of execution.
 CPU is often idle, because the speed of the mechanical I/O devices is slower than the
CPU.
 Limited functionality: Batch systems are designed for simple tasks, not for more
complex tasks. This can make them difficult to use for certain tasks, such as managing
files or software.
 Security issues: Because batch systems are not typically used for day-to-day tasks, they
may not be as secure as more common operating systems. This can lead to security risks
if the system is used by people who should not have access to it.
 Interruptions Batch systems can be interrupted frequently, which can lead to missed
deadlines or mistakes.
 Inefficiency: Batch systems are often slow and difficult to use, which can lead to
inefficiency in the workplace.
Multiprogramming Batch Systems

 Multiprogramming is an extension to the batch


processing where the CPU is kept always busy. Each
process needs two types of system time:
CPU time and
IO time.
 In multiprogramming environment, for the time a
process does its I/O, The CPU can start the execution
of other processes. Therefore, multiprogramming
improves the efficiency of the system.
Multiprogramming Batch Systems
 In this the operating system picks up and begins to execute
one of the jobs from memory.
 Once this job needs an I/O operation operating system
switches to another job (CPU and OS always busy).
 Jobs in the memory are always less than the number of jobs
on disk(Job Pool).
 If several jobs are ready to run at the same time, then the
system chooses which one to run through the process
of CPU Scheduling.
 In Non-multi programmed system, there are moments
when CPU sits idle and does not do any work.
 In Multiprogramming system, CPU will never be idle and
keeps on processing.
Time-sharing operating systems
 Time-sharing is a technique which enables many people,
located at various terminals, to use a particular computer
system at the same time. Time-sharing or multitasking is
a logical extension of multiprogramming. Processor's
time which is shared among multiple users
simultaneously is termed as time-sharing.

 Multiple jobs are executed by the CPU by switching


between them, but the switches occur so frequently.
Thus, the user can receive an immediate response.
Time-sharing operating systems
 The operating system uses CPU scheduling and
multiprogramming to provide each user with a small
portion of a time.
 The time sharing system provides the direct access to a
large number of users where CPU time is divided
among all the users on scheduled basis. The OS
allocates a set of time to each user. When this time is
expired, it passes control to the next user on the
system. The time allowed is extremely small and the
users are given the impression that they each have
their own CPU and they are the sole owner of the CPU.
This short period of time during that a user gets
attention of the CPU; is known as a time slice or a
quantum.
Time-sharing operating systems
In the above figure the user 5 is
active state but user 1, user 2, user 3,
and user 4 are in a waiting state
whereas user 6 is in a ready state.

Active State – The user’s program is


under the control of the CPU. Only
one program is available in this
state.
Ready State – The user program is
ready to execute but it is waiting for
its turn to get the CPU. More than
one user can be in a ready state at a
time.
Waiting State – The user’s program
is waiting for some input/output
operation. More than one user can
be in a waiting state at a time.
Main difference between Multiprogrammed
Batch Systems and Time-Sharing Systems

 In case of Multiprogrammed batch systems, the


objective is to maximize processor use, whereas in
Time-Sharing Systems, the objective is to minimize
response time.
Advantages of Timesharing
operating systems
 Provides the advantage of quick response.
 Avoids duplication of software.
 Reduces CPU idle time.
 Each task gets an equal opportunity.
Disadvantages

 Reliability problem.
 One must have to take of the security and integrity of
user programs and data.
 Data communication problem.
Personal Computer
 A personal computer is a computer small and low
cost, which is intended for personal use (or for use by a
small group of individuals). The term "personal
computer" is used to describe desktop
computers(desktops). It is often shortened to the
acronym PC or microcomputer, whose meaning in
English is "personal computer". It is a very common
type of machines.
 The first general-purpose, cost-
effective personal computer created by IBM was called
the IBM PC or means "personal computer" .
Personal Computer
 It is a microprocessor technology that has been any
small, relatively inexpensive computer designed to be
used by one person, at home or in an office.

 The example of Personal Computer or PC are


microcomputer, desktop computer, laptop computer,
tablet. In all these computer manufacturers to put an
entire CPU on one chip.
Parallel systems also call Multiprocessor
Operating System
 Multiprocessor Operating System refers to the use
of two or more central processing units (CPU) within a
single computer system. These multiple CPUs are in a
close communication sharing the computer bus,
memory and other peripheral devices.
 These types of systems are used when very high speed
is required to process a large volume of data. These
systems are generally used in environment like satellite
control, weather forecasting etc.
Parallel systems
Benefits of using a multiprocessor
include:
 Enhanced performance
 Multiple applications
 Multiple users
 Multi-tasking inside an application
 High throughput and/or responsiveness
 Hardware sharing among CPUs
Communication architecture of a
multiprocessor:
 Message Passing
 Independent address space for every processor
 Processor communication by means of message passing
 Processors include private memories
 Concentrates attention on high-priced, non-local operations

Shared Memory
 Processor communication is done by means of a shared
address space
 Processor communication is done by means of shared
memory read/write
 Convenient on small-scale devices
 Lower latency
 Non-uniform memory access (NUMA) or symmetric
multiprocessing (SMP)
Distributed Systems
 Distributed systems use multiple central processors to
serve multiple real-time applications and multiple
users. Data processing jobs are distributed among the
processors accordingly.
 The processors communicate with one another
through various communication lines (such as high-
speed buses or telephone lines).
 These are referred as loosely coupled systems or
distributed systems. Processors in a distributed system
may vary in size and function. These processors are
referred as sites, nodes, computers, and so on.
Characteristics of Distributed
System:
 Resource Sharing: It is the ability to use any Hardware, Software, or Data
anywhere in the System.
 Openness: It is concerned with Extensions and improvements in the system
(i.e., How openly the software is developed and shared
with others)
 Concurrency: It is naturally present in Distributed Systems, that deal with the
same activity or functionality that can be performed by separate users who are
in remote locations. Every local system has its independent Operating Systems
and Resources.
 Scalability: It increases the scale of the system as a number of processors
communicate with more users by accommodating to improve the
responsiveness of the system.
 Fault tolerance: It cares about the reliability of the system if there is a failure
in Hardware or Software, the system continues to operate properly without
degrading the performance the system.
 Transparency: It hides the complexity of the Distributed Systems to the Users
and Application programs as there should be privacy in every system.
 Heterogeneity: Networks, computer hardware, operating systems,
programming languages, and developer implementations can all vary and
differ among dispersed system components.
The advantages of distributed
systems are:
 With resource sharing facility, a user at one site may be
able to use the resources available at another.
 Speedup the exchange of data with one another via
electronic mail.
 If one site fails in a distributed system, the remaining
sites can potentially continue operating.
 Better service to the customers.
 Reduction of the load on the host computer.
 Reduction of delays in data processing.
Disadvantages of Distributed
System:

 Relevant Software for Distributed systems does not exist


currently.
 Security possess a problem due to easy access to data as the
resources are shared to multiple systems.
 Networking Saturation may cause a hurdle in data transfer
i.e., if there is a lag in the network then the user will face a
problem accessing data.
 In comparison to a single user system, the database
associated with distributed systems is much more complex
and challenging to manage.
 If every node in a distributed system tries to send data at
once, the network may become overloaded.
Applications Area of Distributed
System:

 Finance and Commerce: Amazon, eBay, Online Banking,


E-Commerce websites.
 Information Society: Search Engines, Wikipedia, Social
Networking, Cloud Computing.
 Cloud Technologies: AWS, Salesforce, Microsoft Azure,
SAP.
 Entertainment: Online Gaming, Music, youtube.
 Healthcare: Online patient records, Health Informatics.
 Education: E-learning.
 Transport and logistics: GPS, Google Maps.
 Environment Management: Sensor technologies.
Real-Time Systems
 A real-time system is defined as a data processing
system in which the time interval required to process
and respond to inputs is so small that it controls the
environment.
 The time taken by the system to respond to an input
and display of required updated information is termed
as the response time.
 Real-time systems are used when there are rigid time
requirements on the operation of a processor or the
flow of data and real-time systems can be used as a
control device in a dedicated application.
 A real-time operating system must have well-defined,
fixed time constraints, otherwise the system will fail.
Types of real-time operating
systems
Hard real-time systems Soft real-time systems
 Hard real-time systems  Soft real-time systems are less
guarantee that critical tasks restrictive. A critical real-time
complete on time. In hard real-
time systems, secondary storage task gets priority over other
is limited or missing and the tasks and retains the priority
data is stored in ROM. In these until it completes. Soft real-
systems, virtual memory is time systems have limited
almost never found.
utility than hard real-time
 For example, Scientific
experiments, medical imaging
systems.
systems, industrial control  For Example, Home
systems, weapon systems, Appliances
robots, air traffic control
systems, etc
Advantages:
 The advantages of real-time operating systems are as follows-
 Maximum consumption –
Maximum utilization of devices and systems. Thus more output from all the resources.

 Task Shifting –
Time assigned for shifting tasks in these systems is very less. For example, in older systems, it takes
about 10 microseconds. Shifting one task to another and in the latest systems, it takes 3
microseconds.

 Focus On Application –
Focus on running applications and less importance to applications that are in the queue.

 Real-Time Operating System In Embedded System –


Since the size of programs is small, RTOS can also be embedded systems like in transport and others.

 Error Free –
These types of systems are error-free.

 Memory Allocation –
Memory allocation is best managed in these types of systems.
Disadvantages:

The disadvantages of real-time operating systems are as follows-

 Limited Tasks –
Very few tasks run simultaneously, and their concentration is very less on few
applications to avoid errors.

 Use Heavy System Resources –


Sometimes the system resources are not so good and they are expensive as well.

 Complex Algorithms –
The algorithms are very complex and difficult for the designer to write on.

 Device Driver And Interrupt signals –


It needs specific device drivers and interrupts signals to respond earliest to interrupts.

 Thread Priority –
It is not good to set thread priority as these systems are very less prone to switching tasks.

 Minimum Switching – RTOS performs minimal task switching.

You might also like