Operating System-Lecture 3

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 27

Operating System

Layers of Computer System


Operating System Definition
• A program that controls the execution of application
programs
• An interface between users and hardware - an
environment "architecture”
• Allows convenient usage; hides the tedious stuff
• Allows efficient usage; parallel activity, avoids wasted
cycles
• Provides information protection
• Gives each user a slice of the resources
• Acts as a control program
Why do we need an Operating System?
• When we write a program in the high level language,
following steps are followed to execute it:
– The compiler to translate the program is loaded in the
memory
– The source program is read and loaded in the memory
– The source program is compiled into the object program. If
any syntax errors occur, messages are displayed
– During compilation, machine language routines for reading
and writing required by the program are brought in from the
routine library which is stored in the secondary memory and
linked to the object program
– Compiler may now be removed from the memory and space
may be provided for the data of the program
Operating System Overview
A mechanism for scheduling jobs or processes. Scheduling can
be as simple as running the next process, or it can use
relatively complex rules to pick a running process.

A method for simultaneous CPU execution and IO handling.


Processing is going on even as IO is occurring in preparation
for future CPU work.

Off Line Processing; not only are IO and CPU happening


concurrently, but some off-board processing is occurring with
the IO.
The CPU is wasted if a job waits for I/O. This leads to:
– Multiprogramming ( dynamic switching ). While one job waits for a
resource, the CPU can find another job to run. It means that several
jobs are ready to run and only need the CPU in order to continue.

CPU scheduling
All of this leads to:
– memory management
– resource scheduling
– deadlock protection
Major facilities provided by the OS are :
• Easy interaction between humans and computers
• Starting computer operations automatically when power is turned on
• Loading and scheduling users’ programs along with necessary compilers
• Controlling input and output
• Controlling program execution
• Scheduling processes
• Managing use of various levels of memory
• Managing and manipulating files
• Providing security to files and jobs
• Accounting resource usage
Evolution of Operating System

• Serial Processing
– No operating system
– Machines run from a console with display lights, toggle
switches, input device, and printer
– Schedule time
– Setup included loading the compiler, source program,
saving compiled program, and loading and linking
• Simple Batch Systems
– Monitors
• Software that controls the sequence of events
• Batch jobs together
• Program branches back to monitor when finished
– Job Control Language (JCL)
• Special type of programming language
• Provides instruction to the monitor
– What compiler to use
– What data to use
Batch Processing
• Batch: Group of jobs submitted together
– Operator collects jobs; orders efficiently; runs one at a time
• Advantages
– Amortize setup costs over many jobs
– Operator more skilled at loading tapes
– Keep machine busy while programmer thinks
– Improves throughput and utilization
• Problems
– User must wait until batch is done for results
– Machine idle when job is reading from cards and writing to printers


History of Operating Systems

Early batch system


– bring cards to 1401
– read cards to tape
– put tape on 7094 which does computing
– put tape on 1401 which prints output
History of Operating Systems

• Structure of a typical FMS job – 2nd generation


Uniprogramming

• Processor must wait for I/O instruction to


complete before preceding
Spooling
• Hardware
– Mechanical I/O devices much slower than CPU
– Read 17 cards/sec vs. execute 1000s instructions/sec
• Goal of OS
– Improve performance by overlapping I/O with CPU execution
• Spooling: Simultaneous Peripheral Operations On-Line
1. Read card punches to disk
2. Compute (while reading and writing to disk)
3. Write output from disk to printer
• OS Functionality
– Buffering and interrupt handling
• Problem
– Machine idle when job waits for I/O to/from disk
Multiprogrammed Batch Systems
• Observation: Spooling provides pool of
ready jobs
• Goal of OS
Job 3 – Improve performance by always
running a job
– Keep multiple jobs resident in
Job 2
memory
Memory
– When job waits for disk I/O, OS
partitions Job 1 switches to another job
• OS Functionality
Operating – Job scheduling policies
system – Memory management and protection
• Advantage: Improves throughput and
utilization
• Disadvantage: Machine not interactive
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
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
Inexpensive Peripherals
• 1960s Hardware
– Expensive mainframes, but inexpensive keyboards and monitors
– Enables text editors and interactive debuggers
• Goal of OS
– Improve user’s response time
• OS Functionality
– Time-sharing: switch between jobs to give appearance of dedicated
machine
– More complex job scheduling
– Concurrency control and synchronization
• Advantage
– Users easily submit jobs and get immediate feedback
Inexpensive Personal Computers
• 1980s Hardware
– Entire machine is inexpensive
– One dedicated machine per user
• Goal of OS
– Give user control over machine
• OS Functionality
– Remove time-sharing of jobs, protection, and virtual memory
• Advantages
– Simplicity
– Works with little main memory
– Machine is all your own (performance is predictable)
• Disadvantages
– No time-sharing or protection between jobs
Inexpensive, Powerful Computers
• 1990s+ Hardware
– PCs with increasing computation and storage
– Users connected to the web
• Goal of OS
– Allow single user to run several applications simultaneously
– Provide security from malicious attacks
– Efficiently support web servers

• OS Functionality
– Add back time-sharing, protection, and virtual memory
Current Systems
• Conclusion: OS changes due to both hardware and users
• Current trends
– Multiprocessors
– Networked systems
– Virtual machines
• OS code base is large
– Millions of lines of code
– 1000 person-years of work
• Code is complex and poorly understood
– System outlives any of its builders
– System will always contain bugs
– Behavior is hard to predict, tuning is done by guessing
Multiprogramming
• While one job waits for a resource, the CPU can find another job to run. It
means that several jobs are ready to run and only need the CPU in order to
continue.
History of Operating Systems

• First generation 1945 - 1955


– vacuum tubes, plug boards
• Second generation 1955 - 1965
– transistors, batch systems
• Third generation 1965 – 1980
– ICs and multiprogramming
• Fourth generation 1980 – present
– personal computers
Types of Operating System

• Mainframe operating systems


• Server operating systems
• Multiprocessor operating systems
• Personal computer operating systems
• Real-time operating systems
• Embedded operating systems
• Smart card operating systems
Components of a simple PC
Outside
world

Video Hard drive USB Network


controller controller controller controller

CPU Computer internals


(inside the “box”)
Memory
CPU internals

Execute
Fetch Decode unit
unit unit

Fetch Decode Execute Execute


Buffer unit
unit unit unit

Fetch Decode
unit unit Execute
unit

Pipelined CPU Superscalar CPU


Storage pyramid
Capacity Access latency
< 1 KB Registers 1 ns Better

1 MB Cache (SRAM) 2–5 ns


256 MB Main memory (DRAM) 50 ns
40 GB Magnetic disk 5 ms
Better > 1 TB Magnetic tape 50 sec

• Goal: really large memory with very low latency


– Latencies are smaller at the top of the hierarchy
– Capacities are larger at the bottom of the hierarchy
• Solution: move data between levels to create illusion of large
memory with low latency

You might also like