Introduction To The Operating Systems PP
Introduction To The Operating Systems PP
L T JayPrakash
Every Wed @ 9.30 am, Thu @ 9.30 am.
Lecture Dates – Oct (15,18,22,23,29,30), Nov
(5,6,12,13,19,20,26,27), Dec (3,4) – 16 sessions.
Final Exam Date – Week of Dec 8, 2014.
For course related queries – After the lecture, or
meet me in my office (room number 110).
Course Outline
Focus to be core topics in OS.
– Few other topics through papers / presentation.
Half the course credit will be for homework / quizzes /
assignments / programming exercises, and half on the
end-term exams.
Programming Credits
− Half of the credit will be based on individual effort, and
− Half on the success — or lack thereof – of the overall
team effort, in case it is a team exercise.
There may be a one / two surprise quizzes in the next
seven / eight weeks of the remaining semester.
Term paper : Search – Register - Study – Report – Submit.
LMS
Handouts, announcements, etc., are posted
there, and the page will be updated throughout
the semester.
It will be presumed that each one of you will
access LMS frequently.
In case of any problems with LMS, email will be
the alternative mechanism.
Syllabus
There are numerous good sources of information for study, but no single
textbook may be sufficient due to the evolving nature of the subject.
I do not mandate a particular textbook on operating systems -- there are many
possible alternatives, all of which are reasonable, none of which may cover all.
I recommend coming to class and be a part of class discussions.
– Key criteria for attending tests / end-semester examinations.
Read the book in background (e.g., after we cover a topic in class), both to fill in
your knowledge, as well as to get a different perspective on operating systems.
Any of these books are fine:
− Andrew Tanenbaum - "Modern Operating Systems"
− Silberschatz, Galvin - "Operating System Concepts"
Others may be fine too – that you may decide as well.
15
15
OS as Resource Manager
16
16
Layers and Views
17
17
Layered Architecture Design
Typical OS structure
− Application environment - shell, mail, text processing package, sccs
− Operating system - support programs for applications
A microinstruction program that controls the functions of a central processing unit or
peripheral controller of a computer.
A set of microinstructions that defines the individual operations that a computer carries
out in response to a machine-language instruction.
..... many more definitions published and available in different literature.
Zooming into the OS Layer
Programs and Processes
21
21
1945 - 1955
Bare machines - vacuum tubes and plugboards
Early Systems No operating system, No protection
Black box concept - human operator
ENIAC - Electronic Numerical Integrator And Computer
Second
Generation
Third
Fourth Generation and beyond
Generation
1945 - 1955
Bare machines - vacuum tubes and plugboards
Early Systems No operating system, No protection
Black box concept - human operator
ENIAC - Electronic Numerical Integrator And Computer
1956 - 1965
Second Transistors and batch systems
Clear distinction between designer, builders, operators,
Generation Programmers, and maintenance personnel
I/O channel
Read ahead / spooling,Interrupts / exceptions
Minimal protection, Libraries / JCL
Third
Fourth Generation and beyond
Generation
1965 - 1980
ICs and Multiprogramming
System 360 and S/370 family of computers
Spooling (simultaneous peripheral operation on-line)
Early Systems
Time sharing
On-line storage for - system programs, user programs/data, and libraries.
Virtual memory
Multiprocessor configurations
MULTICS - Multiplexed Information and Computing Service
Second
Design started in 1965 and completed in 1972
Generation
Collaborative effort between GE, Bell Labs, and Project MAC of MIT
Aimed at providing - simultaneous computer access to large community
of users, ample computation power and data storage,
easy data sharing between users, if desired
Third
Fourth Generation and beyond
Generation
Personal computers and workstations
MS-DOS and Unix
Early Systems
Massively parallel systems
Pipelining
Array processing / SIMD
Multiprocessing / MIMD
Symmetric multiprocessing
Any process and any thread can run on any available processor
Second
Computer networks (communication aspect) - network operating systems
Generation
Distributed computing - distributed operating systems
Third
Fourth Generation and beyond
Generation
Uniprogramming
• Processor must wait for I/O instruction to
complete before preceding
31
31
Multiprogramming
• When one job needs to wait for I/O, the
processor can switch to the other job
33
33
OS Concepts
Kernel
Permanently resides in the main memory
Controls the execution of processes by allowing their
creation, termination or suspension, and commn.
Schedules processes fairly for execution on the CPU
Allocates main memory for an executing process
File system maintenance
Allows processes controlled access to peripheral
devices such as terminals, tape drives, disk drives, and
network devices.
Design options – Monolithic kernels, Layered, Micro
kernels.
OS Concepts
• Processes share the CPU in a time-shared manner
– CPU executes a process
– Kernel suspends it when its time quantum elapses
– Kernel schedules another process to execute
Kernel – Kernel later reschedules the suspended process
Permanently resides in the main memory
Controls the execution of processes by allowing their
creation, termination or suspension, and commn.
Schedules processes fairly for execution on the CPU
Allocates main memory for an executing process
File system maintenance
Allows processes controlled access to peripheral
devices such as terminals, tape drives, disk drives, and
network devices.
Design options – Monolithic kernels, Layered, Micro
kernels.
OS Concepts
Kernel
Allows processes to share portions of their address space under certain conditions,
but protects the private address space of a process from outside tampering
If system runsPermanently resides infrees
thememory
main by memory
low on free memory, the kernel writing a process temporarily
to secondary memory, or swap device
Controls
If kernel writes the execution
entire processes of processes
to a swap device, by allowing
then the implementation their
is called a
creation,
swapping system; termination
if it writes pages of memoryortosuspension,
a swap device, it and commn.
is called a paging system.
Coordinates with the machine hardware to set up a virtual to physical address that maps
Schedules processes
the compiler generated fairly
addresses for physical
to their execution on the CPU
addresses
Allocates main memory for an executing process
File system maintenance
Allows processes controlled access to peripheral
devices such as terminals, tape drives, disk drives, and
network devices.
Design options – Monolithic kernels, Layered, Micro
kernels.
OS Concepts
Allocates secondary memory
Kernel for efficient storage and
retrieval of user data
Permanently resides in the main memory
Allocates secondary storage for
Controls the execution of processes by allowing
user files their
creation, termination or suspension,Reclaims
and commn.
unused storage
Schedules processes fairly for execution
Structureson
thethe CPU
file system
in a well understood manner
Allocates main memory for an executing process
Protects user files from
File system maintenance illegal access
Allows processes controlled access to peripheral
devices such as terminals, tape drives, disk drives, and
network devices.
Design options – Monolithic kernels, Layered, Micro
kernels.
OS Concepts - Program
Program
Collection of source code instructions and any
associated data kept in a disk file
Source program, or a human-readable text file.
Machine language translation of the source
program, or object file
• The file is marked as executable.
• File contents are arranged according to rules
established by the kernel
Executable program, complete code output by linker /
loader, with input from libraries
Example of Program Execution
40
40
Instruction Execution
• A program consists of a set of instructions
stored in memory
• Two steps
– Processor reads (fetches) instructions from
memory
– Processor executes each instruction
41
41
OS Concepts – Process / Threads
Created by kernel as an environment in which program executes.
Program in execution
May be stopped and later restarted by the OS – How?
Program's core image (sometimes core means pri. memory)
Segments – Instruction seg., User data seg., and sys. data
System data segment
Includes attributes such as current directory, open ile
descriptors, and accumulated CPU times
Information stays outside of the process address space
Process id
Process may acquire resources (more memory, open ile) not
present in the program – Who? How?
Child and parent processes – When? How?
Communication between processes through messages – How?
Thread
Stream of instruction execution
Dispatchable unit of work to provide intraprocess concurrency in OSs.
Process may have multiple threads of execution in parallel, each thread
executing sequentially.
OS Concepts
Memory (Volatility)
– Memory hierarchy based on storage capacity, speed, and cost
– Higher the storage capacity, lesser the speed, and lesser the cost
– Different memory levels, in decreasing cost per byte of storage
– Use hierarchical memory to transfer data from lower memory to
higher memory to be executed
– Locality of reference
• Most of the references in the memory are clustered and move from one
cluster to the next
– Cache memory
• Use of very fast memory (a few kilobytes) designated to contain data for
fast access by the CPU
– Virtual memory or extension of main memory
– Disk cache
• Data-intensive applications (generally rotational speed and seek time)
OS Concepts
Memory (Volatility)
– Memory hierarchy based on storage capacity, speed, and cost
– Higher the storage capacity, lesser the speed, and lesser the cost
– Different memory levels, in decreasing cost per byte of storage
– Use hierarchical memory to transfer data from lower memory to
higher memory to be executed
– Locality of reference
• Most of the references in the memory are clustered and move from one
cluster to the next
– Cache memory
• Use of very fast memory (a few kilobytes) designated to contain data for
fast access by the CPU
– Virtual memory or extension of main memory
– Disk cache
• Data-intensive applications (generally rotational speed and seek time)
OS Concepts
Memory (Volatility)
A disk cache is a mechanism for improving the time
– Memory hierarchy based on storage capacity, speed, and cost
it takes to read from or write to a hard disk.
– Higher the storage capacity, lesser the speed, and lesser the cost
Today, the disk cache is usually included as part of the hard disk.
– Different memory levels,
(A disk cachein isdecreasing cost
RAM built into perhard
your bytedisk)
of storage
(Disk specifications : on-board cache)
– Use hierarchical memory to transfer OR data from lower memory to
higher memory
A disk cache to
canbe executed
also be a specified portion of system RAM (disk buffer).
– Locality of reference
Disk cache holds data that has recently been read and, in
some cases, adjacent data areas that are likely to be accessed next.
• Most of the references in the memory are clustered and move from one
cluster to the next
Write caching (accumulated) is also provided with some disk caches.
– Cache memory
• Use of very fast memory (a few kilobytes) designated to contain data for
fast access by the CPU
– Virtual memory or extension of main memory
– Disk cache
• Data-intensive applications (generally rotational speed and seek time)
OS Concepts – System Calls
Interface between user program and operating system - Set of extended instructions
provided by the operating system
Applied to various software objects like processes and files
Invoked by user programs to communicate with the kernel and request
services
Access routines in the kernel that do the work
Library procedure corresponding to each system call
Why modes?
Privileges?
- indicates power for
System control
47
47
Flow of Control w/o Interrupts and I/O Wait
Figure 1
50
50
Flow of Control with Interrupts and I/O Wait
Figure 2
51
51
Transfer of Control via Interrupts
52
52
Instruction Cycle
with Interrupts
53
53
Simple Interrupt Processing
54
54
Changes in Memory and Registers
for an Interrupt
55
55
Assignment 1
Assignment Objective:
Understanding How a Program really runs?
Assignment 1 ...cont'd
Conduct a simple experiment in which you take some action on a computer
system and observe what the response is. You can choose any action you
wish and any computer system for which you have appropriate access. You
can either observe a quantitative result, such as how long the response
takes or how much output is produced, or a qualitative result, such as in
what form the response arrives. Now, try replicating the experiment. Do
you always get the same result? Similar ones? Are there any factors
that need to be controlled in order to get results that are at least
approximately repeatable? For example, to get consistent times, do you
need to reboot the system between each trial and prevent other people /
programs from using the system? To get consistent output, do you need to
make sure input files are kept unchanged? If your action involves a
physical device, such as a printer, do you have to control variables such as
whether the printer is stocked with paper?
Finally, write up a careful report, in which you explain both what experiment
you tried and what results you observed. You should explain how
repeatable the results proved to be and what limits there were on the
repeatability. You should describe the hardware and software
configuration in enough detail that someone else could replicate your
experiment and would be likely to get similar results.
Submission Instructions