You are on page 1of 39

Mekelle Institute of Technology

PC Hardware Troubleshooting (CSE501)


Department of Computer Science and
Engineering
Lecture – 2
Operating System and Boot Process
The PC Hierarchy

Hardware

BIOS

OS
Users
Applications
2
Hardware
Hardware forms the core of a PC hierarchy; there is no
computer without the hardware
The hardware includes all of the circuits, drives,
expansion boards, power supplies, peripheral devices, and
their interconnecting wiring or cables (everything you can
physically touch)

3
BIOS
BIOS stands for Basic Input/Output System
A BIOS is a set of small programs (or services) that are
designed to operate each major PC subsystem
Each of these services (daemons in Unix) is invoked by a set
of standard calls
When the operating system requests a standard BOIS
service, the particular BIOS program will perform the
appropriate function tailored to the particular hardware
In addition to services, the BIOS runs a power on self-test
(POST) program each time the PC is initialized BIOS
resides on the motherboard in the form of a read-only
memory (ROM) IC
Better BIOS routines will result in superior system
performance
4
CHANGING ENVIRONMENT
Modern BIOS adds features including:
Advanced security settings
Boot sequence options (USB/NET/CD…)
Time stamp changes
Hardware management, control etc
Some even handle virus/Intrusion protection on a basic
scale

5
Operating System

The operating system serves two very important functions in


the modern PC
1. An OS interacts with, and provides an extension to the BIOS
This extension provides applications with a rich selection of high-level
file handling and disk control functions
These functions form the disk operating system (DOS)
When an application needs to perform disk access or file handling, the
DOS layer performs most of the work
N.B. The OS and BIOS work closely together to give an
application easy access to system resources
2. An OS forms an “environment” (or shell) through which
applications can be executed, and provides a user interface
allowing you and your customers to interact with the PC

6
Applications
The aim of a computer is to execute applications (games, word
processors, spreadsheets, etc.)
The OS allows the user to launch these Applications
As the application requires system resources during run-time,
it will make a call to the OS or BIOS, which in turn will access
the function and return any information needed to the calling
application

7
A typical microcomputer operating system
Resident operating system

Resident module System constants and parameters

in memory at all times


Interrupt handler routines
sometimes called the nucleus the kernel,
or the supervisor.
Command processor

System disk

Transient module Input/output control system

loaded into memory as needed


File system

Printer

Transient area

Example formatting a disk.


The routine that performs this task
is needed only when a disk is being
formatted 8
MS-DOS
COMMAND.COM

Resident routines

DOS is command driven.


Users request support by typing commands
in response to a system prompt. Other operating system
components
When the return key is pressed, the shell,
called COMMAND.COM, interprets the
command and calls the appropriate lower Transient area
level routine or program.
COMMAND.COM consists of a command
interpreter and a number of resident (or
internal) operating system routines that
remain in memory at all times

9
Cont….
Resident Commands Transient Commands

BREAK PATH APPEND LIB


CALL PAUSE APPLY LINK
CHDIR PROMPT ASSIGN MACHINE
CLS REM ATTRIB MAP
COPY REN BACKUP MODE
CTTY RMDIR BOOTF MORE
DATE SET CHCP NLSFUNC
DEL SHIFT CHKDSK NOSTACK
DIR TIME COMMAND PART
ECHO TYPE COMP PREP
ERASE VER COMPACT PRINT
EXIT VERIFY CONFIGUR RDCPM
FOR VOL DEBUG RECOVER
GOTO d: DETECT REPLACE
IF DISKCOMP RESTORE
MKDIR DISKCOPY SEARCH
DSKSETUP SELECT

10
Accessing peripherals in DOS
The task of accessing peripheral devices is divided between two of
the operating system modules:
IO.SYS
(called IBMBIO.COM under PC-DOS) is a hardware-dependent
module that issues physical data transfer commands.
On an IBM PC, this module interacts with a proprietary, basic
input/output system, or BIOS, implemented in read-only memory.
MSDOS.SYS:
hardware-independent module used for the implementation of Logical
I/O and other file system functions.
accepts logical I/O requests from application programs or other
operating system modules, translates them into physical I/O
commands, and passes the physical commands to IO.SYS
NB: only IO.SYS, the machine-dependent module, deals directly
with peripheral devices

11
Two modules, IO.SYS and MSDOS.SYS, share responsibility for accessing
peripheral request
devices.

MSDOS.SYS
uses a device driver to translate
logical I/O to physical form. COMMAND.COM

Converts logical I/O to physical


Logical
form request

Performs directory management


MSDOS.SYS
Supports application programs
Allocates space on disk
Logical I/O request
MSDOS.SYS Physical I/O
Device IO.SYS
operation
driver

Physical I/O request


IO.SYS

12
Directory management.
One of MSDOS.SYS’s responsibilities is directory management.

COMMAND.COM

MSDOS.SYS

Directory management

Create
Read Rewrite
Delete
directory directory
Update
Directory

Program Book Stats

IO.SYS

Directory copy

13
Cont…
1. Commands are read and interpreted by COMMAND.COM. Following a
make directory (MKDIR) command, COMMAND.COM calls MSDOS.SYS.
2. MSDOS.SYS then asks IO.SYS to read the directory.

COMMAND.COM

MSDOS.SYS

Directory management

Create
Read Rewrite
Delete
directory directory
Update
Directory

Program Book Stats

IO.SYS

Program Book Stats

14
Cont…
3. Once the directory is in memory, MSDOS.SYS can modify it. As an
example, a new directory entry is added.
4. Finally, MSDOS.SYS asks IO.SYS to write the directory to disk.

COMMAND.COM

MSDOS.SYS

Directory management

Create
Read Rewrite
Delete
directory directory
Update
Directory

Program Book Stats

IO.SYS

Program Book Stats Letters

15
Cont…

COMMAND.COM

MSDOS.SYS

Directory management

Create
Read Rewrite
Delete
directory directory
Update
Directory

Program Book Stats Letters

IO.SYS

Program Book Stats Letters

MSDOS.SYS asks IO.SYS to rewrite


the directory to disk.
16
Functions of the BIOS
When you first turn on your PC
Your PC requires information
to detect PC components
To find the operating system(floppy disk, hard drive, or a CD-ROM)
This information is stored in the BIOS

17
Flow Chart of BIOS Functions
Turn on Computer

Pass through POST Error Free


NO Output to Monitor
YES

Plug’n’Play

Pass through POST Error Free


Test Boot Drive

NO Pass through POST Error Free NO


Bootable media found
YES

Pass through POST Error Free


Load boot program

Start operating system

18
POST (Power On Self Test)

Takes place right after you power on.


Contains diagnostic routines for
 initializing the hardware and peripherals
 the video card, the main memory, the processor, the keyboard,
etc.
Checking their functions
Error message on screen if an error is detected. If
monitor cannot be detected, the beep codes are output
by the system loud speaker.

19
Plug and Play
Bios next looks for additional BIOS memory chips – might
be on a Plug and Play card such as video card or a SCSI
controller.
If present, they run their routines and supplement or replace some
functions of the system BIOS.
If components no longer match the data stored in the CMOS
(i.e. hardware change), message appreas on screen to
update.
After all hardware components have been found and
checked, Plug and Play goes to work.
Interrupts and DMA channels of the plug-in cards in the ISA
and PCI buses are queried and distributed.
Onboard hardware, located on motherboard and in its
ISA/PCI slots, are configured for operation.
20
Bootstrap Loader
BIOS next accesses the first sector of the hard drive, also
termed the boot sector, and starts the “bootstrap loader”
A small program that knows the file structure of the storage
medium and can call the operating system’s start routine.

Operating System Kernel


Next, the operating system kernel is read into main
memory and control of the hardware passes onto the
operating system.

21
An Interpreter
In old operating systems (DOS 6.2), the BIOS acts as a
mediator (or interface) between the hardware and the
software.
New operating systems, circumvent the BIOS and
communicate directly with the hardware through the
appropriate drivers.

BIOS Updating
The BIOS is manufactured on FLASH technology. It is
easily updated.
Previous versions of BIOS were developed on ROM,
EPROM, and EEPROM chips.

22
DOS (Disk Operating System) Fundamentals
Consisted of two parts
The BIOS itself is one part of the operating system.
The other part consists of the operating system program files.
Program files consist of
Utilities
A kernel that is loaded into the main memory when the
computer boots.

23
Microsoft Kernels
Kernel of a Microsoft operating system consists of
Msdos.sys
Io.sys
MSDOS.sys controls the keyboard input and the
screen output.
IO.sys communicates with the BIOS and contains
the actual program code of the operating system and
a process control for the hardware.

24
Bootstrapping
Bootstrapping: Introduction
Computers execute programs stored in main memory,
and initially the operating system is on the hard disk.
When the computer is turned on it does not have an
operating system loaded in memory and the hardware
alone cannot do the operations of an OS. To solve this
paradox a special program called bootstrap loader is
created.
This program does not have the full functionality of an
operating system, but it is capable of loading into
memory a more elaborated software(i.e. loader2)
which in its turn will load the operating system.
Once the OS has been loaded the loader transfers the
control of the system to the Operating system. 26
Bootstrapping continued…
Early programmable computers had toggle switches on the
front panel to allow the operator to place the bootloader into
the program store before starting the CPU.

In modern computers the bootstrapping process begins with


the CPU executing software contained in ROM at a
predefined address whose elementary functionality is to
search for devices eligible to participate in booting, and load a
small program from a special section of a device.

27
Bootstrapping continued…

CPU MEMORY

I/O OPERATIONS

BOOT PROG I/O

ROM

OS
LOADER2 28
Bootstrapping continued…

CPU MEMORY

LOADER2

I/O OPERATIONS

BOOT PROG I/O

ROM

OS
LOADER2 29
Bootstrapping continued…

In earlier computers data had to be hand loaded as


specified before, but nowadays a small piece of software
called loader helps us to avoid the manual loading.

0 os
99998
Ф=0
100000 READ
STORE Ф
Ф Ф+1 LOADER 2

IF EOF IP 0

ELSE IP 100000 30
Bootstrapping continued…

CPU OS

LOADER2

I/O OPERATIONS

BOOT PROG I/O

ROM

OS
LOADER2 31
Bootstrapping continued…

The above diagram can be explained in the following steps.


1. Check hardware
2. Initiate I/O to load the loader2 program into
memory
3. loader2 loads the OS and passes control to it

32
Why is Booting Required ?
Hardware doesn’t know where the operating
system resides and how to load it.
Need a special program to do this job –
Bootstrap loader.
E.g. BIOS – Boot Input Output System.
Bootstrap loader locates the kernel, loads it
into main memory and starts its execution.
In some systems, a simple bootstrap loader
fetches a more complex boot program from
disk, which in turn loads the kernel.

33
How Boot process occurs ?
Reset event on CPU (power up, reboot) causes
instruction register to be loaded with a predefined
memory location. It contains a jump instruction that
transfers execution to the location of Bootstrap
program.
This program is form of ROM, since RAM is in
unknown state at system startup. ROM is convenient
as it needs no initialization and can’t be affected by
virus.

34
Tasks performed at boot up
Run diagnostics to determine the state of
machine. If diagnostics pass, booting
continues.
Runs a Power-On Self Test (POST) to check the
devices that the computer will rely on, are
functioning.
BIOS goes through a preconfigured list of
devices until it finds one that is bootable. If it
finds no such device, an error is given and the
boot process stops.
Initializes CPU registers, device controllers and
contents of the main memory. After this, it
loads the OS.

35
Tasks performed at boot up (Cont…)
On finding a bootable device, the BIOS loads
and executes its boot sector. In the case of a
hard drive, this is referred to as the master
boot record (MBR) and is often not OS specific.
The MBR code checks the partition table for an
active partition. If one is found, the MBR code
loads that partition's boot sector and executes
it.
The boot sector is often operating system
specific, however in most operating systems
its main function is to load and execute a
kernel, which continues startup.
36
Secondary Boot Loaders
If there is no active partition or the active
partition's boot sector is invalid, the MBR may
load a secondary boot loader and pass control
to it and this secondary boot loader will select
a partition (often via user input) and load its
boot sector.
Examples of secondary boot loaders
GRUB – GRand Unified Bootloader
LILO – LInux LOader
NTLDR – NT Loader

37
Booting and ROM
System such as cellular phones, PDAs and game
consoles stores entire OS on ROM. Done only for
small OS, simple supporting hardware, and rugged
operation.
Changing bootstrap code would require changing
ROM chips.
EPROM – Erasable Programmable ROM.
Code execution in ROM is slower. Copied to RAM for
faster execution.

38
Example : DOS
After identifying the location of boot files, BIOS looks at the first
sector (512 bytes) and copies information to specific location in
RAM (7C00H) - Boot Record.
Control passes from BIOS to a program residing in the boot
record.
Boot record loads the initial system file into RAM. For DOS, it is
IO.SYS .
The initial file, IO.SYS includes a file called SYSINIT which loads
the remaining OS into the RAM.
SYSINIT loads a system file MSDOS.SYS that knows how to work
with BIOS.
One of the first OS files that is loaded is the system configuration
file, CONFIG.SYS in case of DOS. Information in the configuration
file tells loading program which OS files need to be loaded (e.g.
drivers)
Another special file that is loaded is one which tells what specific
applications or commands user wants to be performed as part of
booting process. In DOS, it is AUTOEXEC.BAT. In Windows, it’s
WIN.INI .

39