overview of operating system -...
TRANSCRIPT
OVERVIEW OF
OPERATING SYSTEM Slides by: Ms. Shree Jaswal
OS_chp1
Slides by: Ms. Shree Jaswal 1
Topics to be covered:
• Operating system objectives and functions, Evolution of
OS, Characteristics of modern OS,
• Basic concepts: Processes, Files, System calls, Shell,
• Kernel architectures: Monolithic, Micro-kernel, Layered,
• Kernel mode of operations
OS_chp1
Slides by: Ms. Shree Jaswal 2
What is an Operating System?
• A program that acts as an intermediary between a user of
a computer and the computer hardware.
• Operating system goals:
• Execute user programs and make solving user problems
easier.
• Make the computer system convenient to use.
• Use the computer hardware in an efficient manner.
OS_chp1
Slides by: Ms. Shree Jaswal 3
The Operating System as an Extended
Machine
OS_chp1
Slides by: Ms. Shree Jaswal 4
Operating systems turn ugly hardware into beautiful abstractions.
Computer System Structure
• Computer system can be divided into four components • Hardware – provides basic computing resources
• CPU, memory, I/O devices
• Operating system
• Controls and coordinates use of hardware among various applications and users
• Application programs – define the ways in which the system resources are used to solve the computing problems of the users
• Word processors, compilers, web browsers, database systems, video games
• Users
• People, machines, other computers
OS_chp1
Slides by: Ms. Shree Jaswal 5
Layers and Views
OS_chp1
Slides by: Ms. Shree Jaswal 6
Services Provided by the OS
• Program execution
• Access I/O devices
• Controlled access to files
• System access
OS_chp1
Slides by: Ms. Shree Jaswal 7
Services Provided by the OS
• Error detection and response
• Internal and external hardware errors
• Software errors such as arithmetic overflow and inability to grant
request of an application
• Accounting
• Collect usage statistics
• Monitor performance
• Used to anticipate future enhancements
• Used for billing purposes
OS_chp1
Slides by: Ms. Shree Jaswal 8
Operating System as a Resource Manager
• Responsible for managing resources
• Functions same way as ordinary computer software
• It is a program that is executed by the processor
• Operating system frequently relinquishes control and
must depend on the processor to allow it to regain control
OS_chp1
Slides by: Ms. Shree Jaswal 9
OS as Resource Manager
OS_chp1
Slides by: Ms. Shree Jaswal 10
Kernel
• Portion of operating system that is in main memory
• Contains most frequently used functions in the OS and at
a given time other portions of the OS currently in use.
OS_chp1
Slides by: Ms. Shree Jaswal 11
Evolution of Operating Systems
• Reasons for evolution of OS are:
• Hardware upgrades plus new types of hardware
• Device drivers
• New services
• Fixes
• Mostly: security fixes!
OS_chp1
Slides by: Ms. Shree Jaswal 12
EVOLUTION OF OPERATING
SYSTEMS
… a bit of history…
OS_chp1
Slides by: Ms. Shree Jaswal 13
Evolution of Operating Systems
1 - Serial processing systems
• They are called so due to the fact that users have access to the
computer in series.
• No operating system
• Machines run from a console with display lights, toggle switches,
input device, and printer
• Programs in machine code were loaded via the input device (eg. A
card reader)
OS_chp1
Slides by: Ms. Shree Jaswal 14
OS_chp1
Slides by: Ms. Shree Jaswal 15
Example of card: Bell Telephone
Laboratories GE 600
OS_chp1
Slides by: Ms. Shree Jaswal 16
This card, probably designed in October 1965 (judging by the notation
"10-65" printed on the left edge), was printed for use with the GE 600
series computers at Bell Labs.
Evolution of Operating Systems
• These early systems presented 2 main problems:
• Scheduling: most installations used a hard copy sign-up sheet to
reserve machine time.
• Setup time: Setup included loading the compiler, source program,
saving compiled program, and loading and linking. Thus
considerable amount of time was spent in just setting up the
program to run.
OS_chp1
Slides by: Ms. Shree Jaswal 17
Evolution of Operating Systems
2 - Simple batch system
• Monitor
• Software that controls the sequence of events
• Improves job setup time
• Batch jobs together – job control language (JCL)
• Program returns control to monitor when finished
• Hardware support for the monitor model
• Memory protection: some memory areas are accessible only to
the monitor
• Privileged mode instructions: only accessible to the monitor
• Interrupts (early machines did not have this)
OS_chp1
Slides by: Ms. Shree Jaswal 18
An early batch system
OS_chp1
Slides by: Ms. Shree Jaswal 19
An early batch system.
(a) Programmers bring cards to 1401.
(b)1401 reads batch of jobs onto tape.
An early batch system
OS_chp1
Slides by: Ms. Shree Jaswal 20
(c) Operator carries input tape to 7094.
(d)7094 does computing.
(e) Operator carries output tape to 1401.
An early batch system
OS_chp1
Slides by: Ms. Shree Jaswal 21
(f) 1401 prints output.
IBM 7094
OS_chp1
Slides by: Ms. Shree Jaswal 22
OS_chp1
Slides by: Ms. Shree Jaswal 23
Uniprogramming
• Processor must wait for I/O instruction to complete before
proceeding
OS_chp1
Slides by: Ms. Shree Jaswal 24
Multiprogramming
• When one job needs to wait for I/O, the processor can
switch to the other job
OS_chp1
Slides by: Ms. Shree Jaswal 25
Multiprogramming
OS_chp1
Slides by: Ms. Shree Jaswal 26
Time Sharing Systems
• Using multiprogramming to handle multiple interactive
jobs
• Processor’s time is shared among multiple users who
simultaneously access the system through terminals
• If there are ‘n’ users actively requesting service at one
time each user will only see on the average ‘1/n’ of the
effective computer speed.
OS_chp1
Slides by: Ms. Shree Jaswal 27
Batch Multiprogramming versus Time
Sharing
OS_chp1
Slides by: Ms. Shree Jaswal 28
Major achievements of operating systems
1. Processes
2. Memory management
3. Information protection and security
4. Scheduling and resource management
OS_chp1
Slides by: Ms. Shree Jaswal 29
1. Process
It is defined as:
• A program in execution
• An instance of a program running on a computer
• The entity that can be assigned to and executed on a
processor
• A unit of activity characterized by
• A single sequential thread of execution
• A current state
• An associated set of system resources
OS_chp1
Slides by: Ms. Shree Jaswal 30
1. Process
• Consists of three components
• An executable program
• Associated data needed by the program
• Execution context of the program
• All information the operating system needs to manage the process
OS_chp1
Slides by: Ms. Shree Jaswal 31
Process
OS_chp1
Slides by: Ms. Shree Jaswal 32
2. Memory Management
• Process isolation
• Automatic allocation and management
• Protection and access control
• Support of modular programming
• Protection and access control
• Long term storage
OS_chp1
Slides by: Ms. Shree Jaswal 33
Virtual Memory
• Allows programmers to address memory from a logical
point of view
• Allow the illusion of operating with a larger memory space
than what is available in reality
• By storing some of the information on the file system
• It is used to meet the requirement of having multiple user
jobs reside in main memory concurrently
OS_chp1
Slides by: Ms. Shree Jaswal 34
Paging
• One way to implement virtual memory
• Allows the process to be comprised of a number of fixed-size blocks, called pages
• Virtual address is a page number and an offset within the page
• Each page may be located anywhere in main memory
• Real address or physical address is the main memory address
OS_chp1
Slides by: Ms. Shree Jaswal 35
OS_chp1
Slides by: Ms. Shree Jaswal 36
Virtual memory addressing
OS_chp1
Slides by: Ms. Shree Jaswal 37
3. Information Protection and Security
• Availability
• Concerned with protecting the system against interruption
• Confidentiality
• Assuring that users cannot read data for which access is
unauthorized
• Data integrity
• Protection of data from unauthorized modification
• Authentication
• Concerned with the proper verification of the identity of
users and the validity of messages or data
OS_chp1
Slides by: Ms. Shree Jaswal 38
4. Scheduling and Resource
Management
• Fairness
• Give equal and fair access to resources
• Differential responsiveness
• Discriminate among different classes of jobs
• Efficiency
• Maximize throughput, minimize response time, and accommodate
as many uses as possible
OS_chp1
Slides by: Ms. Shree Jaswal 39
Key Elements of an Operating System
OS_chp1
Slides by: Ms. Shree Jaswal 40
Traditional OS structure
• monolithic/layered systems
one/N layers all executed in “kernel-mode”
good performance but rigid
OS_chp1
Slides by: Ms. Shree Jaswal 41
OS kernel
hardware
user
process
file
system
memory
system
user
system calls
Monolithic Systems
OS_chp1
Slides by: Ms. Shree Jaswal 42
A simple structuring model for a monolithic system.
Modes of OS
OS_chp1
Slides by: Ms. Shree Jaswal 43
Modern Operating Systems
• Microkernel architecture
• Assigns only a few essential functions to the kernel
• Address spaces
• Interprocess communication (IPC)
• Basic scheduling
• It interacts with local and remote server processes in
the same way facilitating construction of distributed
systems.
• Working examples Mach, QNX
• Current operating systems: Windows, Linux, Mac OS
are not microkernel based
OS_chp1
Slides by: Ms. Shree Jaswal 44
Micro-kernel OS
client-server model, IPC between clients and servers
the micro-kernel provides protected communication
OS functions implemented as user-level servers
flexible but efficiency is the problem
easy to extend for distributed systems
OS_chp1
Slides by: Ms. Shree Jaswal 45
micro-kernel
hardware
memory
server
IPC
user mode client
process file
server
memory
server
Microkernels
OS_chp1
Slides by: Ms. Shree Jaswal 46
Structure of the MINIX 3 system
Extensible OS kernel
user processes can load customized OS services into
the kernel
good performance but protection and scalability become
problems
OS_chp1
Slides by: Ms. Shree Jaswal 47
extensible kernel
hardware
process user mode
process process
my
memory
service
default
memory
service
Characteristics of Modern Operating
Systems • Multithreading
• Process is divided into threads that can run concurrently
• Thread
• Dispatchable unit of work
• Executes sequentially and is interruptable
• Process is a collection of one or more threads
OS_chp1
Slides by: Ms. Shree Jaswal 49
Characteristics of Modern Operating
Systems • Symmetric multiprocessing (SMP)
• There are multiple processors
• These processors share same main memory and I/O facilities
• All processors can perform the same functions
OS_chp1
Slides by: Ms. Shree Jaswal 50
Multiprogramming and Multiprocessing
OS_chp1
Slides by: Ms. Shree Jaswal 51
Characteristics of Modern Operating
Systems • Distributed operating systems
• Provides the illusion of a single main memory space and single
secondary memory space
• Eg. Amoeba by Andrew Tannembaum
OS_chp1
Slides by: Ms. Shree Jaswal 52
Characteristics of Modern Operating
Systems • Object-oriented design
• Used for adding modular extensions to a small kernel
• Enables programmers to customize an operating
system without disrupting system integrity
OS_chp1
Slides by: Ms. Shree Jaswal 53
Computer Hardware Review
OS_chp1
Slides by: Ms. Shree Jaswal 54
Some of the components
of a simple personal computer.
Processors
• CPU is brain of the computer
• Has :
• general registers
• Program counter
• Stack pointer
• Program status word (PSW)
OS_chp1
Slides by: Ms. Shree Jaswal 55
Operating System Concepts
OS_chp1
Slides by: Ms. Shree Jaswal 56
(a) A three-stage pipeline. (b) A superscalar CPU.
Memory
OS_chp1
Slides by: Ms. Shree Jaswal 57
A typical memory hierarchy.
The numbers are very rough approximations.
Memory
• Cache memory transparently stores data so that future requests for that data can be served faster.
• The data that is stored within a cache might be values that have been computed earlier or duplicates of original values that are stored elsewhere
• If requested data is contained in the cache (cache hit), this request can be served by simply reading the cache, which is comparatively faster
• Otherwise (cache miss), the data has to be recomputed or fetched from its original storage location, which is comparatively slower
OS_chp1
Slides by: Ms. Shree Jaswal 58
Memory
• Main memory is often called RAM
• RAM, DRAM, DDR SDRAM and SRAM are volatile forms
of memory
• ROM, PROM, EPROM, EEPROM are non volatile forms
of memory
• CMOS is volatile memory used to hold current date and
time
OS_chp1
Slides by: Ms. Shree Jaswal 59
Disks
OS_chp1
Slides by: Ms. Shree Jaswal 60
Structure of a disk drive.
I/O Devices
OS_chp1
Slides by: Ms. Shree Jaswal 61
(a) The steps in starting an I/O device and
getting an interrupt.
I/O Devices
OS_chp1
Slides by: Ms. Shree Jaswal 62
(b) Interrupt processing involves taking the
interrupt, running the interrupt handler,
returning to the user program.
Buses
OS_chp1
Slides by: Ms. Shree Jaswal 63
The structure of a large Pentium system
Operating System Concepts
• Associated with each process is its address space, a list
of memory locations from some min(usually 0) to some
max, which the process can read & write
• The address space contains the executable program, the
program’s data and its stack.
OS_chp1
Slides by: Ms. Shree Jaswal 65
Operating System Concepts
• When a process is suspended temporarily, it must later
be restarted in exactly the same state it had when it was
stopped.
• For this, all the info about each process, other than its
own address space is stored in an OS table called the
process table, which is an array of structures, one for
each process in existence.
OS_chp1
Slides by: Ms. Shree Jaswal 66
Processes
• If a process can create one or more other processes &
these processes in turn can create child processes we
arrive at a process tree structure
• IPC: Related processes that are cooperating to get some
job done often need to communicate with one another &
synchronize their activities. This communication is called
interprocess communication.
OS_chp1
Slides by: Ms. Shree Jaswal 67
Processes
OS_chp1
Slides by: Ms. Shree Jaswal 68
A process tree. Process A created two child processes, B and
C. Process B created three child processes, D, E, and F.
Files
OS_chp1
Slides by: Ms. Shree Jaswal 69
A file
system for
a university
department
.
Files
OS_chp1
Slides by: Ms. Shree Jaswal 70
(a) Before mounting, the files on the CD-ROM are not accessible. (b)
After mounting, they are part of the file hierarchy.
Files
OS_chp1
Slides by: Ms. Shree Jaswal 71
Two processes connected by a pipe.
System Calls
• Interface between user programs and
OS
• Vary from OS to OS
• Example of system call
• Count=read(fd, buffer, nbytes)
OS_chp1
Slides by: Ms. Shree Jaswal 72
System Calls
OS_chp1
Slides by: Ms. Shree Jaswal 73
The 11 steps in making the
system call
read(fd, buffer, nbytes).
Memory Layout
OS_chp1
Slides by: Ms. Shree Jaswal 74
Processes have three segments:
text, data, and stack.
UNIX
• Hardware is surrounded by the operating-system
• Operating system is called the kernel
• Comes with a number of user services and interfaces
• shell
• C compiler
OS_chp1
Slides by: Ms. Shree Jaswal 75
General UNIX architecture
OS_chp1
Slides by: Ms. Shree Jaswal 76
UNIX
OS_chp1
Slides by: Ms. Shree Jaswal 77
Modern UNIX Systems
• System V Release 4 (SVR4)
• Solaris 2.x
• 4.4BSD
• Linux
OS_chp1
Slides by: Ms. Shree Jaswal 78
THANK YOU!
OS_chp1
Slides by: Ms. Shree Jaswal 79