You are on page 1of 42

Lecture 1:

Introduction to Operating Systems

Instructor:
Rachana Nyaichyai
WHAT IS AN OPERATING
SYSTEM?
❖ A type of system control program that manages the resources
of the computer system and controls execution of user
program.
❖ An Operating System (OS) is an interface between a
computer user and computer hardware. An operating system
is a software which performs all the basic tasks like file
management, memory management, process management,
handling input and output, and controlling peripheral
devices such as disk drives and printers.

❖ It is a program that acts as an


intermediary between a user
of a computer and the computer hardware.

1
WHAT IS AN OPERATING
SYSTEM?
❖ An operating system commonly referred to as
OS is an integrated set of programs that
controls resources such as memory, I/O
devices, CPU etc. of a computer system and
provides its users with an interface or virtual
machine that is easier to use than real
machine.
❖ It provides a basis and execution environment
for application programs.
❑ Uniform abstract representation of resources that
can be requested and accessed by applications
i.e. Processor, memory, I/O (disk, network)
❑ Exploits the hardware resources of one or more
processors
❑ Manages secondary memory and I/O devices
2
DESIGN GOALS OF OPERATING
SYSTEM:
❖ Make a computing system convenient to
use
❖ Use the computer hardware and
resources in an efficient manner
❖ Execute user programs and make
solving user problems easier
❖ Create user-friendly computing
environment
❖ Make a computing system secure
3
COMPUTER SYSTEM
COMPONENTS:
Components of Computer System are
divided into four parts:
1. Hardware
Basic computing resources: processor (CPU), memory,
I/O devices
2. Operating system
Program that Controls and coordinates the use of
hardware among multiple programs running on a
computer
3. Application program
Solve user-specific problems: compilers, database
systems, business applications
4. User
People, machines, other computers

4
FUNCTIONS OF OPERATING
S YSTEMS:
1. Process Management:
❑ A process is a program in execution. It is a unit of
work within the system. Program is a passive entity,
and process is an active entity.

❑ During execution a process needs certain resources


such as CPU time, memory spaces, files and I/O
devices.

❑ The operating system is responsible for the following


activities in connection with process management:
➢ Creating and deleting both user and system processes
➢ Suspending and resuming processes
➢ Providing mechanisms for process synchronization
➢ Providing mechanisms for process communication
➢ Providing mechanisms for deadlock handling

2/12/2019 7
FUNCTIONS OF OPERATING
SYSTEMS:
2. Memory Management:
❑ All data in memory before and after processing
❑ All instructions in memory in order to execute
❑ Memory management determines what is in memory
❑ Optimizing CPU utilization and computer response to
users
❑ Memory management activities
❑ Keeping track of which parts of memory are currently
being used and by whom
❑ Deciding which processes (or parts thereof) and data to
move into and out of memory
❑ Allocating and deallocating memory space as needed

2/12/2019 8
FUNCTIONS OF OPERATING
SYSTEMS:
3. File Management:
❑ File is the logical storage unit in a computer system.

❑ Files are usually organized into directories

❑ The operating system is responsible for the following


activities in connection with file management:
➢ Creating and deleting files and directories

➢ Primitives to manipulate files and directories

➢ Mapping files onto secondary storage

➢ Controlling access control to files

2/12/2019 9
FUNCTIONS OF OPERATING
SYSTEMS:
4. Device Management:
❑ An OS manages device communication via their
respective drivers.

❑ It performs the following activities for device


management:
➢ Keeps tracks of all devices connected to system. designates
a program responsible for every device known as the
Input/output controller.
➢ Decides which process gets access to a certain device and
for how long.
➢ Allocates devices in an effective and efficient way.
➢ De-allocates devices when they are no longer required.

2/12/2019 10
FUNCTIONS OF OPERATING
SYSTEMS:
5. Network Management:
❑ An OS manages active and passive components over
network.

❑ Identifies faults in network connections and


troubleshoots them.

❑ Enables accessing of remote resources.

❑ Provides proper security against viruses, hackers,


and data corruption.

❑ Providing routing services, including support for


major networking protocols, so that the operating
system knows what data to send where.

2/12/2019 11
FUNCTIONS OF OPERATING
SYSTEMS:
6. Protection and Security
❑ An OS protects the computer system from
malicious applications.

❑ OS regulates the flow of data within the system.

❑ It protects accessing of computer resources from


unauthorized user.

❑ It uses password protection to protect user data


and similar other techniques.

2/12/2019 12
FUNCTIONS OF OPERATING
SYSTEMS:
7. Provides User Interface
❑ An OS facilitates the communication between an
application and its user by acting as an intermediary
between them.
❑ User interact with the system either by using
Command-Line User Interface or by Graphical User
Interface.
❑ Command Line User Interface displays text, and
its commands are usually typed on a command line
using a keyboard.
❑ With a graphical user interface, the functions are
carried out by clicking or moving buttons, icons and
menus by means of a pointing device.

2/12/2019 13
PROCESS MANAGEMENT
 A process is program under execution.
 The process management module manages the
different types of processes submitted to the
system in such a way that it minimizes the idle
time of the processors.
DIFFERENT PROCESS STATES (PROCESS
LIFE CYCLE)
 Processes in the operating system can be in any of
the following states:
 NEW- The process is being created.

 READY- The process is waiting to be assigned to a


processor. Ready processes are waiting to have the
processor allocated to them by the operating system
so that they can run. Process may come into this
state after Start state or while running it by but
interrupted by the scheduler to assign CPU to some
other process
 RUNNING- Instructions are being executed.
 WAITING- Process moves into the waiting state
if it needs to wait for a resource, such as waiting
for user input, or waiting for a file to become
available. The process is waiting for some event
to occur(such as an I/O completion or reception of
a signal).
 TERMINATED- The process has finished
execution
BATCH PROCESSING
 Batch processing is a technique in which an
Operating System collects the programs and data
together in a batch before processing starts.
 An operating system does the following activities
related to batch processing −
➢ The OS defines a job which has predefined
sequence of commands, programs and data as a
single unit.
➢ The OS keeps a number a jobs in memory and
executes them without any manual information.
➢ Jobs are processed in the order of submission, i.e.,
first come first served fashion.
➢ When a job completes its execution, its memory is
released and the output for the job gets copied
into an output spool for later printing or
processing.
Advantages
 Batch processing takes much of the work of the
operator to the computer.
 Increased performance as a new job get started as
soon as the previous job is finished, without any
manual intervention.

Disadvantages
 Difficult to debug program.

 A job could enter an infinite loop.

 Due to lack of protection scheme, one batch job can


affect pending jobs
MULTIPROGRAMMING
 It refers to inter-leaved execution of two or more
different and independent programs by a
computer.
 Sharing the processor, when two or more
programs reside in memory at the same time, is
referred as multiprogramming.
 Multiprogramming assumes a single shared
processor.
 Multiprogramming increases CPU utilization by
organizing jobs so that the CPU always has one
to execute.
FIG: TYPICAL SCENARIO OF JOB IN MULTIPROGRAMMING SYSTEM
 Above figure shows a typical scenario of jobs in a
multiprogramming system.
 At the time instance shown, there are three jobs (A,B,
and C) residing in memory out of which job A is
performing I/O operation (writing disk), job B is
executing (utilizing CPU time), and job C is waiting for
CPU to become free.
 Actually, as above figure shows, in case of
multiprogramming, all jobs residing in main memory
are in one of the following three states:
1. Running

2. Blocked

3. Ready
UNIPROGRAMMING SYSTEM
 It is a system which processes only one job at a
time and all the system resources are available
for the job until its completion.
 The figure below shows a uni-programming
system :
 An OS does the following activities related to
multiprogramming.
➢ The operating system keeps several jobs in memory at
a time.
➢ This set of jobs is a subset of the jobs kept in the job
pool.
➢ The operating system picks and begins to execute one
of the jobs in the memory.
➢ Multiprogramming operating systems monitor the
state of all active programs and system resources using
memory management programs to ensures that the
CPU is never idle, unless there are no jobs to process.
Advantages
 High and efficient CPU utilization.
 User feels that many programs are allotted CPU almost
simultaneously.
Disadvantages
 CPU scheduling is required.
 To accommodate many jobs in memory, memory
management is required.
TYPES OF JOBS
 A jobs does not need CPU for entire duration of its
processing because in addition to computation (for which
CPU is needed ), it often needs to perform I/O operations
(such as reading/writing of data from/to a disk.
 On the basis of utilization jobs are of two types:
1. CPU bound jobs
➢ These jobs mostly perform computations with little I/O
operations.
➢ CPU utilization is high
➢ Programs used for scientific and engineering falls in this
category of jobs.
2. I/O bound jobs
➢ These type of job mostly perform I/O operation with little
computation
➢ CPU utilization is low
➢ Programs used for commercial data processing fall under
this kind of job
REQUIREMENTS OF MULTIPROGRAMMING
SYSTEM

1) Larger Memory
2) Memory Protection
3) Job status Reservation
4) Proper Mix up of Jobs
5) CPU Scheduling
MULTITASKING
 Multitasking is when multiple jobs are executed by the
CPU simultaneously by switching between them.
 Switches occur so frequently that the users may interact with
each program while it is running.
 An OS does the following activities related to multitasking −
➢ The user gives instructions to the operating system or to
a program directly, and receives an immediate response.
➢ The OS handles multitasking in the way that it can handle
multiple operations/executes multiple programs at a time.
➢ Multitasking Operating Systems are also known as Time-
sharing systems.
➢ These Operating Systems were developed to provide interactive
use of a computer system at a reasonable cost.
➢ A time-shared operating system uses the concept of
CPU scheduling and multiprogramming to provide each
user with a small portion of a time-shared CPU.
➢ Each user has at least one separate program in memory.
MULTIPROCESSING
 Multi-processing refers to the ability of a system to support
more than one processor at the same time.
 Applications in a multi-processing system are broken to
smaller routines that run independently.
 The operating system allocates these threads to the
processors improving performance of the system.
 Multiprocessor system means, there are more than one
processor which work parallel to perform the required
operations.
 It allows the multiple processors, and they are connected
with physical memory, computer buses, clocks, and
peripheral devices.
 The main objective of using a multiprocessor operating
system is to increase the execution speed of the system and
consume high computing power
TYPES OF MULTIPROCESSING SYSTEM
1. Tightly coupled – single system with primary
memory shared by all processors
2. Loosely coupled – Each processor has its own
local memory.
CPU,MEMORY, AND I/O PROCESSORS OF A
COMPUTER SYSTEM
ASSIGNMENT 2:
 Explain about time sharing system.
 Differentiate between multiprogramming,
multiprocessing and multitasking.

 Submission date: 2079/04/15


MEMORY MANAGEMENT
 Memory management is the functionality of an
operating system which handles or manages primary
memory and moves processes back and forth between
main memory and disk during execution.
 Memory management keeps track of each and every
memory location, regardless of either it is allocated to
some process or it is free.
 It checks how much memory is to be allocated to
processes.
 It decides which process will get memory at what
time.
 It tracks whenever some memory gets freed or
unallocated and correspondingly it updates the
status.
UNIPROGRAMMING MEMORY MODEL
 Used in system that process one job only at a
time, and all system resources are available
exclusively for the job until it completes
 Simple and easy to implement

 Does not lead to proper utilization of main


memory as unoccupied memory space by the
currently active user process remains unused
 Used only on very small or dedicated computer
systems
MULTIPROGRAMMING MEMORY MODEL
 Two memory management schemes used to
facilitate this are:
➢ Multiprogramming with fixed number of
memory: user area of memory is divided into a
number of fixed-sized partitions
➢ Multiprogramming with variable number of
memory partitions: number, size and location
of partitions vary dynamically as processes
come and go
FILE MANAGEMENT
 A file is a collection of related information
 Every file has a name, its data and attributes

 File’s name uniquely identifies it in the system


and is used by its users to access it
 File management module of an operating system
takes care of file-related activities such as
structuring, accessing, naming, sharing and
protection of files.
File access methods
 Two commonly supported file access methods are:
1. Sequential access
2. Random access

File Operations
 Set of commands provided by an operating system to deal
with files and their contents
 Create
 Delete
 Open
 Close
 Read
 write
 Seek
 Rename
 Copy etc.
SOME POPULAR OPERATING SYSTEM

 DOS
 WINDOWS

 UNIX

 LINUX

You might also like