Welcome to OS Class
Marks Distribution
Marks Head Frequency Marks Frequency Total Marks
Quiz 5 (Best of 4) 3.5 14
Assignment 4 4 16
Mid Term 1 30 30
Final 1 40 40
Total 100
Class Rules
Mobile phone usage is not allowed
Late comers are welcomed in class but have to
stand
Late assignments will not get accepted
No retake of quiz and assignment will be
conducted
On copied assignments, tasks quizzes both parties
will get -1 mark
Become an owner of your work and be proud of it
Google Classroom Code
3hvr23b
Lecture 1
The Big Picture
What is an Operating System?
A program that acts as an intermediary
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
Boot Loader
A boot loader is a critical piece of software
running on any system. Whenever a computing
system is initially powered on, the first piece of
code to be loaded and run is the boot loader. It
provides an interface for the user to load an
operating system and applications.
Bootstrap Loader
A Bootstrap Loader (BSL) is a small program
which can be activated immediately after a
microcontroller has been powered up, in order
to load and execute another program in a well
defined manner.
It resides in the computer's firmware or read
only memory (ROM) and is responsible for
loading the initial code necessary to start the
operating system
GRUB
• GRUB (Grand Unified Bootloader)
• GRUB is a bootloader and boot manager for Linux and
other Unix-based OS
• GRUB starts after BIOS finishes the necessary
hardware tests and loads it from the Master Boot
Record (MBR) MBR contains all the details of the
partitions
GRUB
Loading Process of OS
A bootstrap
loader is a
program that
resides in the
computer’s
non volatile
memory
The Big Picture
Computer System Structure
Computer system can be divided into four components:
Hardware – provides basic computing resources
CPU, memory, I/O devices
Operating system
Controls and coordinates use of hardware among
various applications and users
Application programs – define the ways in which the system
resources are used to solve the computing problems of the
users
Word processors, compilers, web browsers, database
systems, video games
Users
People, machines, other computers
Operating System Definition
“The one program running at all times on the computer”
is the kernel,
which is part of the operating system
Everything else is either
A system program (ships with the operating
system, but not part of the kernel) , or
An application program, all programs not
associated with the operating system
Operating Systems Definition
OS is a resource allocator
• Manages all resources
• Decides between conflicting requests for efficient and fair
resource use
• A computer system has many resources - hardware and
software - that may be required to solve a problem: CPU time,
memory space, file-storage space, I/O devices, and so on.
OS is a control program
• Controls execution of programs to prevent errors and improper
use of the computer
• It is especially concerned with the operation and control of I/O
devices.
Kernel and operating system?
The operating system is the software package that
communicates directly to the hardware and our
application. The kernel is the lowest level of the
operating system.
Kernel is a core element of the OS that converts the
user query into the machine language
Kernel
“The one program running at all times on the computer” is the kernel.
Everything else is either a system program (ships with the operating
system) or an application program
An essential part of the operating system, responsible for resource
allocation, low-level hardware interfaces, security, and more.
The kernel is loaded into main memory. The kernel controls all requests
for disk, processor, or other resources.
Operating System Structure
Multiprogramming needed for efficiency
• Single user cannot keep CPU and I/O devices busy
at all times
• Multiprogramming organizes jobs (code and data) so
CPU always has one to execute
• A subset of total jobs in system is kept in memory
• One job selected and run via job scheduling
• When it has to wait (for I/O for example), OS
switches to another job
Example
Operating System Structure
Timesharing (multitasking) is logical extension in which CPU
switches jobs so frequently that users can interact with each job
while it is running, creating interactive computing
Response time should be < 1 second
• Each user has at least one program executing in
memory ->process
• If several jobs ready to run at the same time -> CPU
scheduling
• If processes don’t fit in memory, swapping moves them in and
out to run
Virtual memory allows execution of processes not completely in
memory
Difference
Multitasking is an extension of multiprogramming the only
difference is the use of memory management and
implementation of time management.
Interrupts
Modern Operating Systems are Interrupt driven
○ An interrupt is a signal to the processor emitted by
hardware or software indicating an event that needs
immediate attention.
Interrupt Handling
The operating system preserves the state of the CPU by
storing the registers and the program counter
Determines which type of interrupt has occurred:
Separate segments of code determine what action should
be taken for each type of interrupt
Interrupt Driven
Interrupt driven (hardware and software)
Hardware interrupt by one of the devices
Software interrupt (exception or trap):
Software error (e.g., division by zero)
Request for operating system service
Other process problems include infinite loop, processes modifying each
other or the operating system
Operating System Concepts – 9th Edition 1.25 Silberschatz, Galvin and Gagne ©2013
Operating-System Operations (cont.)
Dual-mode operation allows OS to protect itself and other system components
User mode and kernel mode
Mode bit provided by hardware
Provides ability to distinguish when system is running user code or kernel
code
Some instructions designated as privileged, only executable in kernel mode
System call changes mode to kernel, return from call resets it to user
Increasingly CPUs support multi-mode operations
i.e. virtual machine manager (VMM) mode for guest VMs
Operating System Concepts – 9th Edition 1.26 Silberschatz, Galvin and Gagne ©2013
Transition from User to Kernel Mode
Timer to prevent infinite loop / process hogging resources
Timer is set to interrupt the computer after some time period
Keep a counter that is decremented by the physical clock.
Operating system set the counter (privileged instruction)
When counter zero generate an interrupt
Set up before scheduling process to regain control or terminate program that exceeds
allotted time
Operating System Concepts – 9th Edition 1.27 Silberschatz, Galvin and Gagne ©2013