OS Intro (Compatibility Mode)
OS Intro (Compatibility Mode)
Prachi Pandey
C-DAC, Bangalore
Altair 8080
Questions:
Does the programmer need to write a single
program that performs many independent
activities?
Does every program have to be altered for
every piece of hardware?
Does a faulty program crash everything?
Does every program have access to all
hardware?
Disadvantages
Lack of interaction between the user and job.
Terminals are
connected to the main
computer and used for
input and output. No
processing is made.
They do not have
CPUs.
In Time Sharing OS
A real-time operating system may be single- or multitasking, but when multitasking, it uses specialized
scheduling algorithms so that a deterministic nature of
behavior is achieved.
Problem:
How to run multiple applications in such a way that
they are protected from one another
Goal:
Keep User Programs from Crashing each other
Keep User Programs from Crashing OS
Keep Parts of OS from crashing other parts?
Simple Policy:
Programs are not allowed to read/write memory of
other Programs or of Operating System
Mechanisms:
Address Translation
Dual Mode Operation
Code
Data
Heap
Stack
Data 2
Code
Data
Heap
Stack
Stack 1
Heap 1
Code 1
Stack 2
Prog 1
Virtual
Address
Space 1
Prog 2
Virtual
Address
Space 2
Data 1
Heap 2
Code 2
OS code
Translation Map 1
OS data
Translation Map 2
OS heap &
Stacks
Two modes:
o Kernel mode (or supervisor or protected)
o User mode: Normal programs executed
Some instructions/ops prohibited in user mode:
o Example: cannot modify page tables in user mode
Attempt to modify Exception generated
Transitions from user mode to kernel mode:
o System Calls, Interrupts, Other exceptions
Process Management
Storage Management
Networking
Protection System
Command-Interpreter System
OS activities include
Creating and deleting files and directories
Primitives to manipulate files and directories
Mapping files onto secondary storage
Kernel components
File Manager
Maintains information about the files that are available
on the system
Device Drivers
Software to communicate with peripheral devices or
controllers
Memory Manager
This unit is responsible for coordinating the use of the
machines main memory
Scheduler & Dispatcher
These units together manage processes
Roles of a kernel
responsible for the creation and destruction of
memory space which allows software to run
provides services so that programs can request
the use of the network card, the disk or any other
piece of hardware
manages the file system and sets interrupts for
the CPU to enable multitasking.
responsible for ensuring that faulty programs do
not interfere with the operation of others
Example:
A good example of this would be device drivers.
A device driver must tell the kernel exactly how to
interact with a piece of hardware, so it must be run in
kernel mode.
Because of this close interaction with the kernel, the
kernel is also a lot more vulnerable to programs
running in this mode, so it becomes highly crucial
that drivers are properly debugged before being
released to the public.
It is a non-privileged mode.
It is non-privileged in that it is forbidden for
processes in this mode to access those portions of
memory (i.e., RAM) that have been allocated to the
kernel or to other programs.
User mode is the normal mode of operating for
programs.
Code running in user mode must delegate to system
APIs to access hardware or memory.
Most of the code running on your computer will
execute in user mode.
Monolithic Kernel
Microkernels
Hybrid Kernels
Example
Types of interrupt
o Polling
o Vectored interrupt system
REFERENCES