Operating Systems - Advanced_Level_ICT_(Prabuddha Srimal)

Download Report

Transcript Operating Systems - Advanced_Level_ICT_(Prabuddha Srimal)

The main objective of this seminar / workshop is
to endow with an in-depth subject knowledge to
the participants who are supposed to teach the
advanced level Information and Communication
Technology subject in schools from year 2009.
Therefore, the material provided should be used
only as a general guide and not the ultimate
source of information.
NIE – Maharagama
10/30/2015
1
Operating Systems
“An elephant is a mouse with an Operating
System.” — Knuth
10/30/2015
2
Basic Concepts
Introduction
What is an OS?
 An OS is a software that controls and organizes the
operations of a computer system while helping
execution of other programs and improving systems
performance.
 OS is the software layer closest to the hardware
of a
computer which facilitates controlling and operating
hardware and launching application programs and
other systems utilities.
 The purpose of an OS is to run a computer
and efficiently.
10/30/2015
smoothly
3
First Generation
 Simple Hardware
- Card Readers, Card Punch, Tape Readers, Line Printers
 User (Programmer) Makes the Job Schedule
- Loading program
- Loading compiler
- Compiling
- Running
 No requirement for an OS
 Inefficient
10/30/2015
4
Second Generation
 Simple Batch Systems
- User (Programmer) prepares job (Program & Data)
- Submits job to operator
- SPOOLing Used to speed up processing
Third Generation
 Multiprogramming and Time-sharing concepts
Fourth Generation
 OS for PCs, Workstations, Servers, Networks
 Distributed Operating Systems.
 Multiprocessing Operating Systems.
 Real Time Operating Systems.
10/30/2015
5
PC Operating Systems – Brief History
 1976 Bill Gates and Paul Allen found Microsoft
 1981 MS-DOS 1.0
- 16-bit addressing
- Real mode
 1985 Windows 1.0
- First Microsoft GUI operating system
- Introduced protected mode
 1990 Windows 3.1 and Windows for Workgroups 3.1
- Eliminated real mode, introduced enhanced mode
- Added network support (LANs)
10/30/2015
6
 1992 Windows NT 3.1
Contd. …
– New Technology operating system
– Created new corporate line
– Focused on security and stability
– NTFS (NT File System)
– Eliminated direct access to memory
– 32-bit addressing
 1996 Windows NT 4.0
– Moved graphics driver into kernel
 1995 Windows 95
– 32-bit addressing
– DirectX
- Simulates direct access to hardware through API
10/30/2015
7
 1998 Windows 98
Contd. …
– Bundled Internet Explorer into operating system
 2000 Windows ME
– Last purely consumer line desktop operating system
– Does not boot in DOS mode
 2000 Windows 2000
– Last purely corporate line desktop OS
– Active Directory
– Kerberos
- Enables single sign-on
 2001 Windows XP
– Merged consumer and corporate code bases
– 64-bit support
10/30/2015
8
Basic Design Goals
 User Goal - Convenience
 Providing an ‘easy to use environment’ hiding all
complexities from the user
 System Goals
 Efficiency - High Throughput, Low Turnaround time and
Low response time
Throughput The number of jobs that can be executed in a unit
time.
E.g. Multiprogramming provides a better
use of CPU and I/O resources.
Multiprogramming – the ability to run more than one program at
a time. Thus the utilization of fast devices and slow devices can
9
be10/30/2015
compromised.
Turnaround Time The interval from the time of submission of a
job to the time of completion.
Response time - The amount of time taken to start responding.
 Improved Performance
- Effective use of computer’s resources
 Scalability
- The ability to cater for the advancement of the
technology by allowing new hardware and
methodologies.
 Availability
10/30/2015
- The ability to accept and successfully process an
individual job or a large number of jobs
concurrently.
10

Reliability
- The ability to work with a minimum of failures.
- The consistence with which a result can be
produced.
 Early discovery of troubles
 Searching for faulty areas and isolating them
 Diagnosing troubles
 Monitoring overloads
 Providing security

Serviceability
- Includes on-line diagnosis and repair of
malfunctions concurrent with normal job execution.
10/30/2015
11

Security
- Includes on-line diagnosis and repair of malfunctions
concurrent with normal job execution.

Portability
- Will the operating system be portable to widely
varying types of hardware platforms?

Backward Compatibility and Emulation
- Is it important that software that ran under
previous operating system versions or under
different operating systems be supported?
10/30/2015
12
Two Layer Model
Resident part of the
operating system.
Shell
Memory management
Kernel
Task management
Disk management
Process management
10/30/2015
The interface that accepts,
interprets and executes user
commands or programs.
13
User Interaction
User
Communicates
with the Shell
SHELL
KERNEL
Communicates
with kernel
Provides
Services by
processing all
system calls
Kernel is
protected
from user
access
10/30/2015
14
Operating System Architecture
 Today’s OSs are complex because they provide
many services and support a variety of H/W
 OS architecture can help the designers to keep it
simple as possible by organizing the OS
components.
 One of the earliest architecture is Monolithic
Architecture. E.g. OS/360, VMS, Linux, UNIX
 Every OS component is contained in the kernel
and can communicate with each other directly.
This feature makes the OS efficient.
10/30/2015
15
Monolithic Architecture
APPLICATIONS
USER
SPACE
SYSTEMS CALL INTERFACE
KERNEL
SPACE
Memory
Manager
File
System
10/30/2015
KERNEL
Scheduler
I/O
Manager
Network
Manager
16
Layered Architecture
 When the Operating Systems become complex
monolithic designs become unmanageable.
 OS functions are grouped into layers and each layer
is assigned some specific functions.
 Layered architectures promote modular designs.
 A module is highly cohesive and the coupling
between two adjacent modules is loose.
 A modular design helps improving the structure and
consistency of an Operating System. Debugging,
updating, validation etc. becomes much easy.
 A layer in between can communicate with the layer
10/30/2015
above and below.
17
 Each module hides its functional complexity to
others and provides a standard interface to
communicate with other components.
 Performance degrades as intercommunication
among components is not direct.
USER
APPLICATION LAYER
SPACE
IO MANAGEMENT
SPACE
HARDWARE
KERNEL
INTER PROCESS COMMUNICATION
MEMORY MANAGEMENT
PROCESSOR ALLOCATION & PROCESS SCHEDULING
10/30/2015
LAYER 5
LAYER 4
LAYER 3
LAYER 2
LAYER 1
18
Microkernel Architecture
Kernel is small and provides a
small number of services.

Provides a high degree of
modularity.

Components such as
Process management,
File system, Networking
and IO are kept outside
the kernel.
KERNE
L
SPACE

USER SPACE

E.g. Some versions of Linux,
10/30/2015 XP
Windows
APPLICATIONS
SYSTEMS CALL INTERFACE
FILE
SYSTEM
KERNEL
PROCESS
SCHEDULER
DEVICE
MANAGER
INTERPROCESS
COMMUNICATION
MEMORY
MANAGEMENMT
SYNCHRONIZATION
19
Microkernel Architecture
MONOLITHIC KERNEL
Lack of structure – SW Eng.
Techniques cannot be adapted
Large kernel, difficult to debug.
Re-implementing means rebuilding.
MICRO KERNEL
Structured, Open, Modular – SW Eng.
Techniques can be adapted.
Small kernel, Easy debug
Daunting, poor performance during inter
communication
High performance
Needs lot of memory to load
10/30/2015
20
Types of Operating Systems
 Single User Single Task Operating Systems.
 Single User Multi Task Operating Systems.
 Multi User OS Operating Systems.
 Multi-programming Operating Systems.
 Multi-processing Operating Systems.
 Multi-threading Operating Systems.
 Real time OS Operating Systems.
10/30/2015
21
Single User Single Task Operating Systems.
 Only one user can use it and perform only one
application at a time
Examples:
MS-DOS – IBM PC
Palm OS - PDA
Symbian OS – Mobile phone
Single User Multi Task Operating Systems.
 A single user performs varieties of tasks
simultaneously.
Examples:
10/30/2015
MS Windows
MAC OS
22
Multi Tasking
 The operating system switches between tasks
quickly, giving the user the impression that more than
one task is performed simultaneously
 There are two basic types of multitasking:
1. Preemptive
2. Cooperative.
Preemptive Multitasking
 In preemptive multitasking, the operating system
divides the CPU time into slots and each program is
permitted to execute during its own time slot.
 At the end of the time slot, the currently
task is suspended and the next task in
10/30/2015
started or resumed.
executing
the queue is
23
 Allocation of priorities to programs is also possible
so that high priority programs can preempt the low
priority programs.
Examples:
Windows 95, Windows NT, OS/2 and UNIX
Cooperative Multitasking
 In cooperative multitasking, each program can
use
the CPU for as long as it needs it.
 If a program is not using the CPU, it may allow
another program to use it temporarily.
Example:
10/30/2015
Microsoft Windows 3.x
24
Multi-User Operating Systems
 More than one user can log on to the system at the
same time.
 Many users access server and share resources
Examples:
Operating Systems of Mainframes and Super
computers
UNIX
Windows 2003 Server
10/30/2015
25
Multi Programming Operating Systems
 Supports running several programs in the same
machine at the same time.
 The idea is to use the CPU effectively.
 Slow I/O devices put the CPU to wait states.
 Multi-programming allows loading several
programs into memory and making the CPU
available to another program while one program is
waiting for completion of its I/O request.
10/30/2015
26
Program A
10 ms
CPU
30 ms
I/O
20 ms
CPU
40 ms
I/O
30 ms
CPU
20 ms
I/O
40 ms
CPU
Program B
10 ms
I/O
CPU
CPU
I/O
I/O
0 10 30
50
70
Uni - programming
10/30/2015
90 100
m
s
0 10 30
50
70
90 100
m
s
Multi - programming
27
Multi-Processing Operating Systems.
 Supports running a program on more than one CPU.
Multi-Threading Operating Systems.
 In most operating systems, there is a one-to-one
relationship between the task and the program.
 Some operating systems allow a program to be
divided into multiple tasks and run concurrently.
Such systems are called multithreading operating
systems.
10/30/2015
28
Real Time Operating Systems. (RTOS)
 Responds to input instantly.
 They require minimal user interaction
Examples:
Operating Systems used in
Industrial Process control computers
Robotic Devices
Automobiles
Some home appliances
Scientific Instruments
10/30/2015
29
VMS
Short for Virtual Memory System, a multi-user, multitasking,
virtual memory operating system that runs on DEC's VAX and
Alpha lines of minicomputers and workstations. VMS was
introduced in 1979 along with the first VAX minicomputer. Like
the VAX itself, VMS has undergone many changes over the
years. DEC now refers to it as OpenVMS.
Real mode, Protected Mode and Virtual Mode
An execution mode supported by the Intel 80286 and later
processors. In real mode, these processors imitate the Intel
8088 and 8086 microprocessors, although they run much
faster.
The other mode available is called protected mode. In
protected mode, programs can access extended memory and
virtual memory. Protected mode also supports multitasking. .
10/30/2015
30
The 80386 and later microprocessors support a third mode
called virtual 8086 mode. In virtual mode, these
microprocessors can run several real-mode programs at
once
The DOS was not designed to take advantage of protected
mode, so it always executes programs in real mode unless a
protected mode extender is run first.
DirectX
A set of APIs developed by Microsoft that enables
programmers to write programs that access hardware
features of a computer without knowing exactly what
hardware will be installed on the machine where the program
eventually runs.
10/30/2015
31
DirectX achieves this by creating an intermediate layer that
translates generic hardware commands into specific
commands for particular pieces of hardware. In particular,
DirectX lets multimedia applications take advantage of
hardware acceleration features supported by graphics
accelerators.
Active Directory
A new directory service from Microsoft that will be part of
Windows NT 5.0.
Directory Service
A network service that identifies all resources on a network
and makes them accessible to users and applications.
10/30/2015
32
Resources include e-mail addresses, computers, and
peripheral devices such as printers. Ideally, the directory
service should make the physical network topology and
protocols transparent so that a user on a network can access
any resource without knowing where or how it is physically
connected.
Kerberos
Kerberos is a network authentication protocol. It is designed
to provide strong authentication for client/server applications
by using secret-key cryptography developed at
Massachusetts Institute of Technology (MIT)
10/30/2015
33
General Functions of an Operating System
1. Processor Management
Controlling processes and applications access of
CPU so that each has its fair share.
 OS has to ensure that each process and
application receives enough of the processor's
time to function properly.
 Use as many processor cycles for jobs as are
possible.
10/30/2015
34
Process / Thread
 The basic unit of software that the operating
system deals with in job scheduling is either a
process or a thread (depends on the OS)
 A process was simply regarded as an application
that
is running. But it is not always true. An application may
cause several other processes to begin.
 Therefore a process, is considered as a software
that
performs some action and can be controlled by a user,
by other applications or by the operating system.
10/30/2015
35
2. Memory Management
 Controls the different types of memories for
the
allocation of space to applications.
 O/S makes sure that instructions and
corresponding data are in the RAM for the CPU
to process.
 If RAM capacity is not enough, the O/S should
borrow space from the hard disk. The process
of borrowing space from the hard disk to
increase the capacity of RAM is called virtual
memory
10/30/2015
36
 The O/S swaps out data from the RAM that is
not currently needed and stores it in a swap
file.
 Later, if this data contained in the swap file
is
needed, the O/S stores it back in the RAM
(Page). The process of is called paging.
The condition of excessive
paging is called thrashing,
making the computer very
slow
10/30/2015
37
3. Storage Management
Manages the Disk, file storage facilities.
 Disk Management.
- Basic Disk Operations.
Partitioning
Formatting, Boot area, FAT, Inode tables
 File Management.
- Basic Directory and File Operations.
Create, Open, Close, Read, Write
Copy, Paste, Rename, Join, Move, Delete
Attributes
10/30/2015
Security, Access rights
38
4. Device Management
 Managing input and output is largely a matter of
managing queues and buffers. E.g. KB
 Controls devices, mainly through their drivers.
 Device drivers translate the commands of a device
to commands that the O/S understands and vice
versa
 Plug and Play
- A software and hardware standard
- A user can plug a device into a port and the O/S
recognizes the device and its driver
immediately.
10/30/2015
39
5. Interface Management
Application Interface
 OS provides a set of routines, protocols, and
tools for building software applications. A good
API makes it easier for a programmer to
develop
a program by providing all the building blocks.
User Interface
 Junction between a user and a computer program.
 Three types.
1. Command Driven Interface
2. Menu Driven Interface
10/30/2015
3. Graphical User Interface
40
Command Driven Interface
Provides facilities to use a set of commands
through which a user communicates with the OS
Menu Driven Interface
A menu-driven interface is one in which you select
choices from various menus displayed on the
screen.
Graphical user interface
A user interface (GUIs) that use windows, icons,
and pop-up menus and a pointing device such as a
mouse to manipulate them.
10/30/2015
41
6. Interrupt Handling
7. Enabling Multi-access
8. Deadlock Handling
9. Security Management
10/30/2015
42
Multitasking:
Controls timing of events
Example
You are typing and at the same time you want to print
The OS receives an interrupt that a job needs to be
sent to the printer
The OS puts into a stack the job currently being
processed by the CPU
The CPU processes the printer request by sending the
data to the printer
The CPU goes back to the stack and retrieves the job
that was being processed before
If the printer is busy, the OS puts the job into a buffer
A program, called spooler, will tell the OS that the
printer is free to process new requests
10/30/2015
43
Application Program Interfaces (API)
Blocks of code that the application software can
use in order to interact with the CPU
These blocks are built into the O/S
So, instead of building these blocks into every
application, the code is built only once into the O/S
10/30/2015
44
10/30/2015
45