Title: Software
1Software
Civilization advances by extending the number of
important operations which we can perform without
thinking about them. -Alfred North
Whitehead, An Introduction to Mathematics, 1911
2Software Classification
- Software
- Applications System
- MS-Excel
- Quake II Utility Operating System
- WordPerfect Windows
- Linux, Unix
- Solaris
- Shell Kernel
3Application and System Software
- Application Software
- User needs
- System Model
-
- Source Code
- Machine instructions
- Programs to help USER perform tasks that utilize
the machines capabilities
- System Software
- Machines needs
- Services
-
- Hardware management
- Machine instructions
- Programs that help the MACHINE perform tasks that
manage the machines functions -
4System Software
- Operating Systems (OS) Utility Tools
- User interface disk formatting
- Manage hardware file-copy
- Manage storage modem functionality
- Manage CPU data compression utilities
- Manage I/O network software
- Distinction between Utility tools and Application
software is rather vague... - A Utility software in first release can become
part of OS in the next release
5Evolution of Operating Systems
- Early programs (including data) were input in the
form of punch cards - Each programmer must have his set of punch cards
and sign up for using the computer - The computer operator submits the job (program)
in the order it was received and leaves the
printed output for the programmer - If something goes wrong, operator has no clue
about the program, and, programmer has no access
to interactively fix the program
6Batch processing
- Traditional batch processing
- is quite efficient for applications like payroll
system involving fixed or static computing
environment, - in which all data and processing decisions are
clearly established in advance - User domain separate from Machine domain
7Interactive and Real-time processing
- Interactive and dynamic computing environment
- Batch processing is highly inefficient for
applications like airline reservation need some
form of user-interface to communicate with system
as it executes - Real-time processing Time used by machine to
perform task must be compatible with user needs - Example Word-processing would be frustrating if
machine doesnt keep up with user typing
8Multi-User Environment
- Interactive, real-time processing would be ideal
for single-user environment, but, many
applications are multi-user environments - Airline reservation system would be slow and
frustrating if only one ticketing agent can make
a reservation at one time - Often, different users run different programs on
the same computer leading to a need for
handling programs in rotations and time-sharing
mode - Multitasking single-user, many programs
- Multi-user environment involves some form of
time-sharing scheme
9Points to note about early processing
- Each program inputs other instructions is
submitted as a job JCL explained how the job
should be run - User and equipment are separate job is
submitted as a batch with computer operator
physically doing the actual computer operations - A job queue FIFO decides the order of job
processing - Order of processing the jobs can be changed
physically bump up priority for a particular job - Job Control Language
- First In First Out
10User Input Format
- Yesterdays input
- Punch cards, card readers, switches
- Todays input
- Keyboard, Mouse, Microphone, scanner, camera
- Tomorrows input?
- Voice recognition, Agents? Virtual environments
(like Star Treks Holodeck)? Thought
recognition?! - Future systems need to be designed to handle such
user inputs via different user-interface
11Single-processor von Neumann machines
- Can execute more than one program without
re-wiring - Cannot execute more than one program at a time,
though i.e., simultaneously - Execution of multiple programs is via
CPU-time-sharing in the form of interleaving - Batch processing is still in use in certain
environments like nightly processing of checks in
a bank, preparing credit card statements - Todays trend is to have the machine handle as
many tasks as it can by letting the Operating
System perform most of the management and control
issues to get the tasks done.
12User environments
- Single-tasking vs. Multi-tasking
- Single-user vs. Multi-user
- Batch vs. Time-sharing
- How can we accommodate such varied functionality?
- Design a set of layered software that can
- manage processes
- manage users
- manage resources
- manage hardware
- control overall working of the machine
13Birth of Operating System
14Layered Software
- Why is OS designed as a layered software?
- It breaks a larger problem to smaller, more
manageable, subtasks - Each subtask can be implemented independently
- A layer can be replaced with a different
implementation without affecting other layers - Example Command layer can be upgraded or
modified with a different implementation without
affecting the Service layer functionality - Each layer considers the other layer as an
abstract tool
15Getting it all started
- Remember the Program Counter in BSM Simulator?
- You had to set the program counter to the cell
address where your program resides if you didnt
start at location 00 by default, else, CPU cannot
do its fetch-decode-execute cycle for that
program - How does the CPU know where to start when
switched on each time? - It is hard-wired to look for contents at a
particular pre-determined cell address every time
it is switched on - Recall that main memory is volatile meaning,
its contents are lost when power is turned off. - How can we ensure that the cell address that CPU
is hard-wired to look for in main memory retains
its contents all the time even when power is
turned off?
16Boot Strapping
- ROM A portion of main memory is constructed such
that information is permanently burned in and is
known as Read-Only Memory - The start-up program for the machine resides in
this ROM portion of memory which has the same
cell address that CPU is hard-wired to look for
when power is turned on - When CPU is turned on, it looks for this small
program at its hard-wired cell address always,
which happens to be the ROM portion of memory
that always retains its contents and cannot be
changed - The small program that is permanently stored in
ROM is called the Bootstrap. - Bootstrap programs in PCs usually instruct the
machine to load the OS from floppy first, and if
it fails load it from hard-drive.
17Bootstrapping Step1
18Bootstrapping Step 2
19So, what does an Operating System do?
- A better question is, What doesnt an OS do?
- OS acts as the interpreter between the user and
the hardware and software components of a
computer - OS also acts as a traffic police among various
software components in the computer - OS acts as a manager by controlling the devices
attached to the computer system like printer,
scanner, camera
20Operating System Components
- CPU Management
- Process Management
- Memory Management
- File Management
- I/O System Management
- Interface to the User
- Shells
- Graphical User Interface
- Persistent Storage Management
- Distributed Systems and Networks
21Functional Overview of Modern OS
22OS Terminology
- Lets understand some key OS terms
- Kernel and Shell
- Process and Program
- Scheduler and Dispatcher
- CPU Interval Timer and Time slices
- Interrupt and Interrupt Handler
- Process Administration
- Interprocess Communication
23OS Kernel and Shell
- Kernel is the core of OS consisting of software
for very basic computer functions like file
manager, memory manager and so on. - Shell is the interface between the OS and the
user. Shell interface can be textual (as in UNIX)
or graphical (as in Windows)
24Program and Process
- Program is a static set of instructions that need
to be executed to accomplish a specific task - Process the actual execution of such a program
- Process State is a snapshot of the machine at a
given instant of time, showing such information
as - Program counter value
- Data of the program the registers in use, the
memory cells pertinent to this program
25Scheduler
- Scheduler maintains a record of the processes
present in the computer system in the form of a
Process Table stored in main memory - Each time a new task is assigned to the machine,
Scheduler adds a new entry into the Process Table
corresponding to this new task storing such
information as - Memory address where the program resides
(obtained from memory manager) - Priority of the task
- Ready or waiting
26Dispatcher
- Dispatcher is the component of kernel that
ensures the actual execution of scheduled
processes - In time-sharing machines, dispatcher does this by
- Dividing CPU cycles into time slices using an
interrupt timer, - And assigning one time slice per process in turn
till the process completes and another can start
27CPU Protection The Interval Timer
- Interval Timer interrupts the CPU after specified
period to ensure operating system maintains
control. - Timer is decremented on every clock tick
- When timer reaches the value 0, an interrupt
occurs - Timer is commonly used to implement time sharing
- Timer is also used to compute the current time.
28Process Management
- A process is a program in execution. A process
needs certain resources, including CPU time,
memory, files, and I/O devices, to accomplish its
task. - The operating system is responsible for the
following activities in connection with process
management - Process creation and deletion
- Process suspension and resumption
- Provision of mechanisms for
- Process synchronization
- Process communication
29Processes Administration Time-sharing
30Handling competition among processes
- Semaphores
- Critical Region A set of instructions that can
be executed by only one process at a time - Mutual Exclusion Requirement that only one
process execute such Critical Region instructions
at any time - How to implement Mutual Exclusion?
- Use a Semaphore, as a single-instruction
Test-and-Set flag - Check for the semaphore flag GO before entering
the Critical Region set the flag to STOP as
soon as you enter re-set the flag to GO when
you exit.
31Handling Competition among processes
- Deadlock When two processes are in time-sharing
mode, each locks its resource while it is
executing. This could lead to blocking of
non-shareable resources. Example - Process A has access to printer but is waiting
for access to tape drive which is locked by
Process B - And, Process B has access to tape drive and locks
it, waiting for access to printer.
Deadlock usually can be avoided using Deadlock
Avoidance Schemes, by planning for it and
preventing such occurrences. Deadlocks that are
not avoided, can be detected and corrected
forcibly.
32Interprocess Communication
- Various processes within the OS must communicate
with each other constantly to ensure smooth and
efficient operation - One form of interprocess communication is the
Client/Server model - Each process needing attention or resource, acts
as the Client and makes it requests - The OS manager responsible for fulfilling that
request acts as the Server and serves the request.
33Memory Management
- Memory is a large array of cells containing words
or bytes, each with its own address. It holds
quickly accessible data shared by the CPU and I/O
devices. - Main memory is a volatile storage device. It
loses is contents in the case of a system
failure. - The operating system is responsible for the
following activities in connection with memory
management - Keep track of which parts of memory are currently
being used and by whom. - Decide which process to load when memory space
becomes available. - Allocate and deallocate memory space as needed.
34Persistent Storage Management
- Main memory is volatile and too small to
accommodate all data and programs permanently - Computer system must provide persistent storage
to back up main memory. - Disks are the principle on-line storage medium.
- The operating system is responsible for the
following activities in relation to disk
management - Free-space management
- Storage allocation
- Disk scheduling
35Virtual memory
- In a multi-user, multi-tasking environment, main
memory space is limited and cannot accommodate
all the programs - OS creates an illusion of larger memory
- Memory manager divides the required space into
pages and store these pages in the hard disk - As and when the next page is needed, memory
manager will exchange the new page for the old
one that is not needed anymore for program
execution - Thus programs continue to execute as though there
was no space crunch to begin with - Such an illusionary memory space is called
Virtual Memory
36File Management
- A file is a collection of related information
defined by the files creator. Files can be
collected and grouped in folders or directories - Usually, files represent programs (both source
and object forms) and data. - The operating system does the following
activities in connection with file management - File creation and deletion
- Directory creation and deletion
- Support of primitives for manipulating files and
directories - Mapping files onto persistent storage
- File backup on off-line media
37I/O System Management
- The I/O system consists of
- A buffer caching system
- A general device-driver interface
- Drivers for specific hardware devices
38User Interface
- A command shell or a window-based GUI provides
- the ability to execute application programs, and,
- convenient access to invoking systems programs.
- Shell Interface of an OS allows users to perform
- Process creation and management.
- I/O handling, monitoring, and management
- Secondary storage management
- Main memory monitoring and management
- File-system access
- Protection
- Networking
- Programming Language support
39OS Components Common Requirements
- Any reasonable OS implementation should satisfy
the following requirements - Resource Management
- Protection
- Exception Handling
- Asynchronous Operation and I/O
- Scheduling
- Concurrency
40How many kinds of OS are there?
- Too many to list here individually
- MS Windows, Apple MacOS, for single-user desktop
PCs - IBMs Vax/VM/CMS for mainframes
- Various implementations (flavors) of Unix like
Sun/Solaris, HP/UX for multi-user environments - Different OS are designed for different machine
architectures, and different groups of systems. - A Network Operating System (NOS) allows users to
share files across a network and to access shared
devices such as printers, scanners, servers and
gateways. - A desktop OS, such as Windows 2000, runs a single
computer NOS, such as Novell NetWare, controls
how groups of individual computers and other
devices communicate.
41Communicating with other devices
- CPU and Main Memory together form the Core of a
machine, which we will call the computer, or the
processor - How does the computer communicate with other
devices? - Through intermediary devices called Controllers
42Device Controllers
- Each device has its own controller by design
- In modern PCs, the controllers plug into
motherboard and connect via cables to their
devices - Each controller if often a computer in its own
right, with a CPU and memory circuitry - Controllers communicate with the processor via
dedicated controller bus or system bus - Controllers pass messages and data between their
respective devices and the processor by
converting the messages and data into forms
compatible with the main processor design
43Pictorial View Device Controllers
CPU
Cache
Processor
Printer
Network Medium
Disk
Disk
DiskController
NetworkController
PrinterController
Main Memory
System Bus
CD-drive Controller
Modem Controller
CD-drive
Modem
44Controllers DMA, Ports
- DMA Some controllers have access to system bus
and hence access to processor main memory, known
as Direct Memory Access controllers - Useful when CPU can delegate tasks to controllers
that can be performed simultaneously and
independent of CPU execution - Certain machines have special op-codes designed
for handling Controller commands, known as I/O
instructions - I/O instructions for each controller reside in
special addresses called I/O addresses, known as
Ports
45Controllers and Computer System Operation
- 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.
- CPU moves data from/to main memory to/from the
local buffers. - I/O is from the device to the local buffer of the
controller. - Device controller informs CPU that it has
finished an operation or needs attention by
causing an interrupt.
46Interruptions
- Interruption, as we saw earlier, is an event in a
computer system disrupting the normal instruction
execution flow. - An Interrupt Handler is designed to handle each
type of interruption - Interrupts can originate from various sources in
a system - From Programs, called Exception or Trap
- Synchronous with the instruction stream
- Arithmetic overflow, divide by zero, illegal
instruction, illegal memory reference, etc. - From Timer, called Interrupt
- Asynchronous
- Interval timer
- From I/O, called Interrupt
- Asynchronous
- I/O normal completion or error condition
(abnormal completion) - From Hardware Failure
47Summary
- OS is a system software designed to manage the
various components of a computer system with
kernel being its core and shell being its
interface to the user - OS Kernel has several components like memory
manager, i/o manager, file manager that perform
the appropriate functions - Bootstrapping loads the OS into processor main
memory at start-up - Process administration in time-share systems
involve scheduler, dispatcher and interrupts set
up by interval timer - Competing processes can be handled via Deadlock
detection and avoidance, or Semaphores - Device Controllers handle communication between
processor and other devices attached to the system
48Distributed Systems and Networks
- A distributed system is a collection of
processors that do not share memory or a clock.
Each processor has its own local memory. - The processors in the system are connected
through a communication network. - A distributed system provides user access to
various system resources. - Access to a shared resource allows
- Computation speed-up
- Potential for increased data availability
- Potential for enhanced reliability