OS 01 Introduction
OS 01 Introduction
OS 01 Introduction
A Biswas,
Information Technology
IIEST, Shibpur
Books
• Operating Systems Principles and
Practices – Anderson and Dahlin
• OSTEP – OS in Three Easy Pieces
• Operating System Concepts – Galvin
• Computer Systems – Hallaron
• M J Bach
• Deitel and Deitel
How a computer system works
A computer system is a collection of
hardware and software components that
work together to run computer programs.
Hello world !!!
ASCII representation of hello.c
Hello.c is translated to other form
• hello.c is a high-level C program - read and
understood by human
• Example: #include<stdio.h>
1. reads the contents of the system header
file stdio.h and
2. insert it directly into the program text.
hello.c hello.i
$ cpp hello.c
2. Compilation phase
hello.i hello.s
$ gcc –c hello.s
4. Linking phase
hello.o hello
Notice that our hello program calls the printf function, the
printf function resides in a separate precompiled object
file called printf.o, which must somehow be merged with
our hello.o program.
The linker (ld) handles this merging. The result is the hello
file, which is an executable object file (or simply
executable) that is ready to be loaded into memory and
executed by the system.
Shell
$ ./hello
Hello world
$
Hardware organization
Hardware Organization
Buses:
- a collection of electrical conduits called buses
that carry bytes of information back and forth
between the components.
- designed to transfer fixed-sized chunks of bytes
known as words.
- The number of bytes in a word (the word size) is
a fundamental system parameter that varies
across systems.
- Intel -4, Sparc – 8
Hardware Organization
I/O Devices:
Input/output (I/O) devices are the system’s
connection to the external world.
- a keyboard and
- mouse for user input,
- a display for user output, and
- a disk drive (or simply disk) for long-term
storage of data and programs.
Hardware Organization
I/O Devices:
- the hello executable program resides on
the disk.
- each I/O device is connected to the I/O bus
by either a controller or an adapter.
- the purpose of the controller is to transfer
information back and forth between the I/O
bus and an I/O device.
Hardware Organization
Main Memory:
The main memory is a temporary storage device
that holds both a program and the data it
manipulates while the processor is executing the
program.
Update: Copy the contents of two registers to the ALU, which adds the
two words together and stores the result in a register, overwriting
the previous contents of that register.
I/O Read: Copy a byte or a word from an I/O device into a register.
I/O Write: Copy a byte or a word from a register to an I/O device.
Jump: Extract a word from the instruction itself and copy that word into
the program counter (PC), overwriting the previous value of the PC.
Running the Hello program
1. Shell reads hello 2. Stores in registers 3. Stores in main memory
Running the Hello program
1. Hit the enter key 2. Shell loads executable hello from disk to main memory (DMA)
Running the Hello program
1. Processor executes 2. “hello world” copied to registers 3. then to display device
Running the Hello program
Disk drives are 10 million times slower than the main memory.
Heap:
Expands and contracts
dynamically as malloc
and free are called.