LECTURE 1
INTRODUCTION TO
OPERATING SYSTEM
INSTRUCTOR: Dr.Fouzia Idrees
Course Contents
2
Operating systems basics, system calls, process concept and scheduling, inter-
process communication, multithreaded programming, multithreading models,
threading issues, process scheduling algorithms, thread scheduling, multiple-
processor scheduling, synchronization, critical section, synchronization
hardware, synchronization problems, deadlocks, detecting and recovering
from deadlocks, memory management, swapping, contiguous memory
allocation, segmentation & paging, virtual memory management, demand
paging, thrashing, memory-mapped files, file systems, file concept, directory
and disk structure, directory implementation, free space management, disk
structure and scheduling, swap space management, system protection, virtual
machines, operating,system security
CUSIT SPRING 2015
Outline
3
1.1 What is OS
1.2 Computer System Organization
1.3 Computer System Architecture
1.4 OS Structure
1.5 OS Operations
1.6 OS Services
1.7 OS Interface
1.1 What is Operating System?
4
An operating system is a program that manages the
computer hardware.
It also provides a basis for application programs
and acts as an intermediary between the computer
user and computer hardware.
What do Operating System do?
5
The computer system can be divided roughly into
four components:
1. The hardware
2. The operating system
3. The application software
4. The Users
6
USER View of OS
7
Ease to use (Home PCs)
Efficient resource utilization
(Work stations)
SYSTEM view of OS
8
OS is a resource allocator
Manages all resources (CPU time, memory
space, storage space, I/O and so on)
Decides between conflicting requests for
efficient and fair resource use
OS is a control program
Controls execution of programs to prevent
errors and improper use of the computer
1.2 Computer System Organization
9
Basic Organization
Storage Structure
I/O structure
Computer Startup
10
Bootstrap program is loaded at power up or reboot
Typically stored in ROM, generally known as
firmware
Initialize all aspects of system
Loads operating system kernel and starts execution
1.2.1 Computer System Organization
11
1.2.1 Computer System Organization
12
I/O devices and the CPU can execute concurrently.
Each device controller is in charge of a particular
device type.
Each device controller has a local buffer.
1.2.2 Storage Structure
13
Main Memory:
Main memory is the only large storage media that
the CPU can access directly
Main memory is usually too small to store all
needed programs and data
Main memory is a volatile storage device that loses
its contents when power is off
1.2.2 Storage Structure
14
Therefore, most computer provide secondary
storage as extension to store web browser,
compliers, word processors…etc
Storage Device Hierarchy
15
1.2.2 Storage Structure
16
Storage systems organized in hierarchy.
Speed
Cost
Volatility
Caching–copying information into faster storage
system; main memory can be viewed as a cache for
secondary storage.
Data must be moved from secondary storage into
main memory before use.
17
Data transfer from cache to CPU and registers is
usually a hardware function with no operating
system control.
Data transfer from disk to memory is usually
controlled by the operating system.
1.3 Computer-System Architecture
18
1.3.1 Single-Processor Systems
1.3.2 Multiprocessor Systems
1.3.3 Cluster Systems
1.3.1 Single-Processor Systems
19
On a single processor system, there is only one main
CPU capable of executing a general purpose
instruction set.
Some other special-purpose processors may also
included. Such as:
GPU-graphics processing unit
Disk-controller microprocessor
Keyboard microprocessor
1.3.2 Multiprocessor Systems
20
Also called Parallel Systems
Advantages:
1. Increase throughput
2. Economy of scale
3. Increase reliability (fault tolerant)
1.3.2 Multiprocessor Systems
21
Two types of multiprocessor systems:
1. Asymmetric multiprocessing
(master and slave processors)
2. Symmetric multiprocessing
(Shared memory system)
1.3.3 Clustered Systems
22
Clustered computers share storage and are closely
linked via Local-area network (LAN) or a faster
interconnection.
1.4 OS Architecture
23
One of the most important aspect of OS is the ability
to Multiprogramming
Single user cannot keep CPU and I/O devices busy at
all times
One job selected and run via job scheduling
When it has to wait (for I/O for example), OS
switches to another job
Memory Layout for Multiprogrammed
24 System
Multiprogramming
25
Jobs are stored in “Job Pool”
Virtual memory is the useful technique for the
limitation size of physical memory
1.5 OS operations
26
Interrupt (driven by hardware) vs.
Trap (called by software or error)
Trap example: divide by 0; invalid memory access
We need to make sure that an error in a user program
could cause problems only for the one program that
was running (such as infinite loop)
Dual Mode Operation
27
Dual-mode operation allows OS to protect itself and
other system components
It contains User mode and Kernel mode
The operating system loaded user application starts in user
mode. Whenever a trap or interrupt occurs, hardware switches
to kernel mode.
Dual Mode Operation
28
Privileged instructions: some machine
instructions that may cause harm, can only be
executed in kernel mode.
Such as instruction switch to user mode; I/O control; timer
management, and interrupt management.
OS Services
29
Program execution
Error handling
Job sequencing
Input/output operations
Interrupt handling
File system manipulation
Scheduling
Resource Allocation
Accounting of computer resources
Protection
Multi-tasking
Multi-threading
Program execution
30
Users are interested in executing programs.
The system must be able to load a program into
memory and run it.
The program must be able to end its execution,
either normally or abnormally
Error handling
31
For each type of error, the operating system should
take the appropriate action to assure correct ant
consistent computing.
Example: –
Power failure in the CPU or memory
Printer out of paper
Access illegal memory location.
Job sequencing
32
The system must determine the sequence in which
jobs should be processed.
In the first operating systems to transfer control
from one Job to the next, a Job Control language
interpreter(a command interpreter) had to be used.
Device Management
33
Since a user program cannot execute I/O operations
directly, the O.S. must provide some means to do so
OS manages device communication via their respective
drivers. Operating System does the following activities
for device management.
Keeps tracks of all devices. Program responsible for this
task is known as the I/O controller.
Decides which process gets the device when and for how
much time.
Allocates the device in the efficient way.
De-allocates devices.
Interrupt handling
34
Operating systems are event driven programs.
If there are no programs to execute, no I/O devices
to service, and no user to respond to, an O.S. will
sit quietly, waiting for something to happen.
Events are almost always signaled by the
occurrence of an interrupt or trap.
File system manipulation
35
Users will be able to create, delete, read, or write files
Keeps track of information, location, uses, status etc.
The collective facilities are often known as file system
Scheduling
The system has to decide when to introduce new
processes into the system and the order in which
processes should run
Resource Allocation
36
When there are multiple process running concurrently,
resources must be allocated to each one of them
Accounting of computer resources
The operating system must keep track of the type and
amount of resources used by each user.
This information can be used for the purpose of paying
for the use of the system or for accumulating usage
statistics.
Protection
37
When several processes are being executed
concurrently to increase CPU utilization, it should
not be possible for one process to interfere the
others
OS ensures that all access to system resources is
controlled.
OS ensures that external I/O devices are protected
from invalid access attempts.
OS provides authentication feature for each user by
means of a password.
Multi-tasking
38
In an operating system, multitasking is allowing a user to perform
more than one computer task at a time.
The operating system is able to keep track of where you are in these
tasks and go from one to the other without losing information.
Multi-threading
Multithreading is the ability of a program or an operating system
process to manage its use by more than one user at a time and to
even manage multiple requests by the same user without having to
have multiple copies of the programming running in the computer
1.7 OS interface
39
Command Line Interface
A command line interface (CLI) enables users to type
commands in a terminal or console window to interact with
an operating system.
Users respond to a visual prompt by typing a command on
a specified line, and receive a response back from the
system. Users type a command or series of commands for
each task they want to perform.
40
Graphical User Interfaces
A graphical user interface (GUI) uses graphics, along with
a keyboard and a mouse, to provide an easy-to-use interface
to a program.
A GUI provides windows, pull-down menus, buttons,
scrollbars, iconic images, wizards, other icons, and the
mouse to enable users to interact with the operating system
or application.
CUSIT SPRING 2015
41
End of the Lecture
Assignment 1
42
Historical Milestones:
1. Serial Processing
2. Distributed
3. Embedded
4. Simple Batch Systems
5. Multiprogrammed batch systems
6. Time Sharing Systems
Date of submission:26th March,24