Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

# Batch Name : PreCAT OM13

# Subject Name : Operating System Concepts


------------------------------------------------------------------------------
# DAY-01:

Q. Why there is a need of an OS?

Q. What is Computer?
- Computer is a hardware/machine/digital device can be used to perform many tasks efficiently &
accurately.
- Computer Hardware mainly contains: Processor, Memory Devices & IO Device

- as any user cannot directly interacts with computer hardware, hence there is need of some
interface beteen user & hardware, and to provide this interface is the job of an OS.

- basically there are 3 types of users:


1. "end user"/"naive user": data entry operator, operator
2. "admin user": person who can install an OS/softwares, configure networks etc...

3. "programmer user": developers

Q. What are the basic functions of computer:


- there are four basic functions of computer
1. data storage
2. data processing
3. data movement
4. control

Q. What is a software?
- software is a collection of programs

"low level programming language"/"machine understandable": instructions written in this


programming language are either can be directly understandable by the machine or close to the
machine.
e.g. assembly language, machine language (binary language i.e. 01 format).

"high level/user understandable programming language": instructions written in this programming


language are dierctly understanbale by the programmer user
e.g. C, C++, Java, Python etc...

Q. What is a Program?
- Program is a finite set of instructions written in any programming lanaguge
(i.e. either low level/high level) given to the machine to do specific task.
- there are 3 types of program:
1. "system programs": programs which are the part of an OS
e.g. loader, kernel, cpu scheduler, interrupt handler etc...

2. "application programs":
e.g. notepad, google chrome, firefox, calculator, MS Office, games, compiler etc....

3. "user programs": programs defined by the programmer user


e.g. main.c, hello.c, string.c etc....

Q. What is an IDE? (Integrated Developement Environment)


- An IDE is an "application software" (i.e. collection of application programs) which is collection of
tools like editor, preprocessor, compiler, an assembler, linker, debugger etc.... required for faster
software developement.
e.g. Visual Studio, VS Code Editor, Eclipse, CodeBlock, Netbeans etc...

- "Compiler": it is an application program which converts high level programming language


code/user understandable language code into lowe level/machine understandable language code.
e.g. tc, gcc etc... --> c programming lanaguge code into an assembly language code .

- "assembler": it is an application program which converts an assembly language code into machine
lanaguge code i.e. in a binary format/object code.
e.g.
In Linux - "asm"
In Windows - "masm" - microsoft assembler

- "linker": it is an application program which links object code of your program with precompiled
object modules of library functions and creates final single executable code.
e.g. In Linux - Linker Program --> "ld" : link editor
- declarations of all library functions exists in header files, whereas definiotions of these functions
are exists in a lib folder in precompiled object module format.

- once executable code/file gets created we can run/execute it by either doubly clicking on its icon
or by means of giving coammnd
$./program.out (press eneter). $./a.out
In Windows : $.\a.exe

- Program is passive entity, whereas if any program want to becomes active it must be loaded into
the main memory/RAM i.e. it must becomes a process.
What is Process -> Running Program/ When a program gets loaded into the main memory it
becomes a process.

"loader": it is a system program (i.e. builtin program of an OS), which loads an executable file from
hard disk drive into the main memory.
- loader/OS is responsible for an execution of any program

"dispatcher": it is a system program (i.e. builtin program of an OS), which loads instructions & data
of program from the main memory onto the CPU.
Scenario-1:
Machine1 - Linux : program.c
Machine2 - Windows : program.c -> compile -> execute --> ?? YES

Feature of C -> "Portability": program written in C on one machine/platform can be compiled and
execute on any other machine/platform.

Scenario-2:
Machine1 - Linux : program.c -> compiler -> program (executable code)
Machine2 - Windows : program (executable code) -> run ??? NO

- program written in C and compiled on one machine/platform cannot be executed on any other
machine/platform.

- In Linux .extension doesnt matter

- "loader": when we try to run a program, loader first verifies file format
if file format matches then only it checks magic number, and file format as well magic number both
matches then only it loads an executable code from hard disk drive into the main memory.

Why?
- "file format" of an executable in Linux is different than file format of an executable file in
Windows.

In Linux file format of an executable file: "ELF"(Executable & Linkable Format)


In Windows file format of an executable file: "PE"(Portable Executable)

"file format": it is a specific way to store data & instructions of a program in an executable file.

- In Linux ELF file format divides an executable file logically into different sections, so that in each
section specific data can be kept.

//global vars
int n1;//uninitialied variable -> bss section
int n2 = 100;//initialied variable -> data section

static int n3;//uninitialied variable -> bss section


static int n4 = 100;//initialied variable -> data section

User
----------
UI Programs
----------
OS

----------
Hardware

- as any user cannot directly interacts with an OS, hence an OS provides two types of interfaces for
user through programs only.
1. "CUI/CLI": Command User Interface/Command Line Interface
- in this type of interface, user can interacts with an OS by means of entring commands in a text
format through command line.
e.g. In Windows : "cmd.exe" is name of the program which provides command user interface.
In Linux: "shell"/"terminal" is name of the program which provides command user interface.
In MSDOS: "command.com"

2. "GUI": Graphical User Interface:


- in this type of interface, user can interacts with an OS by means of making an events like clicks on
buttons, menu list, menu bar, exit, minimize, maximize, start, menu list etc...
In Windows : "explorer.exe" - is the name of program in windows which provides graphical user
interface.
In Linux : "GNOME/KDE" - name of programs which provides graphical user interface.

Q. What is an OS?
- An OS is a "system software" (i.e. collection of system programs) which acts as an interface
between user and hardware.
- An OS also acts as interface between programs and hardware.
- As an OS allocates required resources like main memory, CPU time, io devices access etc... to all
running programs, an OS is also called as a "resource allocator".
- An OS not only controls an execution of all programs, it also controls hardware devices which
connected to the computer system, and hence an OS is called as a "control program".
- As an OS manages available limited resources among all running programs, hence an OS is also
called as a "resource manager".

"end user point of view":


- An OS is a "software" (i.e collection of system programs as well as an application programs in a
binary format) which comes either in a CD/DVD/PD
has major 3 components:
1. "Kernel Program": it is a core program/part of any OS which runs continuosly into the main
memory and does basic minimal functionalities of an OS.
Kernel = OS OR OS = Kernel

e.g. Linux : "vmlinuz"


Windows : "win32krnl.exe"

basic minimal functionalities: any OS must support this functionalities

2. "Utililty Programs(Utility S/W)": extra utility functionalites


e.g. task manager, disk manager, anti-virus s/w comes with any OS etc...

3. "Application Programs(Application S/W)":


e.g. google chrome, MS Office, Calculator, Games etc....

+ Functions of OS:
Kernel Functionalities/Basic Minimal Functionalities - any OS must support these functionalities -
compulsory functionalities.
1. Process Management
2. Memory Management
3. CPU Scheduling
4. Hardware Abstraction
5. File & IO Management
----------------------------------------------------------------------------
Extra Utility Functionalities - Utility S/W - optional functionalities
6. Networking
7. User Interfacing
8. Proetction & Security
- "Intallation of an OS": to install an OS on computer machine, is nothing but to store programs of
an OS which are in a binary format onto the HDD.

- If any OS want to becomes active, then atleast one program i.e. kernel need to load into the main
memory from HDD, and the process to load kernel from HDD into the main memory is called as
"booting".

- "booting" : it is a process in which "bootstrap program" locates the kernel


and load it into the main memory from hdd.

- Motherboard is present inside cabinet onto the PCB: (Printed Circuit Board)
- Onto the Motherboard different components are attached: like Processor/CPU
RAM, Cache Memory, ROM etc....
- Components which are onto the motherboard is referred core computer system.
- Devices which are connected to the motherboard externally through ports are called as "peripheral
devices/peripherals/external devices/io devices"
e.g. monitor, keyboard, hard disk drive, printer, projector etc...

- "bootable device": if any storage device (i.e. HDD/CD/PD/DVD etc...) contains one special
program called as "bootstrap program" in its first sector/boot sector (i.e. in its first 512 bytes), then
it is called as "bootable device", and if boot sector is empty then it is referred as "non-bootable".

- there are two steps of booting:


1. "Machine Boot/Hardware Booting":
- step1: when we switch on the power supply current gets passed to the motherboard, and very first
one micro-program named as BIOS (Basic Input Output System ) gets invokes which exists in a
ROM memory.
- step2: first step of BIOS is POST (Power On Self Test), under POST, BIOS checks wheather all
peripherals are connected properly or not and their working status.
- step3: after POST, BIOS invokes "bootstrap loader" program, this program searches for available
bootable devices in a system and it selects only one bootable device at a time as per the priority
decided in BIOS settings.

2. "System Boot"
- step4: upon selction of bootable device as a HDD, then "bootlaoder program" exists in it gets
invoked, and this program displays list of names of operating systems installed on it, and user has to
select any one os from that list at a time.

- step5: upon selection of any one OS, bootstrap program of that OS gets invokes and it locates the
kernel and load it into the main memory from HDD.

You might also like