1. UNIT-1
INTRODUCTION TO OPERATING
SYSTEM
BY:
• Dr. R. C. Tripathi
• Professor, FOECS, TMU &
• Chairman CSI-NOIDA CHAPTER
• Mobile: +91-9868257510,
• Email: tripathi.computers@tmu.ac.in
• visit us at: http://tmu.ac.in/college-of-computing-sciences-and-it/about/our-faculty/
• http://www.csi-india.org/web/noida-chapter/management-committee
UT-1 OS Intro_DrRCTripathi 1
2. UT-1 OS Intro_DrRCTripathi 2
Learning Objectives
After completing this chapter, you should be able to
describe:
• Innovations in operating systems development
• The basic role of an operating system
• The major operating system software subsystem
managers and their functions
• The types of machine hardware on which operating
systems run
3. UT-1 OS Intro_DrRCTripathi 3
Learning Objectives (cont'd.)
• The differences among batch, interactive, real-time,
hybrid, and embedded operating systems
• Multiprocessing and its impact on the evolution of
operating system software
• Virtualization and core architecture trends in new
operating systems
4. UT-1 OS Intro_DrRCTripathi 4
Introduction to Operating systems
Manages computer system hardware and software
• A program that runs on the “raw” hardware and supports
– Resource Abstraction
– Resource Sharing
• Abstracts and standardizes the interface to the user across
different types of hardware
– Virtual machine hides the messy details which must be performed
– Each program gets time with the resource
– Each program gets space on the resource
• May have potentially conflicting goals:
– Use hardware efficiently
– Give maximum performance to each user
5. UT-1 OS Intro_DrRCTripathi
Introduction to Operating systems
• Computer System
– Software (programs)
– Hardware (physical machine and electronic
components)
• Operating System
– Part of computer system (software)
– Manages all hardware and software
• Controls every file, device, section of main memory
and nanosecond of processing time
• Controls who can use the system
• Controls how system is used
5
7. Introduction to Operating systems
• An OS is a program which acts as an interface
between computer system users and the computer
hardware.
• It provides a user-friendly environment in which a
user may easily develop and execute programs.
• Otherwise, hardware knowledge would be
mandatory for computer programming.
• So, it can be said that an OS hides the complexity
of hardware from uninterested users.
UT-1 OS Intro_DrRCTripathi 7
8. UT-1 OS Intro_DrRCTripathi 8
Brief History of Operating Systems
Development
• 1940s: first generation
– Computers based on vacuum tube technology
– No standard operating system software
– Typical program included every instruction needed
by the computer to perform the tasks requested
– Poor machine utilization
• CPU processed data and performed calculations for
fraction of available time
– Early programs
• Designed to use the resources conservatively
• Understandability is not a priority
9. UT-1 OS Intro_DrRCTripathi 9
Brief History of Operating Systems
Development (cont'd.)
• 1950s: second generation
– Focused on cost effectiveness
– Computers were expensive
• IBM 7094: $200,000
– Two widely adopted improvements
• Computer operators: humans hired to facilitate
machine operation
• Concept of job scheduling: group together programs
with similar requirements
– Expensive time lags between CPU and I/O devices
10. UT-1 OS Intro_DrRCTripathi 10
Brief History of Operating Systems
Development (cont'd.)
• 1950s: second generation (cont'd.)
– I/O device speed gradually became faster
• Tape drives, disks, and drums
– Records blocked before retrieval or storage
– Access methods developed
• Added to object code by linkage editor
– Buffer between I/O and CPU introduced
• Reduced speed discrepancy
– Timer interrupts developed
• Allowed job-sharing
11. UT-1 OS Intro_DrRCTripathi 11
Brief History of Operating Systems
Development (cont'd.)
• 1960s: third generation
– Faster CPUs
– Speed caused problems with slower I/O devices
– Multiprogramming
• Allowed loading many programs at one time
– Program scheduling
• Initiated with second-generation systems
• Continues today
– Few advances in data management
– Total operating system customization
• Suit user’s needs
12. UT-1 OS Intro_DrRCTripathi 12
Brief History of Operating Systems
Development (cont'd.)
• 1970s
– Faster CPUs
– Speed caused problems with slower I/O devices
– Main memory physical capacity limitations
• Multiprogramming schemes used to increase CPU
• Virtual memory developed to solve physical limitation
– Database management software
• Became a popular tool
– A number of query systems introduced
– Programs started using English-like words, modular
structures, and standard operations
13. UT-1 OS Intro_DrRCTripathi 13
Brief History of Operating Systems
Development (cont'd.)
• 1980s
– Cost/performance ratio improvement of computer
components
– More flexible hardware (firmware)
– Multiprocessing
• Allowed parallel program execution
– Evolution of personal computers
– Evolution of high-speed communications
– Distributed processing and networked systems
introduced
14. UT-1 OS Intro_DrRCTripathi 14
Brief History of Operating Systems
Development (cont'd.)
• 1990s
– Demand for Internet capability
• Sparked proliferation of networking capability
• Increased networking
• Increased tighter security demands to protect
hardware and software
– Multimedia applications
• Demanding additional power, flexibility, and device
compatibility for most operating systems
15. History of Operating Systems
• Fifth Generation (Sometime in the future)
• What will constitute a fifth
generation computer?
15
UT-1 OS Intro_DrRCTripathi
16. History of Operating Systems
• Fifth Generation (Sometime in the future)
– Computer generations were influenced by new
hardware (vacuum tubes, transistors, integrated
circuits and LSI).
– Fifth generation may break with that tradition
– One view is that a fifth generation computer will
interact with humans in a way that is natural to us
Computers will be able to reason in a way that imitates
humans
– Being able to accept (and understand!) the spoken
word and carry out reasoning is complex, requiring
advances in software and maybe hardware
16
UT-1 OS Intro_DrRCTripathi
17. History of Operating Systems
• Fifth Generation (Sometime in the future)
• What advances will have to
be made to allow a fifth
generation computer to be
realised?
17
UT-1 OS Intro_DrRCTripathi
18. History of Operating Systems
• Fifth Generation (Sometime in the future)
– Advances will be needed in AI including NLP
– May be need parallel processing
– May be a non-silicon computer
– The first time a generation has not been motivated
by advances in hardware
18
UT-1 OS Intro_DrRCTripathi
19. UT-1 OS Intro_DrRCTripathi 19
Brief History of Operating Systems
Development (cont'd.)
• 2000s
– Primary design features support:
• Multimedia applications
• Internet and Web access
• Client/server computing
– Computer systems requirements
• Increased CPU speed
• High-speed network attachments
• Increased number and variety of storage devices
– Virtualization
• Single server supports different operating systems
20. UT-1 OS Intro_DrRCTripathi 20
A Brief History of Machine Hardware
• Hardware: physical machine and electronic
components
– Main memory (RAM)
• Data/Instruction storage and execution
– Input/Output devices (I/O devices)
• All peripheral devices in system
• Printers, disk drives, CD/DVD drives, flash memory,
and keyboards
– Central processing unit (CPU)
• Controls interpretation and execution of instructions
• Controls operation of computer system
22. UT-1 OS Intro_DrRCTripathi 22
A Brief History of Machine
Hardware (cont'd.)
• Computer classification
– By capacity and price (until mid-1970s)
• Mainframe
– Large machine
• Physical size and internal memory capacity
– Classic Example: 1964 IBM 360 model 30
• CPU required 18-square-foot air-conditioned room
• CPU size: 5 feet high x 6 feet wide
• Internal memory: 64K
• Price: $200,000 (1964 dollars)
– Applications limited to large computer centers
23. UT-1 OS Intro_DrRCTripathi 23
A Brief History of Machine
Hardware (cont'd.)
• Minicomputer
– Developed for smaller institutions
– Compared to mainframe
– Smaller in size and memory capacity
• Cheaper
– Example: Digital Equipment Corp. minicomputer
• Price: less than $18,000
– Today
• Known as midrange computers
• Capacity between microcomputers and mainframes
24. UT-1 OS Intro_DrRCTripathi 24
A Brief History of Machine
Hardware (cont'd.)
• Supercomputer
– Massive machine
– Developed for military operations and weather
forecasting
– Example: Cray supercomputer
• 6 to 1000 processors
• Performs up to 2.4 trillion floating-point operations per
second (teraflops)
– Uses:
• Scientific research
• Customer support/product development
25. UT-1 OS Intro_DrRCTripathi 25
A Brief History of Machine
Hardware (cont'd.)
• Microcomputer
– Developed for single users in the late 1970s
– Example: microcomputers by Tandy Corporation and
Apple Computer, Inc.
• Very little memory (by today’s standards)
• 64K maximum capacity
– Microcomputer’s distinguishing characteristic
• Single-user status
26. UT-1 OS Intro_DrRCTripathi 26
A Brief History of Machine
Hardware (cont'd.)
• Workstations
– Most powerful microcomputers
– Developed for commercial, educational, and
government enterprises
– Networked together
– Support engineering and technical users
• Massive mathematical computations
• Computer-aided design (CAD)
– Applications
• Requiring powerful CPUs, large main memory, and
extremely high-resolution graphic displays
27. UT-1 OS Intro_DrRCTripathi 27
A Brief History of Machine
Hardware (cont'd.)
• Servers
– Provide specialized services
• To other computers or client/server networks
– Perform critical network task
– Examples:
• Print servers
• Internet servers
• Mail servers
28. UT-1 OS Intro_DrRCTripathi 28
A Brief History of Machine
Hardware (cont'd.)
• Advances in computer technology
– Dramatic changes
• Physical size, cost, and memory capacity
– Networking
• Integral part of modern computer systems
– Mobile society information delivery
• Creating strong market for handheld devices
– New classification
• By processor capacity, not memory capacity
– Moore’s Law
• Computing power rises exponentially
30. UT-1 OS Intro_DrRCTripathi 30
Types of Operating Systems
• Five categories
– Batch
– Interactive
– Real-time
– Hybrid
– Embedded
• Two distinguishing features
– Response time
– How data enters into the system
31. UT-1 OS Intro_DrRCTripathi 31
Types of Operating Systems
(cont'd.)
• Batch Systems
– Input relied on punched cards or tape
– Efficiency measured in throughput
• Interactive Systems
– Faster turnaround than batch systems
– Slower than real-time systems
– Introduced to provide fast turnaround when
debugging programs
– Time-sharing software developed for operating
system
32. UT-1 OS Intro_DrRCTripathi 32
Types of Operating Systems
(cont'd.)
• Real-time systems
– Reliability is key
– Fast and time limit sensitive
– Used in time-critical environments
• Space flights, airport traffic control, high-speed aircraft
• Industrial processes
• Sophisticated medical equipment
• Distribution of electricity
• Telephone switching
– Must be 100% responsive, 100% of the time
33. UT-1 OS Intro_DrRCTripathi 33
Spooling
• Original batch systems used tape drives
• Later batch systems used disks for buffering
– Operator read cards onto disk attached to the computer
– Computer read jobs from disk
– Computer wrote job results to disk
– Operator directed that job results be printed from disk
• Disks enabled simultaneous peripheral operation on-
line (spooling)
– Computer overlapped I/O of one job with execution of
another
– Better utilization of the expensive CPU
– Still only one job active at any given time
34. 34
Spooling
• Disks were much faster than card readers and
printers
• Spool (Simultaneous Peripheral Operations On-Line)
– while one job is executing, spool next job from card reader
onto disk
• slow card reader I/O is overlapped with CPU
– can even spool multiple programs onto disk/drum
• OS must choose which to run next
• job scheduling
– but, CPU still idle when a program interacts with a peripheral
during execution
– buffering, double-buffering
UT-1 OS Intro_DrRCTripathi
35. 35
Multiprogramming
• To increase system utilization, multiprogramming
OSs were invented
– keeps multiple runnable jobs loaded in memory at once
– overlaps I/O of a job with computing of another
• while one job waits for I/O completion, OS runs instructions
from another job
– to benefit, need asynchronous I/O devices
• need some way to know when devices are done
– interrupts
– polling
– goal: optimize system throughput
• perhaps at the cost of response time…
UT-1 OS Intro_DrRCTripathi
36. UT-1 OS Intro_DrRCTripathi 36
Timesharing
• Multiprogramming allowed several jobs to be active
at one time
– Initially used for batch systems
– Cheaper hardware terminals -> interactive use
• Computer use got much cheaper and easier
– No more “priesthood”
– Quick turnaround meant quick fixes for problems
37. 37
Timesharing
• To support interactive use, create a timesharing OS:
– multiple terminals into one machine
– each user has illusion of entire machine to
him/herself
– optimize response time, perhaps at the cost of
throughput
• Timeslicing
– divide CPU equally among the users
– if job is truly interactive (e.g., editor), then can jump
between programs and users faster than users can
generate load
– permits users to interactively view, edit, debug
running programs (why does this matter?)
UT-1 OS Intro_DrRCTripathi
38. 38
• MIT CTSS system (operational 1961) was among the
first timesharing systems
– only one user memory-resident at a time (32KB memory!)
• MIT Multics system (operational 1968) was the first
large timeshared system
– nearly all OS concepts can be traced back to Multics!
– “second system syndrome”
UT-1 OS Intro_DrRCTripathi
39. UT-1 OS Intro_DrRCTripathi 39
Types of modern operating systems
• Mainframe operating systems: MVS
• Server operating systems: FreeBSD, Solaris
• Multiprocessor operating systems: Cellular IRIX
• Personal computer operating systems: Windows,
Unix
• Real-time operating systems: VxWorks
• Embedded operating systems
• Smart card operating systems
Some operating systems can fit into more than one
category
40. 40
Parallel systems
• Some applications can be written as multiple
parallel threads or processes
– can speed up the execution by running multiple
threads/processes simultaneously on multiple
CPUs [Burroughs D825, 1962]
– need OS and language primitives for dividing
program into multiple parallel activities
– need OS primitives for fast communication
among activities
• degree of speedup dictated by
communication/computation ratio
UT-1 OS Intro_DrRCTripathi
41. 41
Personal computing
• Primary goal was to enable new kinds of applications
• Bit mapped display [Xerox Alto,1973]
– new classes of applications
– new input device (the mouse)
• Move computing near the display
– why?
• Window systems
– the display as a managed resource
• Local area networks [Ethernet]
– why?
• Effect on OS?
UT-1 OS Intro_DrRCTripathi
42. 42
Distributed OS
• Distributed systems to facilitate use of geographically
distributed resources
– workstations on a LAN
– servers across the Internet
• Supports communications between programs
– interprocess communication
• message passing, shared memory
– networking stacks
• Sharing of distributed resources (hardware, software)
– load balancing, authentication and access control, …
• Speedup isn’t the issue
– access to diversity of resources is goal
UT-1 OS Intro_DrRCTripathi
43. 43
Client/server computing
• Mail server/service
• File server/service
• Print server/service
• Compute server/service
• Game server/service
• Music server/service
• Web server/service
• etc.
UT-1 OS Intro_DrRCTripathi
44. 44
Peer-to-peer (p2p) systems
• Napster
• Gnutella
– example technical challenge: self-organizing overlay
network
– technical advantage of Gnutella?
– er … legal advantage of Gnutella?
UT-1 OS Intro_DrRCTripathi
45. 45
Embedded/mobile/pervasive
computing
• Pervasive computing
– cheap processors embedded everywhere
– how many are on your body now? in your car?
– cell phones, PDAs, network computers, …
• Typically very constrained hardware resources
– slow processors
– very small amount of memory (e.g., 8 MB)
– no disk
– typically only one dedicated application
– limited power
• But this is changing rapidly!
UT-1 OS Intro_DrRCTripathi
46. UT-1 OS Intro_DrRCTripathi 46
Processes
• Process: program in execution
– Address space (memory) the program
can use
– State (registers, including program
counter & stack pointer)
• OS keeps track of all processes in a
process table
• Processes can create other processes
– Process tree tracks these relationships
– A is the root of the tree
– A created three child processes: B, C,
and D
– C created two child processes: E and F
– D created one child process: G
A
B
E F
C D
G
47. UT-1 OS Intro_DrRCTripathi 47
Inside a (Unix) process
• Processes have three segments
– Text: program code
– Data: program data
• Statically declared
variables
• Areas allocated by
malloc() or new
– Stack
• Automatic variables
• Procedure call information
• Address space growth
– Text: doesn’t grow
– Data: grows “up”
– Stack: grows “down”
Stack
Data
Text
0x7fffffff
0
Data
49. UT-1 OS Intro_DrRCTripathi 49
Root directory
bin cse
faculty grads
ls ps cp csh
Hierarchical file systems
elm sbrandt kag amer4
stuff
classes research
stuff
50. UT-1 OS Intro_DrRCTripathi 50
Interprocess communication
• Processes want to exchange information with each
other
• Many ways to do this, including
– Network
– Pipe (special file): A writes into pipe, and B reads from it
A B
51. UT-1 OS Intro_DrRCTripathi 51
System calls
• Programs want the OS to perform a service
– Access a file
– Create a process
– Others…
• Accomplished by system call
– Program passes relevant information to OS
– OS performs the service if
• The OS is able to do so
• The service is permitted for this program at this time
– OS checks information passed to make sure it’s OK
• Don’t want programs reading data into other programs’
memory!
52. UT-1 OS Intro_DrRCTripathi 52
Making a system call
• System call:
read(fd,buffer,length)
• Program pushes
arguments, calls library
• Library sets up trap, calls
OS
• OS handles system call
• Control returns to library
• Library returns to user
program
Return to caller
Trap to kernel
Trap code in register
Increment SP
Call read
Push arguments
Dispatch
Sys call
handler
Kernel
space
(OS)
User
space
0
0xffffffff
1
2
3
4
5 6
7
8
9
Library
(read call)
User
code
53. UT-1 OS Intro_DrRCTripathi 53
System calls for files & directories
Call Description
fd = open(name,how) Open a file for reading and/or writing
s = close(fd) Close an open file
n = read(fd,buffer,size) Read data from a file into a buffer
n = write(fd,buffer,size) Write data from a buffer into a file
s = lseek(fd,offset,whence) Move the “current” pointer for a file
s = stat(name,&buffer) Get a file’s status information (in buffer)
s = mkdir(name,mode) Create a new directory
s = rmdir(name) Remove a directory (must be empty)
s = link(name1,name2) Create a new entry (name2) that points to the
same object as name1
s = unlink(name) Remove name as a link to an object (deletes
the object if name was the only link to it)
54. UT-1 OS Intro_DrRCTripathi 54
Call Description
pid = fork() Create a child process identical to the
parent
pid=waitpid(pid,&statloc,options) Wait for a child to terminate
s = execve(name,argv,environp) Replace a process’ core image
exit(status) Terminate process execution and return
status
s = chdir(dirname) Change the working directory
s = chmod(name,mode) Change a file’s protection bits
s = kill(pid,signal) Send a signal to a process
seconds = time(&seconds) Get the elapsed time since 1 Jan 1970
More system calls
55. UT-1 OS Intro_DrRCTripathi 55
A simple shell
while (TRUE) { /* repeat forever */
type_prompt( ); /* display prompt */
read_command (command, parameters) /* input from terminal */
if (fork() != 0) { /* fork off child process */
/* Parent code */
waitpid( -1, &status, 0); /* wait for child to exit */
} else {
/* Child code */
execve (command, parameters, 0); /* execute command */
}
}
57. Virtual Machines (VM)
Virtualization technology enables a single PC or server to
simultaneously run multiple operating systems or multiple sessions of
a single OS
A machine with virtualization software can host numerous applications,
including those that run on different operating systems, on a single
platform
The host operating system can support a number of virtual machines,
each
of which has the characteristics of a particular OS
The solution that enables virtualization is a virtual machine monitor
(VMM),
or hypervisor
57
UT-1 OS Intro_DrRCTripathi
58. Figure 14.1 Virtual Machine Concept
Virtual Machine Manager
Shared Hardware
Virtual
Machine 1
Virtual
Machine 2
Virtual
Machine n
Applications
and
Processes
Applications
and
Processes
Applications
and
Processes
Figure Virtual Machine Concept
58
UT-1 OS Intro_DrRCTripathi
59. Figure Virtual Machine Consolidation
Physical
servers
Virtualization
host
6:1 consolidation ratio
V
M
59
UT-1 OS Intro_DrRCTripathi
60. Approaches to
Virtualization
A Virtual Machine is a software construct
that mimics the characteristics of a
physical server
it is configured with
some number of
processors, some
amount of RAM,
storage resources,
and connectivity
through the network
ports
once the VM is
created it can be
powered on like a
physical server,
loaded with an
operating system and
software solutions,
and utilized in the
manner of a physical
server
unlike a physical
server, this virtual
server only sees the
resources it has
been configured
with, not all of the
resources of the
physical host itself
the hypervisor
facilitates the
translation and I/O
from the virtual
machine to the
physical server
devices and back
again to the correct
virtual machine
60
UT-1 OS Intro_DrRCTripathi
61. Virtual Machine Files
configuration file
describes the
attributes of the
virtual machine
Virtual machines are made
up of files:
it contains the server
definition, how many
virtual processors
(vCPUs) are allocated
to this virtual machine,
how much RAM is
allocated, which I/O
devices the VM has
access to, how many
network interface cards
(NICs) are in the virtual
server, and more
it also describes the
storage that the VM
can access
when a virtual
machine is powered
on, or instantiated,
additional files are
created for logging,
for memory paging,
and other functions
since VMs are already
files, copying them
produces not only a
backup of the data but
also a copy of the
entire server,
including the
operating system,
applications, and the
hardware configuration
itself
61
UT-1 OS Intro_DrRCTripathi
62. Virtual Machine Files
configuration file
describes the
attributes of the
virtual machine
Virtual machines are made
up of files:
it contains the server
definition, how many
virtual processors
(vCPUs) are allocated
to this virtual machine,
how much RAM is
allocated, which I/O
devices the VM has
access to, how many
network interface cards
(NICs) are in the virtual
server, and more
it also describes the
storage that the VM
can access
when a virtual
machine is powered
on, or instantiated,
additional files are
created for logging,
for memory paging,
and other functions
since VMs are already
files, copying them
produces not only a
backup of the data but
also a copy of the
entire server,
including the
operating system,
applications, and the
hardware configuration
itself
62
UT-1 OS Intro_DrRCTripathi
63. (a) Type 1 VMM
Applications Applications
OS 1 OS 2
Virtual Machine 1 Virtual Machine 2
Virtual Machine Monitor
Shared Hardware
Applications Applications
OS 1 OS 2
Virtual Machine 1 Virtual Machine 2
Virtual Machine Monitor
Host Operating System
Shared Hardware
(a) Type 2 VMM
Figure 14.3 Type 1 and Type 2 Virtual Machine Monitors
(a) Type 2 VMM
Figure Type 1 and Type 2 Virtual Machine Monitors 63
UT-1 OS Intro_DrRCTripathi