Os Unit1
Os Unit1
UNIT I
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 e.g. Word processors, compilers, web
browsers, database systems, video games
Users
People, machines, other computers
OS Views
User View - ease of use and good performance don’t care about
resource utilization
Terminals connected to Mainframe computers – Maximize resource
utilization
Workstation connected to network – individual usability and
resource utilization
Handheld computers – Optimized for usability and battery life
Embedded computers in devices and automobiles – run without
user intervention
Decode
IR-> Decoded
Execute
Perform Specific Operation
Store
Store the result in ACC and Display
Interrupt
An interrupt is a signal to the processor emitted by hardware or
software indicating an event that needs immediate attention.
e.g. pressing a key on the keyboard or moving the mouse triggers hardware
interrupts
The OS preserves the state of the CPU by storing registers and the
program counter.
For example, most I/O devices are much slower than the processor.
After each write operation, the processor must pause and remain idle
until the printer catches up.
• A sequence of instructions, labeled 4 in the figure, to prepare for the actual I/O
operation. This may include copying the data to be output into a special buffer and
preparing the parameters for a device command.
• The actual I/O command. Without the use of interrupts, once this command is issued,
the program must wait for the I/O device to perform the requested function (or
periodically check the status, or poll, the I/O device). The program might wait by simply
repeatedly performing a test operation to determine if the I/O operation is done.
• A sequence of instructions, labeled 5 in the figure, to complete the operation. This may
include setting a flag indicating the success or failure of the operation.
Transfer of Control
Instruction Cycle with interrupt
Interrupt Processing
Sequential and Nested Interrupt Processing
Memory Hierarchy
Memory Hierarchy
Memory Hierarchy
=0.095+0.055
=0.15µs
Cache Memory
A Small and Expensive Memory used to improve average Access Time.
2. Block Size
3. Mapping Function
4. Replacement Algorithm
5. Write Policy
•
Block Size
As Block Size - hit ratio will due to principle of spatial locality.
Mapping Function
Write Policy
Write can occur every time the block is updated else Write can occur once
block is replaced. User should choose effective write policy.
Spatial Locality : Words near the currently referenced word are likely
to be referenced again soon. So, pre fetch words near currently accessed
word and keep them.
2. Interrupt-driven I/O
a. Processor issue an I/O command to a module and then do some other work.
b. The I/O module will then interrupt the processor to request service when it is
ready to exchange data with the processor.
c. The processor then executes the data transfer and then resumes its former
processing.
The Programmed I/O and Interrupt Driven I/O techniques suffer from
two drawbacks
Working:
1. When a process wish read or write data it issues a command to DMA module by
sending the following
a. Whether Read/Write(R/W)
b. Address of I/O device involved
c. Starting address of memory to R/W
d. Number of words to R/W
2. Processor continues with other work. It delegate's the I/O operation to DMA
module
3. DMA module transfers the entire block (1 word at a time) directly to or from
memory without the involvement of processor
4. DMA controller sends an interrupt signal if I/O transfer is complete
DMA Diagram
Multiprocessor Organization
There are two or more processors of similar type.
These processors share same main memory and I/O and are
interconnected by bus.
All processors access the I/O devices through same channel or different
channel of their own.
Advantages:
Performance
Availability
Incremental Growth
Scaling
If P1 and P2 has same data in level 1 cache then if P1 updates the data
in its cache then it invalidates the data in P2 cache.
DDR3 memory controller brings the content of main memory into chip.
Advantages
• Increased Throughput
• Economy of scale
• Increased Reliability
Distributed Systems
• Two or more computers are connected to form distributed systems.
• Also called as loosely coupled systems
• Distributed systems distribute computation among several processors.
• The processors do not share memory or a clock. Instead, each processor
has its own local memory.
• Networks are classified into LAN- within room or floor, WAN- between
buildings or cities ,MAN- between cities.
Client Server Systems Terminals are connected to centralized system.
Centralized system- server, Terminals- clients
Peer to Peer systems All nodes act as server and also client
Clustered Systems
• Gather together multiple CPU’s to accomplish computational work.
• Share storage and connected through LAN.
• Provide high availability.
• Distributed systems should provide locking and control of to files so
that no conflict occurs.
• Distributed Lock manager(DLM) will provide those access control.
• Small memory.
• Slow processor needs less power is used to increase the battery life.
CPU mover data to/or from memory to devices through local buffers.
Computer system Organization
Initial Program or bootstrap program is stored in read only memory
(ROM) or erasable programmable read only memory (EEROM) also
called firmware.
It initialize all aspects to system and locate the OS kernel and load it
into memory.
OS is interrupt driven.
OS Structure
OS should be Multiprogramming to increase the CPU utilization.
Since main memory is too small to accommodate all jobs, the jobs are
initially kept on disk in the job pool.
Job scheduling – Selects the job from job pool and loads into main
memory
CPU Scheduling – Selects the job from memory and loads into CPU for
execution.
Swapping is done to swap in and out the process from min memory to
disk.
OS Structure – Contd..
Simple Structure
OS Structure – Contd..
Layered Approach
OS Structure – Contd..
Microkernels
OS Structure – Contd..
Modules
OS Structure – Contd..
Hybrid OS
• Mac OS
• iOS
• Android
OS Operations
• OS is interrupt driven.
Information Maintenance
• Get time or date, set time or date
• Get system data, set system data
• Get process, file or device attributes
• Set process, file or device attributes
Communications
• Create, delete communication connection
• Send, receive connections
• Transfer status information
• Attach or detach remote devices
Examples of Windows and Unix System calls
OS Generation
System must be configured or generated for specific computer site
which is called system generation
OS is normally an ISO image which is in CD-ROM or DVD-ROM.
SYSGEN reads from file and loads
Following kinds of information is determined
• What CPU is used? What options are installed?
• How will the boot disk formatted? How many partition?
• How much memory available? It can be done automatically by
reading till illegal address
• What devices are available?
• What OS options are desired or CPU scheduling algorithm,
maximum no of process supported?
System Boot
• The procedure of starting the computer and loading kernel is called
booting the system.
• A small piece of code called bootstrap program or bootstrap loader
locates the kernel and loads it into main memory and start
execution.
• When reboot is performed instruction register is loaded and
execution starts there.
• Bootstrap program is in ROM since RAM is in unknown state.
• Changing the bootstrap code require changing the ROM. So to avoid
this we use EPROM.
• GRUB is an exampl for open source bootstrap program.
• If full bootstrap program is loaded and loads the kernel then only
the system will be in running state