SlideShare a Scribd company logo
OPERATING SYSTEMS
Prepared by
Dr P PRABAKARAN
Department of Computer Applications-PG
School of Computing Sciences
Vels Institute of Science Technology and Advanced Studies
Chennai
INTRODUCTION TO OPERATING SYSTEMS
DEFINITION OF OPERATING SYSTEM:
Operating System (OS) is a software that acts as an interface between
computer hardware components and the user.
INTRODUCTION TO OPERATING SYSTEMS
ROLE OF AN OPERATING SYSTEM
1. Memory Management
2. Processor Management
3. Device Management
4. File Management
5. Security
6. Control over system performance
7. Job accounting
8. Error detecting aids
9. Coordination between other software and users
INTRODUCTION TO OPERATING SYSTEMS
Memory Management
Memory management refers to management of Primary Memory or Main
Memory. Main memory is a large array of words or bytes where each word or
byte has its own address.
Main memory provides a fast storage that can be accessed directly by the CPU.
For a program to be executed, it must in the main memory.
INTRODUCTION TO OPERATING SYSTEMS
Processor Management
In multiprogramming environment, the OS decides which process gets the
processor when and for how much time. This function is called process
scheduling.
Device Management
An Operating System manages device communication via their respective drivers. It does
the following activities for device management −
Keeps tracks of all devices. Program responsible for this task is known as the I/O controller.
INTRODUCTION TO OPERATING SYSTEMS
File Management
A file system is normally organized into directories for easy navigation and
usage. These directories may contain files and other directions.
INTRODUCTION TO OPERATING SYSTEMS
Security
By means of password and similar other techniques, it prevents unauthorized
access to programs and data.
Control over system performance
Recording delays between request for a service and response from the system.
Job accounting
Keeping track of time and resources used by various jobs and users.
INTRODUCTION TO OPERATING SYSTEMS
Error detecting aids
Production of dumps, traces, error messages, and other debugging and error
detecting aids.
Coordination between other softwares and users
Coordination and assignment of compilers, interpreters, assemblers and other
software to the various users of the computer systems.
INTRODUCTION TO OPERATING SYSTEMS
TYPES OF OPERATING SYSTEM
The Operating System is responsible for managing various resources of the
system.
1. Batch Operating System
2. Time-Sharing Operating System
3. Distributed Operating System
4. Embedded Operating System
5. Real-time Operating System
INTRODUCTION TO OPERATING SYSTEMS
Batch Operating System
In a Batch Operating System, the similar jobs are grouped together into batches with the
help of some operator and these batches are executed one by one.
Time-Sharing Operating System
In a Multi-tasking Operating System, more than one processes are being executed at a
particular time with the help of the time-sharing concept. So, in the time-sharing
environment, we decide a time that is called time quantum and when the process starts its
execution then the execution continues for only that amount of time and after that, other
processes will be given chance for that amount of time only.
INTRODUCTION TO OPERATING SYSTEMS
Distributed Operating System
In a Distributed Operating System, we have various systems and all these systems have their
own CPU, main memory, secondary memory, and resources. These systems are connected
to each other using a shared communication network. Here, each system can perform its
task individually.
Embedded Operating System
An Embedded Operating System is designed to perform a specific task for a particular
device which is not a computer.
INTRODUCTION TO OPERATING SYSTEMS
Real-time Operating System
The Real-time Operating Systems are used in the situation where we are dealing with some
real-time data. So, as soon as the data comes, the execution of the process should be done
and there should be no dealy i.e. no buffer delays should be there.
INTRODUCTION TO OPERATING SYSTEMS
MAJOR OS COMPONENTS
An operating system is a large and complex system that can only be created by partitioning
into small pieces. These pieces should be a well-defined portion of the system, which
carefully defined inputs, outputs, and functions.
INTRODUCTION TO OPERATING SYSTEMS
Components:
1. File Management
2. Process Management
3. I/O Device Management
4. Network Management
5. Main Memory management
6. Secondary-Storage Management
7. Security Management
8. Other Important Activities
INTRODUCTION TO OPERATING SYSTEMS
INTRODUCTION TO OPERATING SYSTEMS
File Management
A file is a set of related information which is should define by its creator. It commonly
represents programs, both source and object forms, and data. Data files can be numeric,
alphabetic, or alphanumeric.
Process Management
The process management component is a procedure for managing the many processes that
are running simultaneously on the operating system. Every software application program
has one or more processes associated with them when they are running.
INTRODUCTION TO OPERATING SYSTEMS
I/O Device Management
One of the important use of an operating system that helps you to hide the variations of
specific hardware devices from the user.
Network Management
Network management is the process of administering and managing computer networks. It
includes performance management, fault analysis, provisioning of networks, and
maintaining the quality of service.
INTRODUCTION TO OPERATING SYSTEMS
Main Memory management
Main Memory is a large array of storage or bytes, which has an address. The memory
management process is conducted by using a sequence of reads or writes of specific
memory addresses.
INTRODUCTION TO OPERATING SYSTEMS
OPERATING SYSTEM OPERATIONS
An operating system is a construct that allows the user application programs
to interact with the system hardware.
The major operations of the operating system are process management,
memory management, device management and file management.
INTRODUCTION TO OPERATING SYSTEMS
OPERATING SYSTEM OPERATIONS
INTRODUCTION TO OPERATING SYSTEMS
OPERATING SYSTEM OPERATIONS
Process Management
The operating system is responsible for managing the processes i.e assigning
the processor to a process at a time. This is known as process scheduling.
The different algorithms used for process scheduling are FCFS (first come first
served), SJF (shortest job first), priority scheduling, round robin scheduling etc.
INTRODUCTION TO OPERATING SYSTEMS
OPERATING SYSTEM OPERATIONS
Memory Management
It deals with memory and the moving of processes from disk to primary
memory for execution and back again.
INTRODUCTION TO OPERATING SYSTEMS
OPERATING SYSTEM OPERATIONS
Device Management
There are many I/O devices handled by the operating system such as
mouse, keyboard, disk drive etc.
There are different device drivers that can be connected to the operating
system to handle a specific device.
The device controller is an interface between the device and the device
driver.
INTRODUCTION TO OPERATING SYSTEMS
OPERATING SYSTEM OPERATIONS
File Management
Files are used to provide a uniform view of data storage by the
operating system. All the files are mapped onto physical devices that
are usually non volatile so data is safe in the case of system failure.
Sequential Access
Direct Access
INTRODUCTION TO OPERATING SYSTEMS
OPERATING SYSTEM SERVICES
An Operating System supplies different kinds of services to both the
users and to the programs as well.
It also provides application programs (that run within an Operating
system) an environment to execute it freely.
It provides users the services run various programs in a convenient
manner.
INTRODUCTION TO OPERATING SYSTEMS
OPERATING SYSTEM SERVICES
An Operating System supplies different kinds of services to both the
users and to the programs as well.
It also provides application programs (that run within an Operating
system) an environment to execute it freely.
It provides users the services run various programs in a convenient
manner.
INTRODUCTION TO OPERATING SYSTEMS
OPERATING SYSTEM SERVICES
common services offered by an almost all operating systems:
User Interface
Program Execution
File system manipulation
Input / Output Operations
Communication
Resource Allocation
Error Detection
Accounting
Security and protection
INTRODUCTION TO OPERATING SYSTEMS
OPERATING SYSTEM SERVICES
User Interface
Usually Operating system comes in three forms or types.
Depending on the interface their types have been further
subdivided. These are:
 Command line interface
 Batch based interface
 Graphical User Interface
INTRODUCTION TO OPERATING SYSTEMS
OPERATING SYSTEM SERVICES
Program Execution
The operating system must have the capability to load a
program into memory and execute that program.
Furthermore, the program must be able to end its
execution, either normally or abnormally / forcefully.
INTRODUCTION TO OPERATING SYSTEMS
OPERATING SYSTEM SERVICES
File System Manipulation
Programs need has to be read and then write them as files and
directories. File handling portion of operating system also allows
users to create and delete files by specific name along with
extension, search for a given file and / or list file information.
Some programs comprise of permissions management for allowing
or denying access to files or directories based on file ownership.
INTRODUCTION TO OPERATING SYSTEMS
OPERATING SYSTEM SERVICES
Input/Output Operations
A program which is currently executing may require I/O, which may
involve file or other I/O device. For efficiency and protection, users
cannot directly govern the I/O devices.
So, the OS provide a means to do I/O Input / Output operation
which means read or write operation with any file.
INTRODUCTION TO OPERATING SYSTEMS
SYSTEM CALLS
A system call is a method of interacting with the operating system
via programs. A system call is a request from computer software to
an operating system's kernel.
A system call is a way for a user program to interface with the
operating system.
INTRODUCTION TO OPERATING SYSTEMS
Types of System Calls
1. Process Control
2. File Management
3. Device Management
4. Information Maintenance
5. Communication
INTRODUCTION TO OPERATING SYSTEMS
Process Control
Process control is the system call that is used to direct the processes. Some
process control examples include creating, load, abort, end, execute, process,
terminate the process, etc.
File Management
File management is a system call that is used to handle the files. Some file
management examples include creating files, delete files, open, close, read,
write, etc.
INTRODUCTION TO OPERATING SYSTEMS
Device Management
Device management is a system call that is used to deal with devices. Some
examples of device management include read, device, write, get device
attributes, release device, etc.
Information Maintenance
Information maintenance is a system call that is used to maintain information.
There are some examples of information maintenance, including getting
system data, set time or date, get time or date, set system data, etc.
INTRODUCTION TO OPERATING SYSTEMS
Communication
Communication is a system call that is used for communication. There are
some examples of communication, including create, delete communication
connections, send, receive messages, etc.
INTRODUCTION TO OPERATING SYSTEMS
SYSTEM PROGRAMS
System programs provide an environment where programs can be developed
and executed. In the simplest sense, system programs also provide a bridge
between the user interface and system calls.
INTRODUCTION TO OPERATING SYSTEMS
Types of System Programs
Status Information
Communications
File Manipulation
Program Loading and Execution
File Modification
Application Programs
INTRODUCTION TO OPERATING SYSTEMS
OPERATING SYSTEM STRUCTURE
 Simple Structure
 Monolithic Approach
 Layered Approach
 Microkernels
INTRODUCTION TO OPERATING SYSTEMS
OPERATING SYSTEM STRUCTURE
Simple Structure
Operating systems such as MS-DOS and the original UNIX did not have well-
defined structures.
There was no CPU Execution Mode (user and kernel), and so errors in
applications could cause the whole system to crash.
INTRODUCTION TO OPERATING SYSTEMS
OPERATING SYSTEM STRUCTURE
Simple Structure
INTRODUCTION TO OPERATING SYSTEMS
OPERATING SYSTEM STRUCTURE
Monolithic Approach
Functionality of the OS is invoked with simple function calls within the kernel,
which is one large program.
Device drivers are loaded into the running kernel and become part of the
kernel.
INTRODUCTION TO OPERATING SYSTEMS
OPERATING SYSTEM STRUCTURE
Monolithic Approach
INTRODUCTION TO OPERATING SYSTEMS
OPERATING SYSTEM STRUCTURE
Layered Approach
This approach breaks up the operating system into different layers.
This allows implementers to change the inner workings, and increases
modularity.
As long as the external interface of the routines don’t change, developers have
more freedom to change the inner workings of the routines.
INTRODUCTION TO OPERATING SYSTEMS
OPERATING SYSTEM STRUCTURE
Layered Approach
INTRODUCTION TO OPERATING SYSTEMS
OPERATING SYSTEM STRUCTURE
Microkernels
This structures the operating system by removing all nonessential portions of
the kernel and implementing them as system and user level programs.
Generally they provide minimal process and memory management, and a
communications facility.
Communication between components of the OS is provided by message
passing.
INTRODUCTION TO OPERATING SYSTEMS
OPERATING SYSTEM STRUCTURE
Microkernels
INTRODUCTION TO OPERATING SYSTEMS
PROCESS
A process is a program at the time of execution. The process is more than the
program code. It includes the program counter, the process stack, and the
content of the process register, etc.
INTRODUCTION TO OPERATING SYSTEMS
PROCESS
Process States in OS
1. New: The process is being created.
2. Running: The process is being executed.
3. Waiting: The process is waiting for some event to occur.
4. Ready: The process is waiting to be assigned to a processor.
5. Terminate: The process has finished execution.
INTRODUCTION TO OPERATING SYSTEMS
PROCESS SCHEDULING
The process scheduling is the activity of the process manager that
handles the removal of the running process from the CPU.
Process scheduling is an essential part of a Multiprogramming
operating systems. Such operating systems allow more than one
process to be loaded into the executable memory at a time.
INTRODUCTION TO OPERATING SYSTEMS
OPERATIONS ON PROCESSES
There are many operations that can be performed on processes.
Some of these are process creation, process preemption, process
blocking, and process termination.
INTRODUCTION TO OPERATING SYSTEMS
OPERATIONS ON PROCESSES
Process Creation
Processes need to be created in the system for different operations. This can
be done by the following events.
 User request for process creation
 System initialization
 Execution of a process creation system call by a running process
 Batch job initialization
INTRODUCTION TO OPERATING SYSTEMS
OPERATIONS ON PROCESSES
Process Creation
INTRODUCTION TO OPERATING SYSTEMS
OPERATIONS ON PROCESSES
Process Preemption
An interrupt mechanism is used in preemption that suspends the process
executing currently and the next process to execute is determined by the
short-term scheduler. Preemption makes sure that all processes get some CPU
time for execution.
INTRODUCTION TO OPERATING SYSTEMS
OPERATIONS ON PROCESSES
Process Blocking
The process is blocked if it is waiting for some event to occur. This event may
be I/O as the I/O events are executed in the main memory and don't require
the processor. After the event is complete, the process again goes to the ready
state.
INTRODUCTION TO OPERATING SYSTEMS
OPERATIONS ON PROCESSES
Process Termination
After the process has completed the execution of its last instruction, it is
terminated. The resources held by a process are released after it is terminated.
INTRODUCTION TO OPERATING SYSTEMS
INTER PROCESS COMMUNICATION
Interprocess communication is the mechanism provided by the operating
system that allows processes to communicate with each other.
This communication could involve a process letting another process know that
some event has occurred or the transferring of data from one process to
another.
INTRODUCTION TO OPERATING SYSTEMS
Approaches for Inter-Process Communication
THREADS
A thread is a single sequential flow of execution of tasks of a
process so it is also known as thread of execution or thread of
control. There is a way of thread execution inside the process of
any operating system.
Types of Threads
Kernel level thread.
User-level thread.
THREADS
Benefits of Threads
 Enhanced throughput of the system
 Effective Utilization of Multiprocessor system
 Faster context switch
 Responsiveness
 Communication
 Resource sharing
MULTITHREADING MODELS
Multithreading allows the application to divide its task into
individual threads.
In multi-threads, the same process or task can be done by the
number of threads, or we can say that there is more than one
thread to perform the task in multithreading.
With the use of multithreading, multitasking can be achieved.
MULTITHREADING MODELS
Types of Multithreading models
 Many to one multithreading model
 One to one multithreading model
 Many to Many multithreading models
THREAD LIBRARIES
Types of Multithreading models
Thread Libraries has a collection of functions that useful in
creating and controlling threads. Programmers can access these
thread libraries using an application programming interface
(API).
Thread libraries can be the user level library or kernel level
library.
THREADING ISSUES
 The fork() and exec() system call
 Signal handling
 Thread cancelation
 Thread local storage
 Scheduler activation
BASIC CONCEPTS OF SCHEDULING
The process scheduling is the activity of the process manager
that handles the removal of the running process from the CPU
and the selection of another process on the basis of a particular
strategy.
Process scheduling is an essential part of a Multiprogramming
operating systems. Such operating systems allow more than one
process to be loaded into the executable memory at a time and
the loaded process shares the CPU using time multiplexing.
SCHEDULING CRITERIA
CPU utilization - Ideally the CPU would be busy 100% of the time, so
as to waste 0 CPU cycles. On a real system CPU usage should range
from 40% ( lightly loaded ) to 90% ( heavily loaded. )
Throughput - Number of processes completed per unit time. May
range from 10 / second to 1 / hour depending on the specific
processes.
Turnaround time - Time required for a particular process to
complete, from submission time to completion. ( Wall clock time. )
SCHEDULING CRITERIA
Waiting time - How much time processes spend in the ready
queue waiting their turn to get on the CPU.
Load average - The average number of processes sitting in the
ready queue waiting their turn to get into the CPU. Reported in 1-
minute, 5-minute, and 15-minute averages by "uptime" and
"who". )
Response time - The time taken in an interactive program from
the issuance of a command to the commence of a response to
that command.
SCHEDULING ALGORITHMS
To decide which process to execute first and which process to
execute last to achieve maximum CPU utilization, computer
scientists have defined some algorithms, they are:
 First Come First Serve (FCFS)
 Shortest-Job-First (SJF) Scheduling
 Shortest Remaining Time
 Priority Scheduling
 Round Robin Scheduling
 Multilevel Queue Scheduling
SCHEDULING ALGORITHMS
SCHEDULING ALGORITHMS
First Come First Serve (FCFS)
First Come First Serve is the full form of FCFS. It is the easiest and most
simple CPU scheduling algorithm.
In this type of algorithm, the process which requests the CPU gets the CPU
allocation first.
This scheduling method can be managed with a FIFO queue.
SCHEDULING ALGORITHMS
Shortest Remaining Time
The full form of SRT is Shortest remaining time. It is also known as SJF
preemptive scheduling.
In this method, the process will be allocated to the task, which is closest to
its completion.
This method prevents a newer ready state process from holding the
completion of an older process.
SCHEDULING ALGORITHMS
Priority Based Scheduling
Priority scheduling is a method of scheduling processes based on priority.
In this method, the scheduler selects the tasks to work as per the priority.
Priority scheduling also helps OS to involve priority assignments. The
processes with higher priority should be carried out first, whereas jobs
with equal priorities are carried out on a round-robin or FCFS basis.
Priority can be decided based on memory requirements, time
requirements, etc.
SCHEDULING ALGORITHMS
Round-Robin Scheduling
Round robin is the oldest, simplest scheduling algorithm. The
name of this algorithm comes from the round-robin principle,
where each person gets an equal share of something in turn.
It is mostly used for scheduling algorithms in multitasking. This
algorithm method helps for starvation free execution of
processes.
SCHEDULING ALGORITHMS
Shortest Job First
SJF is a full form of (Shortest job first) is a scheduling algorithm
in which the process with the shortest execution time should be
selected for execution next.
This scheduling method can be preemptive or non-preemptive. It
significantly reduces the average waiting time for other
processes awaiting execution.
SCHEDULING ALGORITHMS
Multiple-Level Queues Scheduling
This algorithm separates the ready queue into various separate
queues. In this method, processes are assigned to a queue based
on a specific property of the process, like the process priority,
size of the memory, etc.
However, this is not an independent scheduling OS algorithm as
it needs to use other types of algorithms in order to schedule the
jobs.
MULTIPLE PROCESSORS SCHEDULING
Multiprocessor scheduling focuses on designing the system's
scheduling function, which consists of more than one processor.
Multiple CPUs share the load (load sharing) in multiprocessor
scheduling so that various processes run simultaneously.
In general, multiprocessor scheduling is complex as compared to
single processor scheduling.
REAL-TIME CPU SCHEDULING
Real-time systems are systems that carry real-time tasks. These
tasks need to be performed immediately with a certain degree of
urgency.
In particular, these tasks are related to control of certain events
(or) reacting to them. Real-time tasks can be classified as hard
real-time tasks and soft real-time tasks.
REAL-TIME CPU SCHEDULING
In real-time systems, the scheduler is considered as the most
important component which is typically a short-term task
scheduler.
The main focus of this scheduler is to reduce the response time
associated with each of the associated processes instead of
handling the deadline.
Unit-III – Operating Systems
BACKGROUND IN PROCESS SYNCHRONIZATION
Types:
Independent Process : Execution of one process does not affects the execution
of other processes.
Cooperative Process : Execution of one process affects the execution of other
processes.
Unit-III – Operating Systems
CRITICAL SECTION PROBLEM
Unit-III – Operating Systems
CRITICAL SECTION PROBLEM
Requirements
1. Mutual Exclusion - If a process is executing in its critical section, then no
other process is allowed to execute in the critical section.
2. Progress - If no process is executing in the critical section and other
processes are waiting outside the critical section.
3. Bounded Waiting - A bound must exist on the number of times that other
processes are allowed to enter their critical sections after a process has made
a request to enter its critical section and before that request is granted.
Unit-III – Operating Systems
SYNCHRONIZATION HARDWARE
There are three hardware approaches to solve process synchronization
problems:
1. Swap - In this algorithm, instead of directly setting the lock to true, the key is
first set to true and then swapped with the lock.
2. Test() and Set() - In Test and Set the shared variable is a lock that is initialized
to false.
3. Unlock and lock - This algorithm uses waiting[i] to check if there are any
processes in the wait.
Unit-III – Operating Systems
MUTEX LOCKS
The mutex locking mechanism ensures only one thread can acquire the mutex
and enter the critical section. This thread only releases the mutex when it exits in
the critical section.
Unit-III – Operating Systems
SEMAPHORE
A semaphore is a signaling mechanism, and another thread can signal a thread
that is waiting on a semaphore.
Unit-III – Operating Systems
SEMAPHORE USAGES
Semaphore can be associated with these four buffers, allowing users and
producers to work on different buffers simultaneously.
Advantages of Semaphore
It allows more than one thread to access the critical section.
Semaphores are machine-independent.
Semaphores are implemented in the machine-independent code of the
microkernel.
Unit-III – Operating Systems
MONITORS
The monitor is supported by programming languages to achieve mutual
exclusion between processes.
Advantages of Monitor:
Monitors have the advantage of making parallel programming easier and less
error prone than using techniques such as semaphore.
Unit-III – Operating Systems
DINING PHILOSOPHERS SOLUTIONS USING MONITORS
Dining-Philosophers Problem – N philosophers seated around a circular table
Attention reader! Don’t stop learning now. Practice GATE exam well before the
actual exam with the subject-wise and overall quizzes available in GATE Test
Series Course.
Unit-III – Operating Systems
IMPLEMENTATION OF MONITOR USING SEMAPHORES
We now consider a possible implementation of the monitor mechanism using
semaphores. For each monitor, a semaphore mutex (initialized to 1) is provided.
A process must execute wait(mutex) before entering the monitor and must
execute signal(mutex) after leaving the monitor.
Unit-IV
MEMORY MANAGEMENT
BACKGROUND
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.
Unit-IV
SWAPPING
When a process is executed it must have resided in memory. Swapping is a process of
swap a process temporarily into a secondary memory from the main memory, which is fast
as compared to secondary memory.
Unit-IV
CONTIGUOUS MEMORY ALLOCATION
The main memory should oblige both the operating system and the different client
processes. Therefore, the allocation of memory becomes an important task in the
operating system.
The memory is usually divided into two partitions:
Resident operating system and
User processes.
Unit-IV
PAGING
Paging is a method or techniques which is used for non-contiguous memory allocation. It is
a fixed size partitioning theme (scheme). In paging, both main memory and secondary
memory are divided into equal fixed size partitions.
Unit-IV
PAGING
Paging is a method or techniques which is used for non-contiguous memory allocation. It is
a fixed size partitioning theme (scheme). In paging, both main memory and secondary
memory are divided into equal fixed size partitions.
Unit-IV
SEGMENTATION
The partitions of secondary memory area unit known as as segments. The details
concerning every segment are hold in a table known as as segmentation table. Segment
table contains two main data concerning segment, one is Base, which is the bottom
address of the segment and another is Limit, which is the length of the segment.
Unit-IV
VIRTUAL MEMORY
Virtual Memory is a storage allocation scheme in which secondary memory can be
addressed as though it were part of main memory.
The addresses a program may use to reference memory are distinguished from the
addresses the memory system uses to identify physical storage sites, and program
generated addresses are translated automatically to the corresponding machine
addresses.
Unit-IV
DEMAND PAGING
The process of loading the page into memory on demand is known as demand paging.
The process includes the following steps:
1. If CPU try to refer a page that is currently not available in the main memory, it generates an
interrupt indicating memory access fault.
2. The OS puts the interrupted process in a blocking state. For the execution to proceed the OS
must bring the required page into the memory.
3. The OS will search for the required page in the logical address space.
4. The required page will be brought from logical address space to physical address space. The
page replacement algorithms are used for the decision making of replacing the page in physical
address space.
5. The page table will updated accordingly.
6. The signal will be sent to the CPU to continue the program execution and it will place the
process back into ready state.
Unit-IV
Unit-IV
COPY ON WRITE
Copy on Write or simply COW is a resource management technique. One of its main use is
in the implementation of the fork system call in which it shares the virtual memory(pages)
of the OS.
In UNIX like OS, fork() system call creates a duplicate process of the parent process which
is called as the child process.
Unit-IV
Unit-IV
PAGE REPLACEMENT
Page replacement algorithms are the techniques using which an Operating System decides
which memory pages to swap out, write to disk when a page of memory needs to be
allocated. Paging happens whenever a page fault occurs and a free page cannot be used
for allocation purpose accounting to reason that pages are not available or the number of
free pages is lower than required pages.
There are many different page replacement algorithms. We evaluate an algorithm by
running it on a particular string of memory reference and computing the number of page
faults.
Unit-IV
PAGE REPLACEMENT ALGORITHM
1. First In First Out (FIFO) algorithm
2. Optimal Page algorithm
3. Least Recently Used (LRU) algorithm
Unit-IV
First In First Out (FIFO) algorithm
Oldest page in main memory is the one which will be selected for replacement.
Easy to implement, keep a list, replace pages from the tail and add new pages at the head.
Unit-IV
Optimal Page algorithm
An optimal page-replacement algorithm has the lowest page-fault rate of all algorithms.
An optimal page-replacement algorithm exists, and has been called OPT or MIN.
Replace the page that will not be used for the longest period of time. Use the time when a
page is to be used.
Unit-IV
Least Recently Used (LRU) algorithm
Page which has not been used for the longest time in main memory is the one which will
be selected for replacement.
Easy to implement, keep a list, replace pages by looking back into time.
Unit-IV
ALLOCATION OF FRAMES
The absolute minimum number of frames that a process must be allocated is dependent
on system architecture, and corresponds to the worst-case scenario of the number of
pages that could be touched by a single ( machine ) instruction.
If an instruction (and its operands) spans a page boundary, then multiple pages could be
needed just for the instruction fetch.
Memory references in an instruction touch more pages, and if those memory locations can
span page boundaries, then multiple pages could be needed for operand access also.
Unit-IV
THRASHING
Thrashing in computing is an issue caused when virtual memory is in use. It occurs when
the virtual memory of a computer is rapidly exchanging data for data on hard disk, to the
exclusion of most application-level processing. As the main memory gets filled, additional
pages need to be swapped in and out of virtual memory.
The swapping causes a very high rate of hard disk access. Thrashing can continue for a long
duration until the underlying issue is addressed. Thrashing can potentially result in total
collapse of the hard drive of the computer.
Unit - V
I/O HARDWARE
One of the important jobs of an Operating System is to manage various I/O devices
including mouse, keyboards, touch pad, disk drives, display adapters, USB devices,
Bit-mapped screen, LED, Analog-to-digital converter, On/off switch, network
connections, audio I/O, printers etc.
Categories
Block devices − A block device is one with which the driver communicates by sending entire
blocks of data. For example, Hard disks, USB cameras, Disk-On-Key etc.
Character devices − A character device is one with which the driver communicates by sending
and receiving single characters (bytes, octets). For example, serial ports, parallel ports, sounds
cards etc
Unit - V
Device Controllers
Device drivers are software modules that can be plugged into an OS to handle a particular
device. Operating System takes help from device drivers to handle all I/O devices.
Unit - V
APPLICATION I/O INTERFACE
I/O Interface
There is need of surface whenever any CPU wants to communicate with I/O devices. The
interface is used to interpret address which is generated by CPU.
Thus, surface is used to communicate to I/O devices i.e. to share information between
CPU and I/O devices interface is used which is called as I/O Interface.
Unit - V
Various applications of I/O Interface
Application of I/O is that we can say interface have access to open any file without any
kind of information about file.
It also has feature that it can be used to also add new devices to computer system even it
does not cause any kind of interrupt to operating system.
The access to each of general kind is through standardized set of function which is called
as interface.
Unit - V
KERNEL I/O SUBSYSTEM
Kernel I/O Subsystem is responsible to provide many services related to I/O. Following are
some of the services provided.
1. Scheduling
2. Buffering
3. Caching
4. Spooling and Device Reservation
5. Error Handling
Unit - V
COMMUNICATION WITH I/O DEVICES
The data transfers between the CPU and I/O devices may handle in a variety of
techniques. Some techniques use the CPU as an intermediate path, others transfer the
data directly to and from the memory unit.
The data transfers to and from peripherals that are saying Input-Output communication.
Types of Input-Output communication techniques
Programmed I/O
Interrupt-initiated I/O
Direct Memory Access (DMA)
Unit - V
Programmed I/O
In the programmed I/O method, the I/O device doesn’t have direct memory access.
The data transfer from an I/O device to memory requires the execution of a program or
several instructions by CPU So that this method says Programmed I/O.
Interrupt-initiated I/O
The problem in programmed I/O is that the CPU has to wait for the ready signal from the
I/O device. The alternative method for this problem is Interrupt-initiated I/O or Interrupt
driven I/O.
Unit - V
Direct Access Memory (DMA)
Direct Memory Access (DMA) is a process where the data transforms between the
microprocessor (CPU). The memory and peripheral devices directly without the
involvement of the microprocessor (CPU).
Unit - V
STREAMS
A full-duplex communication channel between a user-level process and a device in Unix
System V and beyond.
A STREAM consists of
STREAM head interfaces
Driver end interfaces with the device
Zero or more STREAM modules between them.
Unit - V

More Related Content

Similar to OpeatingSystemPPT

Operating system 2
Operating system 2Operating system 2
Operating system 2
matsapit
 
chapter 3 opreating system lecture note and its is impaortamt concept for mn
chapter 3 opreating system  lecture note and its is impaortamt concept for mnchapter 3 opreating system  lecture note and its is impaortamt concept for mn
chapter 3 opreating system lecture note and its is impaortamt concept for mn
dejenehundaol91
 

Similar to OpeatingSystemPPT (20)

Basics of Operating System
Basics of Operating SystemBasics of Operating System
Basics of Operating System
 
Operating System
Operating SystemOperating System
Operating System
 
Operating system
Operating systemOperating system
Operating system
 
Operating Systems R20 Unit 1.pptx
Operating Systems R20 Unit 1.pptxOperating Systems R20 Unit 1.pptx
Operating Systems R20 Unit 1.pptx
 
Operating system notes pdf
Operating system notes pdfOperating system notes pdf
Operating system notes pdf
 
Fundamental concepts and_principles_of_operating_systems (2)
Fundamental concepts and_principles_of_operating_systems (2)Fundamental concepts and_principles_of_operating_systems (2)
Fundamental concepts and_principles_of_operating_systems (2)
 
OS Lec2.pptx
OS Lec2.pptxOS Lec2.pptx
OS Lec2.pptx
 
e.pdf
e.pdfe.pdf
e.pdf
 
Operating system 2
Operating system 2Operating system 2
Operating system 2
 
L-3 BCE OS FINAL.ppt
L-3 BCE OS FINAL.pptL-3 BCE OS FINAL.ppt
L-3 BCE OS FINAL.ppt
 
Computer system software
Computer system softwareComputer system software
Computer system software
 
Operating system
Operating systemOperating system
Operating system
 
Os by nishant raghav
Os by nishant raghavOs by nishant raghav
Os by nishant raghav
 
Basic operating systems in computer and it's uses
Basic operating systems in computer and it's usesBasic operating systems in computer and it's uses
Basic operating systems in computer and it's uses
 
R20CSE2202-OPERATING-SYSTEMS .pdf
R20CSE2202-OPERATING-SYSTEMS        .pdfR20CSE2202-OPERATING-SYSTEMS        .pdf
R20CSE2202-OPERATING-SYSTEMS .pdf
 
chapter 3 opreating system lecture note and its is impaortamt concept for mn
chapter 3 opreating system  lecture note and its is impaortamt concept for mnchapter 3 opreating system  lecture note and its is impaortamt concept for mn
chapter 3 opreating system lecture note and its is impaortamt concept for mn
 
Ch3
Ch3Ch3
Ch3
 
OS.pptx
OS.pptxOS.pptx
OS.pptx
 
Part 6 Computer Oprating System
Part 6 Computer Oprating SystemPart 6 Computer Oprating System
Part 6 Computer Oprating System
 
Unit 1 q&a
Unit  1 q&aUnit  1 q&a
Unit 1 q&a
 

More from DrPrabakaranPerumal (10)

AdvancedJava.pptx
AdvancedJava.pptxAdvancedJava.pptx
AdvancedJava.pptx
 
Java.pptx
Java.pptxJava.pptx
Java.pptx
 
IoT.pptx
IoT.pptxIoT.pptx
IoT.pptx
 
EthicalHacking.pptx
EthicalHacking.pptxEthicalHacking.pptx
EthicalHacking.pptx
 
SoftwareEngineering.pptx
SoftwareEngineering.pptxSoftwareEngineering.pptx
SoftwareEngineering.pptx
 
SoftwareTesting.pptx
SoftwareTesting.pptxSoftwareTesting.pptx
SoftwareTesting.pptx
 
Html-Prabakaran
Html-PrabakaranHtml-Prabakaran
Html-Prabakaran
 
Programming in C
Programming in CProgramming in C
Programming in C
 
Programming-in-C
Programming-in-CProgramming-in-C
Programming-in-C
 
JavaAdvUnit-1.pptx
JavaAdvUnit-1.pptxJavaAdvUnit-1.pptx
JavaAdvUnit-1.pptx
 

Recently uploaded

678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
CarlosHernanMontoyab2
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 

Recently uploaded (20)

NLC-2024-Orientation-for-RO-SDO (1).pptx
NLC-2024-Orientation-for-RO-SDO (1).pptxNLC-2024-Orientation-for-RO-SDO (1).pptx
NLC-2024-Orientation-for-RO-SDO (1).pptx
 
Matatag-Curriculum and the 21st Century Skills Presentation.pptx
Matatag-Curriculum and the 21st Century Skills Presentation.pptxMatatag-Curriculum and the 21st Century Skills Presentation.pptx
Matatag-Curriculum and the 21st Century Skills Presentation.pptx
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
Jose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptx
Jose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptxJose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptx
Jose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptx
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
B.ed spl. HI pdusu exam paper-2023-24.pdf
B.ed spl. HI pdusu exam paper-2023-24.pdfB.ed spl. HI pdusu exam paper-2023-24.pdf
B.ed spl. HI pdusu exam paper-2023-24.pdf
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
Salient features of Environment protection Act 1986.pptx
Salient features of Environment protection Act 1986.pptxSalient features of Environment protection Act 1986.pptx
Salient features of Environment protection Act 1986.pptx
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdfINU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
 
Basic Civil Engineering Notes of Chapter-6, Topic- Ecosystem, Biodiversity G...
Basic Civil Engineering Notes of Chapter-6,  Topic- Ecosystem, Biodiversity G...Basic Civil Engineering Notes of Chapter-6,  Topic- Ecosystem, Biodiversity G...
Basic Civil Engineering Notes of Chapter-6, Topic- Ecosystem, Biodiversity G...
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 

OpeatingSystemPPT

  • 1. OPERATING SYSTEMS Prepared by Dr P PRABAKARAN Department of Computer Applications-PG School of Computing Sciences Vels Institute of Science Technology and Advanced Studies Chennai
  • 2. INTRODUCTION TO OPERATING SYSTEMS DEFINITION OF OPERATING SYSTEM: Operating System (OS) is a software that acts as an interface between computer hardware components and the user.
  • 3. INTRODUCTION TO OPERATING SYSTEMS ROLE OF AN OPERATING SYSTEM 1. Memory Management 2. Processor Management 3. Device Management 4. File Management 5. Security 6. Control over system performance 7. Job accounting 8. Error detecting aids 9. Coordination between other software and users
  • 4. INTRODUCTION TO OPERATING SYSTEMS Memory Management Memory management refers to management of Primary Memory or Main Memory. Main memory is a large array of words or bytes where each word or byte has its own address. Main memory provides a fast storage that can be accessed directly by the CPU. For a program to be executed, it must in the main memory.
  • 5. INTRODUCTION TO OPERATING SYSTEMS Processor Management In multiprogramming environment, the OS decides which process gets the processor when and for how much time. This function is called process scheduling. Device Management An Operating System manages device communication via their respective drivers. It does the following activities for device management − Keeps tracks of all devices. Program responsible for this task is known as the I/O controller.
  • 6. INTRODUCTION TO OPERATING SYSTEMS File Management A file system is normally organized into directories for easy navigation and usage. These directories may contain files and other directions.
  • 7. INTRODUCTION TO OPERATING SYSTEMS Security By means of password and similar other techniques, it prevents unauthorized access to programs and data. Control over system performance Recording delays between request for a service and response from the system. Job accounting Keeping track of time and resources used by various jobs and users.
  • 8. INTRODUCTION TO OPERATING SYSTEMS Error detecting aids Production of dumps, traces, error messages, and other debugging and error detecting aids. Coordination between other softwares and users Coordination and assignment of compilers, interpreters, assemblers and other software to the various users of the computer systems.
  • 9. INTRODUCTION TO OPERATING SYSTEMS TYPES OF OPERATING SYSTEM The Operating System is responsible for managing various resources of the system. 1. Batch Operating System 2. Time-Sharing Operating System 3. Distributed Operating System 4. Embedded Operating System 5. Real-time Operating System
  • 10. INTRODUCTION TO OPERATING SYSTEMS Batch Operating System In a Batch Operating System, the similar jobs are grouped together into batches with the help of some operator and these batches are executed one by one. Time-Sharing Operating System In a Multi-tasking Operating System, more than one processes are being executed at a particular time with the help of the time-sharing concept. So, in the time-sharing environment, we decide a time that is called time quantum and when the process starts its execution then the execution continues for only that amount of time and after that, other processes will be given chance for that amount of time only.
  • 11. INTRODUCTION TO OPERATING SYSTEMS Distributed Operating System In a Distributed Operating System, we have various systems and all these systems have their own CPU, main memory, secondary memory, and resources. These systems are connected to each other using a shared communication network. Here, each system can perform its task individually. Embedded Operating System An Embedded Operating System is designed to perform a specific task for a particular device which is not a computer.
  • 12. INTRODUCTION TO OPERATING SYSTEMS Real-time Operating System The Real-time Operating Systems are used in the situation where we are dealing with some real-time data. So, as soon as the data comes, the execution of the process should be done and there should be no dealy i.e. no buffer delays should be there.
  • 13. INTRODUCTION TO OPERATING SYSTEMS MAJOR OS COMPONENTS An operating system is a large and complex system that can only be created by partitioning into small pieces. These pieces should be a well-defined portion of the system, which carefully defined inputs, outputs, and functions.
  • 14. INTRODUCTION TO OPERATING SYSTEMS Components: 1. File Management 2. Process Management 3. I/O Device Management 4. Network Management 5. Main Memory management 6. Secondary-Storage Management 7. Security Management 8. Other Important Activities
  • 16. INTRODUCTION TO OPERATING SYSTEMS File Management A file is a set of related information which is should define by its creator. It commonly represents programs, both source and object forms, and data. Data files can be numeric, alphabetic, or alphanumeric. Process Management The process management component is a procedure for managing the many processes that are running simultaneously on the operating system. Every software application program has one or more processes associated with them when they are running.
  • 17. INTRODUCTION TO OPERATING SYSTEMS I/O Device Management One of the important use of an operating system that helps you to hide the variations of specific hardware devices from the user. Network Management Network management is the process of administering and managing computer networks. It includes performance management, fault analysis, provisioning of networks, and maintaining the quality of service.
  • 18. INTRODUCTION TO OPERATING SYSTEMS Main Memory management Main Memory is a large array of storage or bytes, which has an address. The memory management process is conducted by using a sequence of reads or writes of specific memory addresses.
  • 19. INTRODUCTION TO OPERATING SYSTEMS OPERATING SYSTEM OPERATIONS An operating system is a construct that allows the user application programs to interact with the system hardware. The major operations of the operating system are process management, memory management, device management and file management.
  • 20. INTRODUCTION TO OPERATING SYSTEMS OPERATING SYSTEM OPERATIONS
  • 21. INTRODUCTION TO OPERATING SYSTEMS OPERATING SYSTEM OPERATIONS Process Management The operating system is responsible for managing the processes i.e assigning the processor to a process at a time. This is known as process scheduling. The different algorithms used for process scheduling are FCFS (first come first served), SJF (shortest job first), priority scheduling, round robin scheduling etc.
  • 22. INTRODUCTION TO OPERATING SYSTEMS OPERATING SYSTEM OPERATIONS Memory Management It deals with memory and the moving of processes from disk to primary memory for execution and back again.
  • 23. INTRODUCTION TO OPERATING SYSTEMS OPERATING SYSTEM OPERATIONS Device Management There are many I/O devices handled by the operating system such as mouse, keyboard, disk drive etc. There are different device drivers that can be connected to the operating system to handle a specific device. The device controller is an interface between the device and the device driver.
  • 24. INTRODUCTION TO OPERATING SYSTEMS OPERATING SYSTEM OPERATIONS File Management Files are used to provide a uniform view of data storage by the operating system. All the files are mapped onto physical devices that are usually non volatile so data is safe in the case of system failure. Sequential Access Direct Access
  • 25. INTRODUCTION TO OPERATING SYSTEMS OPERATING SYSTEM SERVICES An Operating System supplies different kinds of services to both the users and to the programs as well. It also provides application programs (that run within an Operating system) an environment to execute it freely. It provides users the services run various programs in a convenient manner.
  • 26. INTRODUCTION TO OPERATING SYSTEMS OPERATING SYSTEM SERVICES An Operating System supplies different kinds of services to both the users and to the programs as well. It also provides application programs (that run within an Operating system) an environment to execute it freely. It provides users the services run various programs in a convenient manner.
  • 27. INTRODUCTION TO OPERATING SYSTEMS OPERATING SYSTEM SERVICES common services offered by an almost all operating systems: User Interface Program Execution File system manipulation Input / Output Operations Communication Resource Allocation Error Detection Accounting Security and protection
  • 28. INTRODUCTION TO OPERATING SYSTEMS OPERATING SYSTEM SERVICES User Interface Usually Operating system comes in three forms or types. Depending on the interface their types have been further subdivided. These are:  Command line interface  Batch based interface  Graphical User Interface
  • 29. INTRODUCTION TO OPERATING SYSTEMS OPERATING SYSTEM SERVICES Program Execution The operating system must have the capability to load a program into memory and execute that program. Furthermore, the program must be able to end its execution, either normally or abnormally / forcefully.
  • 30. INTRODUCTION TO OPERATING SYSTEMS OPERATING SYSTEM SERVICES File System Manipulation Programs need has to be read and then write them as files and directories. File handling portion of operating system also allows users to create and delete files by specific name along with extension, search for a given file and / or list file information. Some programs comprise of permissions management for allowing or denying access to files or directories based on file ownership.
  • 31. INTRODUCTION TO OPERATING SYSTEMS OPERATING SYSTEM SERVICES Input/Output Operations A program which is currently executing may require I/O, which may involve file or other I/O device. For efficiency and protection, users cannot directly govern the I/O devices. So, the OS provide a means to do I/O Input / Output operation which means read or write operation with any file.
  • 32. INTRODUCTION TO OPERATING SYSTEMS SYSTEM CALLS A system call is a method of interacting with the operating system via programs. A system call is a request from computer software to an operating system's kernel. A system call is a way for a user program to interface with the operating system.
  • 33. INTRODUCTION TO OPERATING SYSTEMS Types of System Calls 1. Process Control 2. File Management 3. Device Management 4. Information Maintenance 5. Communication
  • 34. INTRODUCTION TO OPERATING SYSTEMS Process Control Process control is the system call that is used to direct the processes. Some process control examples include creating, load, abort, end, execute, process, terminate the process, etc. File Management File management is a system call that is used to handle the files. Some file management examples include creating files, delete files, open, close, read, write, etc.
  • 35. INTRODUCTION TO OPERATING SYSTEMS Device Management Device management is a system call that is used to deal with devices. Some examples of device management include read, device, write, get device attributes, release device, etc. Information Maintenance Information maintenance is a system call that is used to maintain information. There are some examples of information maintenance, including getting system data, set time or date, get time or date, set system data, etc.
  • 36. INTRODUCTION TO OPERATING SYSTEMS Communication Communication is a system call that is used for communication. There are some examples of communication, including create, delete communication connections, send, receive messages, etc.
  • 37. INTRODUCTION TO OPERATING SYSTEMS SYSTEM PROGRAMS System programs provide an environment where programs can be developed and executed. In the simplest sense, system programs also provide a bridge between the user interface and system calls.
  • 38. INTRODUCTION TO OPERATING SYSTEMS Types of System Programs Status Information Communications File Manipulation Program Loading and Execution File Modification Application Programs
  • 39. INTRODUCTION TO OPERATING SYSTEMS OPERATING SYSTEM STRUCTURE  Simple Structure  Monolithic Approach  Layered Approach  Microkernels
  • 40. INTRODUCTION TO OPERATING SYSTEMS OPERATING SYSTEM STRUCTURE Simple Structure Operating systems such as MS-DOS and the original UNIX did not have well- defined structures. There was no CPU Execution Mode (user and kernel), and so errors in applications could cause the whole system to crash.
  • 41. INTRODUCTION TO OPERATING SYSTEMS OPERATING SYSTEM STRUCTURE Simple Structure
  • 42. INTRODUCTION TO OPERATING SYSTEMS OPERATING SYSTEM STRUCTURE Monolithic Approach Functionality of the OS is invoked with simple function calls within the kernel, which is one large program. Device drivers are loaded into the running kernel and become part of the kernel.
  • 43. INTRODUCTION TO OPERATING SYSTEMS OPERATING SYSTEM STRUCTURE Monolithic Approach
  • 44. INTRODUCTION TO OPERATING SYSTEMS OPERATING SYSTEM STRUCTURE Layered Approach This approach breaks up the operating system into different layers. This allows implementers to change the inner workings, and increases modularity. As long as the external interface of the routines don’t change, developers have more freedom to change the inner workings of the routines.
  • 45. INTRODUCTION TO OPERATING SYSTEMS OPERATING SYSTEM STRUCTURE Layered Approach
  • 46. INTRODUCTION TO OPERATING SYSTEMS OPERATING SYSTEM STRUCTURE Microkernels This structures the operating system by removing all nonessential portions of the kernel and implementing them as system and user level programs. Generally they provide minimal process and memory management, and a communications facility. Communication between components of the OS is provided by message passing.
  • 47. INTRODUCTION TO OPERATING SYSTEMS OPERATING SYSTEM STRUCTURE Microkernels
  • 48. INTRODUCTION TO OPERATING SYSTEMS PROCESS A process is a program at the time of execution. The process is more than the program code. It includes the program counter, the process stack, and the content of the process register, etc.
  • 49. INTRODUCTION TO OPERATING SYSTEMS PROCESS Process States in OS 1. New: The process is being created. 2. Running: The process is being executed. 3. Waiting: The process is waiting for some event to occur. 4. Ready: The process is waiting to be assigned to a processor. 5. Terminate: The process has finished execution.
  • 50. INTRODUCTION TO OPERATING SYSTEMS PROCESS SCHEDULING The process scheduling is the activity of the process manager that handles the removal of the running process from the CPU. Process scheduling is an essential part of a Multiprogramming operating systems. Such operating systems allow more than one process to be loaded into the executable memory at a time.
  • 51. INTRODUCTION TO OPERATING SYSTEMS OPERATIONS ON PROCESSES There are many operations that can be performed on processes. Some of these are process creation, process preemption, process blocking, and process termination.
  • 52. INTRODUCTION TO OPERATING SYSTEMS OPERATIONS ON PROCESSES Process Creation Processes need to be created in the system for different operations. This can be done by the following events.  User request for process creation  System initialization  Execution of a process creation system call by a running process  Batch job initialization
  • 53. INTRODUCTION TO OPERATING SYSTEMS OPERATIONS ON PROCESSES Process Creation
  • 54. INTRODUCTION TO OPERATING SYSTEMS OPERATIONS ON PROCESSES Process Preemption An interrupt mechanism is used in preemption that suspends the process executing currently and the next process to execute is determined by the short-term scheduler. Preemption makes sure that all processes get some CPU time for execution.
  • 55. INTRODUCTION TO OPERATING SYSTEMS OPERATIONS ON PROCESSES Process Blocking The process is blocked if it is waiting for some event to occur. This event may be I/O as the I/O events are executed in the main memory and don't require the processor. After the event is complete, the process again goes to the ready state.
  • 56. INTRODUCTION TO OPERATING SYSTEMS OPERATIONS ON PROCESSES Process Termination After the process has completed the execution of its last instruction, it is terminated. The resources held by a process are released after it is terminated.
  • 57. INTRODUCTION TO OPERATING SYSTEMS INTER PROCESS COMMUNICATION Interprocess communication is the mechanism provided by the operating system that allows processes to communicate with each other. This communication could involve a process letting another process know that some event has occurred or the transferring of data from one process to another.
  • 58. INTRODUCTION TO OPERATING SYSTEMS Approaches for Inter-Process Communication
  • 59. THREADS A thread is a single sequential flow of execution of tasks of a process so it is also known as thread of execution or thread of control. There is a way of thread execution inside the process of any operating system. Types of Threads Kernel level thread. User-level thread.
  • 60. THREADS Benefits of Threads  Enhanced throughput of the system  Effective Utilization of Multiprocessor system  Faster context switch  Responsiveness  Communication  Resource sharing
  • 61. MULTITHREADING MODELS Multithreading allows the application to divide its task into individual threads. In multi-threads, the same process or task can be done by the number of threads, or we can say that there is more than one thread to perform the task in multithreading. With the use of multithreading, multitasking can be achieved.
  • 62. MULTITHREADING MODELS Types of Multithreading models  Many to one multithreading model  One to one multithreading model  Many to Many multithreading models
  • 63. THREAD LIBRARIES Types of Multithreading models Thread Libraries has a collection of functions that useful in creating and controlling threads. Programmers can access these thread libraries using an application programming interface (API). Thread libraries can be the user level library or kernel level library.
  • 64. THREADING ISSUES  The fork() and exec() system call  Signal handling  Thread cancelation  Thread local storage  Scheduler activation
  • 65. BASIC CONCEPTS OF SCHEDULING The process scheduling is the activity of the process manager that handles the removal of the running process from the CPU and the selection of another process on the basis of a particular strategy. Process scheduling is an essential part of a Multiprogramming operating systems. Such operating systems allow more than one process to be loaded into the executable memory at a time and the loaded process shares the CPU using time multiplexing.
  • 66. SCHEDULING CRITERIA CPU utilization - Ideally the CPU would be busy 100% of the time, so as to waste 0 CPU cycles. On a real system CPU usage should range from 40% ( lightly loaded ) to 90% ( heavily loaded. ) Throughput - Number of processes completed per unit time. May range from 10 / second to 1 / hour depending on the specific processes. Turnaround time - Time required for a particular process to complete, from submission time to completion. ( Wall clock time. )
  • 67. SCHEDULING CRITERIA Waiting time - How much time processes spend in the ready queue waiting their turn to get on the CPU. Load average - The average number of processes sitting in the ready queue waiting their turn to get into the CPU. Reported in 1- minute, 5-minute, and 15-minute averages by "uptime" and "who". ) Response time - The time taken in an interactive program from the issuance of a command to the commence of a response to that command.
  • 68. SCHEDULING ALGORITHMS To decide which process to execute first and which process to execute last to achieve maximum CPU utilization, computer scientists have defined some algorithms, they are:  First Come First Serve (FCFS)  Shortest-Job-First (SJF) Scheduling  Shortest Remaining Time  Priority Scheduling  Round Robin Scheduling  Multilevel Queue Scheduling
  • 70. SCHEDULING ALGORITHMS First Come First Serve (FCFS) First Come First Serve is the full form of FCFS. It is the easiest and most simple CPU scheduling algorithm. In this type of algorithm, the process which requests the CPU gets the CPU allocation first. This scheduling method can be managed with a FIFO queue.
  • 71. SCHEDULING ALGORITHMS Shortest Remaining Time The full form of SRT is Shortest remaining time. It is also known as SJF preemptive scheduling. In this method, the process will be allocated to the task, which is closest to its completion. This method prevents a newer ready state process from holding the completion of an older process.
  • 72. SCHEDULING ALGORITHMS Priority Based Scheduling Priority scheduling is a method of scheduling processes based on priority. In this method, the scheduler selects the tasks to work as per the priority. Priority scheduling also helps OS to involve priority assignments. The processes with higher priority should be carried out first, whereas jobs with equal priorities are carried out on a round-robin or FCFS basis. Priority can be decided based on memory requirements, time requirements, etc.
  • 73. SCHEDULING ALGORITHMS Round-Robin Scheduling Round robin is the oldest, simplest scheduling algorithm. The name of this algorithm comes from the round-robin principle, where each person gets an equal share of something in turn. It is mostly used for scheduling algorithms in multitasking. This algorithm method helps for starvation free execution of processes.
  • 74. SCHEDULING ALGORITHMS Shortest Job First SJF is a full form of (Shortest job first) is a scheduling algorithm in which the process with the shortest execution time should be selected for execution next. This scheduling method can be preemptive or non-preemptive. It significantly reduces the average waiting time for other processes awaiting execution.
  • 75. SCHEDULING ALGORITHMS Multiple-Level Queues Scheduling This algorithm separates the ready queue into various separate queues. In this method, processes are assigned to a queue based on a specific property of the process, like the process priority, size of the memory, etc. However, this is not an independent scheduling OS algorithm as it needs to use other types of algorithms in order to schedule the jobs.
  • 76. MULTIPLE PROCESSORS SCHEDULING Multiprocessor scheduling focuses on designing the system's scheduling function, which consists of more than one processor. Multiple CPUs share the load (load sharing) in multiprocessor scheduling so that various processes run simultaneously. In general, multiprocessor scheduling is complex as compared to single processor scheduling.
  • 77. REAL-TIME CPU SCHEDULING Real-time systems are systems that carry real-time tasks. These tasks need to be performed immediately with a certain degree of urgency. In particular, these tasks are related to control of certain events (or) reacting to them. Real-time tasks can be classified as hard real-time tasks and soft real-time tasks.
  • 78. REAL-TIME CPU SCHEDULING In real-time systems, the scheduler is considered as the most important component which is typically a short-term task scheduler. The main focus of this scheduler is to reduce the response time associated with each of the associated processes instead of handling the deadline.
  • 79. Unit-III – Operating Systems BACKGROUND IN PROCESS SYNCHRONIZATION Types: Independent Process : Execution of one process does not affects the execution of other processes. Cooperative Process : Execution of one process affects the execution of other processes.
  • 80. Unit-III – Operating Systems CRITICAL SECTION PROBLEM
  • 81. Unit-III – Operating Systems CRITICAL SECTION PROBLEM Requirements 1. Mutual Exclusion - If a process is executing in its critical section, then no other process is allowed to execute in the critical section. 2. Progress - If no process is executing in the critical section and other processes are waiting outside the critical section. 3. Bounded Waiting - A bound must exist on the number of times that other processes are allowed to enter their critical sections after a process has made a request to enter its critical section and before that request is granted.
  • 82. Unit-III – Operating Systems SYNCHRONIZATION HARDWARE There are three hardware approaches to solve process synchronization problems: 1. Swap - In this algorithm, instead of directly setting the lock to true, the key is first set to true and then swapped with the lock. 2. Test() and Set() - In Test and Set the shared variable is a lock that is initialized to false. 3. Unlock and lock - This algorithm uses waiting[i] to check if there are any processes in the wait.
  • 83. Unit-III – Operating Systems MUTEX LOCKS The mutex locking mechanism ensures only one thread can acquire the mutex and enter the critical section. This thread only releases the mutex when it exits in the critical section.
  • 84. Unit-III – Operating Systems SEMAPHORE A semaphore is a signaling mechanism, and another thread can signal a thread that is waiting on a semaphore.
  • 85. Unit-III – Operating Systems SEMAPHORE USAGES Semaphore can be associated with these four buffers, allowing users and producers to work on different buffers simultaneously. Advantages of Semaphore It allows more than one thread to access the critical section. Semaphores are machine-independent. Semaphores are implemented in the machine-independent code of the microkernel.
  • 86. Unit-III – Operating Systems MONITORS The monitor is supported by programming languages to achieve mutual exclusion between processes. Advantages of Monitor: Monitors have the advantage of making parallel programming easier and less error prone than using techniques such as semaphore.
  • 87. Unit-III – Operating Systems DINING PHILOSOPHERS SOLUTIONS USING MONITORS Dining-Philosophers Problem – N philosophers seated around a circular table Attention reader! Don’t stop learning now. Practice GATE exam well before the actual exam with the subject-wise and overall quizzes available in GATE Test Series Course.
  • 88. Unit-III – Operating Systems IMPLEMENTATION OF MONITOR USING SEMAPHORES We now consider a possible implementation of the monitor mechanism using semaphores. For each monitor, a semaphore mutex (initialized to 1) is provided. A process must execute wait(mutex) before entering the monitor and must execute signal(mutex) after leaving the monitor.
  • 89. Unit-IV MEMORY MANAGEMENT BACKGROUND 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.
  • 90. Unit-IV SWAPPING When a process is executed it must have resided in memory. Swapping is a process of swap a process temporarily into a secondary memory from the main memory, which is fast as compared to secondary memory.
  • 91. Unit-IV CONTIGUOUS MEMORY ALLOCATION The main memory should oblige both the operating system and the different client processes. Therefore, the allocation of memory becomes an important task in the operating system. The memory is usually divided into two partitions: Resident operating system and User processes.
  • 92. Unit-IV PAGING Paging is a method or techniques which is used for non-contiguous memory allocation. It is a fixed size partitioning theme (scheme). In paging, both main memory and secondary memory are divided into equal fixed size partitions.
  • 93. Unit-IV PAGING Paging is a method or techniques which is used for non-contiguous memory allocation. It is a fixed size partitioning theme (scheme). In paging, both main memory and secondary memory are divided into equal fixed size partitions.
  • 94. Unit-IV SEGMENTATION The partitions of secondary memory area unit known as as segments. The details concerning every segment are hold in a table known as as segmentation table. Segment table contains two main data concerning segment, one is Base, which is the bottom address of the segment and another is Limit, which is the length of the segment.
  • 95. Unit-IV VIRTUAL MEMORY Virtual Memory is a storage allocation scheme in which secondary memory can be addressed as though it were part of main memory. The addresses a program may use to reference memory are distinguished from the addresses the memory system uses to identify physical storage sites, and program generated addresses are translated automatically to the corresponding machine addresses.
  • 96. Unit-IV DEMAND PAGING The process of loading the page into memory on demand is known as demand paging. The process includes the following steps: 1. If CPU try to refer a page that is currently not available in the main memory, it generates an interrupt indicating memory access fault. 2. The OS puts the interrupted process in a blocking state. For the execution to proceed the OS must bring the required page into the memory. 3. The OS will search for the required page in the logical address space. 4. The required page will be brought from logical address space to physical address space. The page replacement algorithms are used for the decision making of replacing the page in physical address space. 5. The page table will updated accordingly. 6. The signal will be sent to the CPU to continue the program execution and it will place the process back into ready state.
  • 98. Unit-IV COPY ON WRITE Copy on Write or simply COW is a resource management technique. One of its main use is in the implementation of the fork system call in which it shares the virtual memory(pages) of the OS. In UNIX like OS, fork() system call creates a duplicate process of the parent process which is called as the child process.
  • 100. Unit-IV PAGE REPLACEMENT Page replacement algorithms are the techniques using which an Operating System decides which memory pages to swap out, write to disk when a page of memory needs to be allocated. Paging happens whenever a page fault occurs and a free page cannot be used for allocation purpose accounting to reason that pages are not available or the number of free pages is lower than required pages. There are many different page replacement algorithms. We evaluate an algorithm by running it on a particular string of memory reference and computing the number of page faults.
  • 101. Unit-IV PAGE REPLACEMENT ALGORITHM 1. First In First Out (FIFO) algorithm 2. Optimal Page algorithm 3. Least Recently Used (LRU) algorithm
  • 102. Unit-IV First In First Out (FIFO) algorithm Oldest page in main memory is the one which will be selected for replacement. Easy to implement, keep a list, replace pages from the tail and add new pages at the head.
  • 103. Unit-IV Optimal Page algorithm An optimal page-replacement algorithm has the lowest page-fault rate of all algorithms. An optimal page-replacement algorithm exists, and has been called OPT or MIN. Replace the page that will not be used for the longest period of time. Use the time when a page is to be used.
  • 104. Unit-IV Least Recently Used (LRU) algorithm Page which has not been used for the longest time in main memory is the one which will be selected for replacement. Easy to implement, keep a list, replace pages by looking back into time.
  • 105. Unit-IV ALLOCATION OF FRAMES The absolute minimum number of frames that a process must be allocated is dependent on system architecture, and corresponds to the worst-case scenario of the number of pages that could be touched by a single ( machine ) instruction. If an instruction (and its operands) spans a page boundary, then multiple pages could be needed just for the instruction fetch. Memory references in an instruction touch more pages, and if those memory locations can span page boundaries, then multiple pages could be needed for operand access also.
  • 106. Unit-IV THRASHING Thrashing in computing is an issue caused when virtual memory is in use. It occurs when the virtual memory of a computer is rapidly exchanging data for data on hard disk, to the exclusion of most application-level processing. As the main memory gets filled, additional pages need to be swapped in and out of virtual memory. The swapping causes a very high rate of hard disk access. Thrashing can continue for a long duration until the underlying issue is addressed. Thrashing can potentially result in total collapse of the hard drive of the computer.
  • 107. Unit - V I/O HARDWARE One of the important jobs of an Operating System is to manage various I/O devices including mouse, keyboards, touch pad, disk drives, display adapters, USB devices, Bit-mapped screen, LED, Analog-to-digital converter, On/off switch, network connections, audio I/O, printers etc. Categories Block devices − A block device is one with which the driver communicates by sending entire blocks of data. For example, Hard disks, USB cameras, Disk-On-Key etc. Character devices − A character device is one with which the driver communicates by sending and receiving single characters (bytes, octets). For example, serial ports, parallel ports, sounds cards etc
  • 108. Unit - V Device Controllers Device drivers are software modules that can be plugged into an OS to handle a particular device. Operating System takes help from device drivers to handle all I/O devices.
  • 109. Unit - V APPLICATION I/O INTERFACE I/O Interface There is need of surface whenever any CPU wants to communicate with I/O devices. The interface is used to interpret address which is generated by CPU. Thus, surface is used to communicate to I/O devices i.e. to share information between CPU and I/O devices interface is used which is called as I/O Interface.
  • 110. Unit - V Various applications of I/O Interface Application of I/O is that we can say interface have access to open any file without any kind of information about file. It also has feature that it can be used to also add new devices to computer system even it does not cause any kind of interrupt to operating system. The access to each of general kind is through standardized set of function which is called as interface.
  • 111. Unit - V KERNEL I/O SUBSYSTEM Kernel I/O Subsystem is responsible to provide many services related to I/O. Following are some of the services provided. 1. Scheduling 2. Buffering 3. Caching 4. Spooling and Device Reservation 5. Error Handling
  • 112. Unit - V COMMUNICATION WITH I/O DEVICES The data transfers between the CPU and I/O devices may handle in a variety of techniques. Some techniques use the CPU as an intermediate path, others transfer the data directly to and from the memory unit. The data transfers to and from peripherals that are saying Input-Output communication. Types of Input-Output communication techniques Programmed I/O Interrupt-initiated I/O Direct Memory Access (DMA)
  • 113. Unit - V Programmed I/O In the programmed I/O method, the I/O device doesn’t have direct memory access. The data transfer from an I/O device to memory requires the execution of a program or several instructions by CPU So that this method says Programmed I/O. Interrupt-initiated I/O The problem in programmed I/O is that the CPU has to wait for the ready signal from the I/O device. The alternative method for this problem is Interrupt-initiated I/O or Interrupt driven I/O.
  • 114. Unit - V Direct Access Memory (DMA) Direct Memory Access (DMA) is a process where the data transforms between the microprocessor (CPU). The memory and peripheral devices directly without the involvement of the microprocessor (CPU).
  • 115. Unit - V STREAMS A full-duplex communication channel between a user-level process and a device in Unix System V and beyond. A STREAM consists of STREAM head interfaces Driver end interfaces with the device Zero or more STREAM modules between them.