Operating Systems
BCSC0004
Operating Systems
BCSC0004
Introduction to Operating Systems
By
Munmi Gogoi
Assistant Professor
GLA University, Mathura
Course Overview/
Syllabus
Module Content Teaching
Hours
Introduction: Operating System and its Classification - Batch, Interactive, Multiprogramming, Time sharing, Real Time
System, Multiprocessor Systems, Multithreaded Systems, System Protection, System Calls, Reentrant Kernels, Operating
System Structure- Layered structure, Monolithic and Microkernel Systems, Operating System Components, Operating System
Functions and Services.
Processes: Process Concept, Process States, Process State Transition Diagram, Process Control Block (PCB), Process
I Scheduling Concepts, Threads and their management. 20
CPU Scheduling: Scheduling Concepts, Performance Criteria, Scheduling Algorithms, Multiprocessor Scheduling.
Process Synchronization: Principle of Concurrency, Implementation of concurrency through fork/join and parbegin/parend,
Inter Process Communication models and Schemes, Producer / Consumer Problem, Critical Section Problem, Dekker’s
solution, Peterson’s solution, Semaphores, Synchronization Hardware.
Classical Problem in Concurrency: Dining Philosopher Problem, Readers Writers Problem.
Deadlock: System model, Deadlock characterization, Prevention, Avoidance and detection, Recovery from deadlock, Combined
Approach.
II Memory Management: Multiprogramming with fixed partitions, Multiprogramming with variable partitions, Paging,
20
Segmentation, Paged segmentation.
Virtual memory concepts: Demand paging, Performance of demand paging, Page replacement algorithms, Thrashing, Locality
of reference.
I/O Management and Disk Scheduling: I/O devices, I/O subsystems, I/O buffering, Disk storage and disk scheduling.
File System: File concept, File organization and access mechanism, File directories, File allocation methods, Free space
management.
Key Terms
•Name of 5 Operating System
•Microsoft Windows,
•Apple macOS,
•Linux,
•Android and
• Apple's iOS.
Key Terms
•Booting
•On modern general purpose computers, this can take tens of seconds and typically involves
performing a power-on self-test, locating and initializing peripheral devices, and then
finding, loading and starting the operating system.
•Memory Hierarchy
•Cache Memory
•It holds frequently requested data and instructions so that they are immediately available to
the CPU when needed.
Key Terms
•Memory measurement units
What is an Operating System?
•A program that acts as an intermediary between a
user of a computer and the computer hardware
• Resource Manager
– Give resources to applications
– Take resources from applications
– Protection and Security
• Great Pretender
– Make finite resources appear as infinite resources
What is an Operating System?
• Computer System = Hardware + Software
• Software = Application Software + System Software(OS)
• An Operating System is a system Software that acts as an
intermediary/interface between a user of a computer and the computer
hardware.
• Operating system goals:
Execute user programs and make solving user problems easier
Make the computer system convenient to use
Use the computer hardware in an efficient manner
Operating System Mode
The User Mode is concerned with the actual
interface between the user and the system.
It controls things like running applications
and accessing files.
The Kernel Mode is concerned with everything
running in the background.
It controls things like accessing system
resources, controlling hardware functions and
processing program instructions.
System calls are used to change
mode from User to Kernel.
Kernel
Kernel is a software code that reside in central core of OS. It has complete
control over system.
When operation system boots, kernel is first part of OS to load in main
memory.
Kernel remains in main memory for entire duration of computer session. The
kernel code is usually loaded in to protected area of memory.
Kernel performs it’s task like executing processes and handling interrupts in
kernel space.
User performs it’s task in user area of memory.
This memory separation is made in order to prevent user data and kernel
data from interfering with each other.
Kernel does not interact directly with user, but it interacts using SHELL and
other programs and hardware.
Kernel cont…
Kernel includes:-
1. Scheduler: It allocates the Kernel’s processing time to various
processes.
2. Supervisor: It grants permission to use computer system resources
to each process.
3. Interrupt handler : It handles all requests from the various hardware
devices which compete for kernel services.
4. Memory manager : allocates space in memory for all users of kernel
service.
kernel provides services for process management, file management, I/O
management, memory management.
System calls are used to provide these type of services.
System Call
System call is the programmatic way in which a computer program/user
application requests a service from the kernel of the operating system on which
it is executed.
Application program is just a user-process. Due to security reasons , user
applications are not given access to privileged resources(the ones controlled by
OS).
When they need to do any I/O or have some more memory or spawn a
process or wait for signal/interrupt, it requests operating system to facilitate
all these. This request is made through System Call.
System calls are also called software-interrupts.
Uses for Operating System in
Computer Science
An operating system is the most important software
that runs on a computer.
It manages the computer's memory and processes, as
well as all of its software and hardware.
It also allows you to communicate with the computer
without knowing how to speak the computer's language.
Structure of Operating System
Various structures can be used to implement an operating system.
The structure of the operating system is mostly determined by
how the many common components of the operating system are
integrated and merged into the kernel. We have the following
operating system structures based on this:
Layered structure
Micro-kernel
Monolithic System Architecture
Structure of Operating System
Layered structure
The OS in this arrangement is divided into several
layers (levels). Hardware is found at the bottom layer
(layer 0), and the user interface is found at topmost
layer (layer N).
Each of these levels only utilises the features of the
lower level layers due to the way they are constructed.
This simplifies the debugging process because the
lower level layers have already been debugged,
therefore any errors that emerge must only affect the
layer that has been debugged.
Structure of Operating System
Advantages of Layered structure:
Layered
•Layering makesstructure
it easier to enhance the operating system as
implementation of a layer can be changed easily without
affecting the other layers.
Advantages of Layered structure:
Layering makes it easier to enhance the operating system as
implementation of a layer can be changed easily without affecting the
other layers.
It is very easy to perform debugging and system verification.
Disadvantages of Layered structure:
In this structure the application performance is degraded as compared to
simple structure.
It requires careful planning for designing the layers as higher layers use
the functionalities of only the lower layers.
Disadvantages of Layered structure:
•In this structure the application performance is degraded as
Structure of Operating System
Monolithic Structure
The Monolithic operating System in which the kernel acts as
a manager by managing all things like file management,
memory management, device management, and operational
processes of the Operating System.
In monolithic systems, kernels can directly access all the
resources of the operating System like physical
hardware, such as Keyboard, Mouse etc.
The monolithic kernel functions as a virtual machine by
working on top of the Operating System and controlling all
hardware components. This is an outdated operating system
that was used in banks to accomplish minor activities such as
batch processing and time-sharing, which enables many
people at various terminals to access the Operating System.
Structure of Operating System
Contd..
Advantages of Monolithic structure:
It is simple to design and implement because all operations are managed by kernel only, and
layering is not needed.
As services such as memory management, file management, process scheduling, etc., are
implemented in the same address space, the execution of the monolithic kernel is relatively fast
as compared to normal systems. Using the same address saves time for address allocation for
new processes and makes it faster.
Structure of Operating System
Contd..
Disadvantages of Monolithic structure:
If any service in the monolithic kernel fails, the entire System fails because, in
address space, the services are connected to each other and affect each other.
It is not flexible, and to introduce a new service
Functions of Operating System
1. Process Management
A process is a program in execution.
A process needs certain resources, including CPU time, memory, files, and I/O devices to accomplish
its task.
Simultaneous execution leads to multiple processes. Hence creation, execution and termination of a
process are the most basic functionality of an OS
If processes are dependent, than they may try to share same resources. thus task of process
synchronization comes to the picture.
If processes are independent, than a due care needs to be taken to avoid their overlapping in memory
area.
Based on priority, it is important to allow more important processes to execute first than others.
2. Memory management
Memory is a large array of words or bytes, each with its own address.
It is a repository of quickly accessible data shared by the CPU and I/O devices.
Main memory is a volatile storage device. When the computer made turn off everything
stored in RAM will be erased automatically.
In addition to the physical RAM installed in your computer, most modern operating systems
allow your computer to use a virtual memory system. Virtual memory allows your computer
to use part of a permanent storage device (such as a hard disk) as extra memory.
The operating system is responsible for the following activities in connections with memory
management:
Keep track of which parts of memory are currently being used and by whom.
Decide which processes to load when memory space becomes available.
Allocate and de-allocate memory space as needed.
3. File Management
A file is a collection of related information defined by its creator.
File systems provide the conventions for the encoding, storage and management of data on a storage device such as a hard disk.
FAT12 (floppy disks)
FAT16 (DOS and older versions of Windows)
FAT32 (older versions of Windows)
NTFS (newer versions of Windows)
EXT3 (Unix/Linux)
HFS+ (Max OS X)
The operating system is responsible for the following activities in connections with file management:
✦ File creation and deletion.
✦ Directory creation and deletion.
✦ Support of primitives for manipulating files and directories.
✦ Mapping files onto secondary storage.
✦ File backup on stable (nonvolatile) storage media.
4. Device Management or I/O Management
Device controllers are components on the motherboard (or on expansion cards) that act as an interface
between the CPU and the actual device.
Device drivers, which are the operating system software components that interact with the devices controllers.
A special device (inside CPU) called the Interrupt Controller handles the task of receiving interrupt requests
and prioritizes them to be forwarded to the processor.
Deadlocks can occur when two (or more) processes have control of different I/O resources that are needed by
the other processes, and they are unwilling to give up control of the device.
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 Input/output controller.
Decides which process gets access to a certain device and for how long.
Allocates devices in an effective and efficient way.
Deallocates devices when they are no longer required.
5. Security & Protection
The operating system uses password protection to protect user data and similar other
techniques.
It also prevents unauthorized access to programs and user data by assigning access right
permission to files and directories.
The owners of information stored in a multiuser or networked computer system may want to
control use of that information, concurrent processes should not interfere with each other.
6. User Interface Mechanism
A user interface (UI) controls how you enter data and instructions and how information
is displayed on the screen
There are two types of user interfaces
1. Command Line Interface
2. Graphical user Interface
1. Command-line interface
In a command-line interface, a user types commands represented by short keywords or
abbreviations or presses special keys on the keyboard to enter data and instructions
2. Graphical User Interface
With a graphical user interface (GUI), you interact with menus and visual images
History of Operating System
The First Generation (1940's to early 1950's)
No Operating System
All programming was done in absolute machine language, often by wiring up plug-boards to control the
machine’s basic functions.
The Second Generation (1955-1965)
First operating system was introduced in the early 1950's.It was called GMOS
Created by General Motors for IBM's machine the 701.
Single-stream batch processing systems
The Third Generation (1965-1980)
Introduction of multiprogramming
Development of Minicomputer
The Fourth Generation (1980-Present Day)
Development of PCs
Birth of Windows/MaC OS
Types of Operating Systems
1. Batch Operating System
2. Multiprogramming Operating System
3. Time-Sharing OS
4. Multiprocessing OS
5. Distributed OS
6. Network OS
7. Real Time OS
8. Embedded OS
1. Batch Operating System
The users of this type of operating system does not interact with the computer directly.
Each user prepares his job on an off-line device like punch cards and submits it to the
computer operator
There is an operator which takes similar jobs having the same requirement and group them into
batches.
1. Batch Operating System cont..
Advantages of Batch Operating System:
Processors of the batch systems know how long the job would be when it is in queue
Multiple users can share the batch systems
The idle time for the batch system is very less
It is easy to manage large work repeatedly in batch systems
Disadvantages of Batch Operating System:
The computer operators should be well known with batch systems
Batch systems are hard to debug
It is sometimes costly
The other jobs will have to wait for an unknown time if any job fails
Examples of Batch based Operating System:
IBM's MVS
2. Multiprogramming Operating System:
This type of OS is used to execute more than one jobs simultaneously by a single processor.
It increases CPU utilization by organizing jobs so that the CPU always has one job to execute.
Multiprogramming operating systems use the mechanism of job scheduling and CPU scheduling.
3. Time-Sharing Operating Systems
Each task is given some time to execute so that all the tasks work smoothly.
These systems are also known as Multi-tasking Systems.
The task can be from a single user or different users also.
The time that each task gets to execute is called quantum.
After this time interval is over OS switches over to the next task.
3. Time-Sharing Operating Systems cont..
Advantages of Time-Sharing OS:
Each task gets an equal opportunity
Fewer chances of duplication of software
CPU idle time can be reduced
Disadvantages of Time-Sharing OS:
Reliability problem
One must have to take care of the security and integrity of user programs and data
Data communication problem
Examples of Time-Sharing Oss
Multics, Unix, etc.
4. Multiprocessor operating systems
Multiprocessor operating systems are also known as parallel OS or tightly
coupled OS.
Such operating systems have more than one processor in close
communication that sharing the computer bus, the clock and sometimes
memory and peripheral devices.
It executes multiple jobs at the same time and makes the processing
faster.
It supports large physical address space and larger virtual address space.
If one processor fails then other processor should retrieve the interrupted
process state so execution of process can continue.
Inter-processes communication mechanism is provided and implemented
in hardware.
5. Distributed Operating System
Various autonomous interconnected computers communicate with each other using a shared
communication network.
Independent systems possess their own memory unit and CPU.
These are referred to as loosely coupled systems.
Examples:- Locus, DYSEAC
6. Network Operating System
These systems run on a server and provide the capability to manage data, users,
groups, security, applications, and other networking functions.
These types of operating systems allow shared access of files, printers,
security, applications, and other networking functions over a small private
network.
The “ other" computers arc called client computers, and each computer that
connects to a network server must be running client software designed to
request a specific service.
popularly known as tightly coupled systems.
6. Network Operating System
Advantages of Network Operating System:
Highly stable centralized servers
Security concerns are handled through servers
New technologies and hardware up-gradation are easily integrated into the system
Server access is possible remotely from different locations and types of systems
Disadvantages of Network Operating System:
Servers are costly
User has to depend on a central location for most operations
Maintenance and updates are required regularly
Examples of Network Operating System are:
Microsoft Windows Server 2003/2008/2012, UNIX, Linux, Mac OS X, Novell NetWare, and BSD,
etc.
7. Real-Time Operating System
These types of OSs serve real-time systems.
The time interval required to process and respond to inputs is very small.
This time interval is called response time.
Real-time systems are used when there are time requirements that are very
strict like
missile systems,
air traffic control systems,
robots, etc.
8. Embaded Operating System
An embedded operating system is one that is built into the circuitry of an electronic device.
Embedded operating systems are now found in automobiles, bar-code scanners, cell phones,
medical equipment, and personal digital assistants.
The most popular embedded operating systems for consumer products, such as PDAs,
include the following:
Windows XP Embedded
Windows CE .NET:- it supports wireless communications, multimedia and Web
browsing. It also allows for the use of smaller versions of Microsoft Word, Excel, and
Outlook.
Palm OS:- It is the standard operating system for Palm-brand PDAs as well as other
proprietary handheld devices.
Symbian:- OS found in “ smart” cell phones from Nokia and Sony Ericsson
Popular types of OS
Desktop Class
Windows
OS X
Unix/Linux
Chrome OS
Server Class
Windows Server
Mac OS X Server
Unix/Linux
Mobile Class
Android
iOS
Windows Phone
Desktop Class Operating Systems:-
Platform: the hardware required to run a particular operating system
Intel platform (IBM-compatible)
Windows
DOS
UNIX
Linux
Macintosh platform
Mac OS
iPad and iPhone platform
iOS
Ms-DOS
Single User Single Tasking OS.
It had no built-in support for networking, and users had to manually install
drivers any time they added a new hardware component to their PC.
DOS supports only 16-bit programs.
Command line user interface.
So, why is DOS still in use? Two reasons are its size and simplicity. It does not
require much memory or storage space for the system, and it docs not require a
powerful computer.
Objectives of This Course
To provide basic knowledge of computer operating
system structures and functioning including CPU
scheduling, memory management, concurrent
processes, deadlocks, security, and integrity.
Outcome of this Course
Identify the services provided by operating systems.
Understand the internal structure of an operating system
and be able to write programs using system calls.
Understand and solve problems involving process control,
mutual exclusion, deadlock and synchronization.
Reference Books
Text Books:
Silberschatz, Galvin and Gagne (2012), “Operating Systems Concepts”,9th Edition, Wiley.
D M Dhamdhere (2006), “Operating Systems: A Concept Based Approach”, 3rd Edition
Reference Books
Harvey M Dietel (2002), “An Introduction to Operating System”, 2nd Edition, Pearson
Education.
M. J. Bach. (1986), “Design of the Unix Operating System”, PHI.
Examples
Assessment & Examination
Total : 100 Marks
CT Component: 80 Marks
Mid Term: 30 Marks
End Term: 50 Marks
TA Component: 20 Marks
Attendance: 05 Marks
Assignment/ Quiz: 15 Marks
Function of OS
Memory Management
Keeps tracks of primary memory, i.e., what part of it are in use by whom, what part are not
in use.
In multiprogramming, the OS decides which process will get memory when and how
much.
Allocates the memory when a process requests it to do so.
De-allocates the memory when a process no longer needs it or has been terminated.
Processor Management
Keeps tracks of processor and status of process. The program responsible for this task is
known as traffic controller.
Allocates the processor (CPU) to a process.
De-allocates processor when a process is no longer required.
Device Management
Keeps tracks of all devices. Program responsible for this task is known as the I/O
controller.
Decides which process gets the device when and for how much time.
Allocates the device in the efficient way.
De-allocates devices.
File Management
Keeps track of information, location, uses, status etc. The collective facilities are often
known as file system.
Decides who gets the resources.
Allocates the resources.
De-allocates the resources.