Chapter 1: Introduction Section 1: What Is An Operating System?
Chapter 1: Introduction Section 1: What Is An Operating System?
No driver:
The device can be read and/or written by OS
like ordinary memory.
Access Methods:
Busy waiting:
OS waits until it is ready.
Interrupt:
OS blocks the program which requested I/O.
OS looks for other work to do.
When I/O is ready, it generates an
interrupt.
1. The device signals the interrupt
controller.
2. The controller signals CPU, and
3. the device number on the bus.
4. If CPU accepts interrupt, the address
and the status of the executing
program are saved.
5. CPU reads the device number on the bus
which identifies the address (interrupt
vector) for the interrupt handler for
the device.
6. CPU executes the interrupt handler.
7. The program which was executing before
the interrupt resumes executing.
Direct Memory Access (DMA):
DMA chip controls the flow of bits
between memory and the device
controller without CPU.
CPU sets up DMA chip, which causes an
interrupt when done.
Buses: New PC
ISA (Industry Standard Architecture):
2 bytes at 8.33MHz (16.67MB/s)
Original IBM PC
Included for backward compatibility
PCI (Peripheral Component Interconnect):
A successor to ISA bus by Intel
8 bytes at 66.67MHZ (528MB/s)
Most high speed I/O devices use the PCI
bus now.
A large Pentium system:
Level2
CPU with
cache
level1
PCI
Main
bridge Memory
7
cache
========================================
SCSI
USB
ISA
Graphics
6
7
bridge
Adapter
IDE disk
========================================
Modem
Sound
Printer
card
1:
2:
3:
4:
5:
6:
Cache bus
Local bus
Memory bus
PCI bus
ISA bus
SCSI (Small computer system interface):
Up to 160 MB/s
Macintosh and UNIX, and some Intel systems
7: USB (Universal serial bus):
4 wires; 2 wires supply power.
The single USB device polls the I/O
devices every 1ms; unnecessary to
install a new driver.
An aggregate load of 1.5MB/s
Faster version is coming out.
IEEE 1394 bus:
Serial, 50MB/s
Plug and play:
Before plug and play:
Each I/O card had a fixed interrupt request
level and fixed addresses for its I/O
registers.
If two cards uses the same interrupt, DIP
switches and/or jumpers must be reset.
After:
At a boot time Bios (Basic input output
system) in a flash RAM checks RAM, ISA
and PCI buses to detect all attached
devices.
If there is a new device (not on the list
in CMOS), the new device is configured.
Booting:
10
5.
6.
7.
8.
Library procedures:
Unix:
About 100 procedures
Most of them call system calls (almost
1-1).
GUI (X Windows and Motif) run in user
space.
Windows: Win32 API (Application Program
Interface):
Over thousands procedures
Only some of them invoke system calls.
A huge number of calls for managing
windows, figures, text, fonts, etc;
The graphics subsystem runs in the
kernel.
Section 7: OS Structure
Monolithic (no layer):
A collection of procedures each of which
can call any others.
No information hiding
Some structure:
A main program invokes the requested
service procedures.
11
12
Note:
With VM/370 each user gets an exact copy of
the underlying computer IBM370.
With virtual 8086 mode on the Pentium, each
user gets an exact copy of 8086,
different from the underlying cpu.
Java virtual machine (JVM):
Java compiler produces code for JVM, which
is executed by any computer with a
software JVM interpreter.
Exokernels:
Each user has a clone of the actual
computer with a subset of resources:
E.g. One user has access to 0 to 1023
blocks of the disk, and the other from
1024 to 2047, etc
Exokernel runs in kernel mode at the bottom
layer.
Simpler than other virtual OS: No table to
re-map disk addresses
Client-Server Model:
Microkernel:
The kernel handles only the communication
between client (client processes) and
servers (process server, file server,
memory server) all of which run in the
user mode.
Easy to use in distributed systems
Some special instructions to hardware
must also be done the kernel mode:
1. Do it all in the kernel.
2. Do a minimum amount of mechanism
into the kernel, but leave the
policy decisions up to the server
in user space.
E.g. Writing to or reading from a
certain address in user mode means
writing to or reading from some
I/O device, and the kernel will
take over.
Sections 8, 9, 10, 12: Skip
Section 11: Metric Units
13
1 = unit
10 = 1 deca
100 = 1 hecto
1000 = 1 kilo = 1k
1000000 = 1 mega = 1m
1000000000 = 1 giga = 1g
1000000000000 = 1 tera
0.1 = 1 deci = 1d
0.01 = 1 centi = 1c
0.001 = 1 milli = 1m
0.000001 = 1 micro = 1u
0.000000001 = 1 nano = 1n
0.000000000001 = 1 pico = 1p
Maximum in:
1 byte: 28 = 256
210 = 1024 = 1k
2 bytes: 216 = 65536 = 26 * 210 = 64k
220 = 210 * 210 = 1k * 1k = 1m
3 bytes: 224 = 24 * 220 = 16m
230 = 210 * 210 * 210 = 1k * 1k * 1k
= 1g
4 bytes: 232 = 22 230 = 4g
Examples:
Short integer (2 bytes): -32k to +32k
Long integer (4 bytes): -2g to +2g
Number of RGB colors (3 bytes): 16m
14