Lecture1 Overview
Lecture1 Overview
Systems
Lecture 1
Back to the future …
• Learn GNU/Linux safely
– Use a virtual machine
– Install VMware or Virtual Box
– YouTube step by step English guide
• By NetworkChuck
• Title : You need to learn Virtual Machines right now
OS 2
Last week
• Any sufficiently advanced technology is
indistinguishable from magic
– Arthur Clark, 1962
• Minority Report
– 2002 science fiction movie
– Operating system with hologram based interfaces
– At the time, seemed magical
– Nowadays, touch screen mobiles everywhere
OS 3
Last week : Course objective
• Deep understanding of Operating Systems
– OS are no longer magical
OS 4
Four Components of a Computer System
OS 5
Computer System Components
• Hardware :
– CPU , Resources ( memory, I/O devices )
• Operating system :
– Controls and coordinates use of hardware among
various applications and users
• System and 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 6
Computer Hardware
We can divide the parts that make up a computer
into three broad categories or subsystem: the central
processing unit (CPU), the main memory and the
input/output subsystem.
9
Example of Program Execution
10
Example of Program Execution
11
Example of Program Execution
12
Example of Program Execution
13
Example of Program Execution
14
Example of Program Execution
15
Example of Program Execution
16
Example of Program Execution
17
Example of Program Execution
18
Example of Program Execution
19
Example of Program Execution
20
Example of Program Execution
21
Input/Output (I/O) Subsystem
23
Storage devices (2)
• Hard disks : rigid metal or glass platters covered with magnetic
recording material
− Disk surface is logically divided into tracks, which are
subdivided into sectors
− The disk controller determines the logical interaction between
the device and the computer
• Solid-state disks :
− faster than hard disks
− Various technologies
− Becoming more popular
24
Storage devices hierarchy
Storage devices hierarchy
• Caching : copying information into faster storage system
• The cache is smaller than storage being cached
− Main memory can be viewed as a cache for secondary
storage
• Faster storage (cache) checked first to determine if
information is there
− If it is, information used directly from the cache (fast)
− If not, data copied to cache and used there
• Cache management is very important for performance
− Cache size and replacement policy
26
Connecting I/O devices to the buses
27
What is an Operating System?
• A program that acts as an intermediary between a
user of a computer and the computer hardware.
• User point of view : Makes the computer
system convenient to use.
• System point of view : Use the computer
hardware in an efficient manner.
• Application point of view : Provides a
convenient, feature rich, secure, and
consistent interface to use
OS 28
Layers of Computer System
29
Services Provided by the OS (1)
• Control Program execution
• Control Access to I/O devices
– Hide peculiarities of hardware devices from the user
• Control access to files
• Control System access
• Support communication between programs
– Shared Memory , Message Passing
30
Services Provided by the OS (2)
• Error detection and response
– Internal and external hardware errors
• Memory error
• Device failure
– Software errors
• Arithmetic overflow
• Access forbidden memory locations
31
Services Provided by the OS (3)
• Accounting
– Collect usage statistics
– Monitor performance
– Used to anticipate future enhancements
– Used for billing purposes
32
OS as virtual machine
• Present the user with the equivalent of an
extended machine or virtual machine that is
easier to program than the underlying hardware.
• The OS provides a variety of services that
programs can obtain through special instructions
called system calls.
• OS provides a uniform, abstract representation of
resources that can be requested and accessed by
application
OS 33
Operating System Definition (1)
• Program executed like an ordinary software
• Kernel : the part running at all times
• Everything else is either
– System program (ships with the operating system,
but not part of the kernel)
– Application program : all programs not associated
with the operating system
• Nowadays usually includes middleware ( frameworks
that provide additional services to application
developers such as databases, multimedia and
graphics)
34
Operating System Definition (2)
• Resource allocator :
– Manages all resources
– Decides between conflicting requests for
efficient and fair resource use
• Controls execution of programs :
– Controls execution of programs to
prevent errors and improper use of the
computer
OS 35
Computer Startup
• bootstrap program is loaded at
power-up or reboot
– Typically stored in ROM or EPROM
– Generally known as firmware
– Initializes all aspects of system
– Loads operating system kernel and
starts execution
36
I/O Devices are Slow
37
Uniprogramming
• Processor must wait for I/O instruction to
complete before preceding
38
Memory Layout for
Multiprogrammed System
Multiprogramming
• Efficient use of the CPU
• When one job needs to wait for I/O, the processor can
switch to the other job
40
Multiprogramming
• The OS preserves the state of the CPU by
storing registers and the program counter
41
Multitasking (Timesharing)
• Extension to multiprogramming
• Illusion that all jobs are running at once
– The OS switches jobs so frequently that users can
interact with each job while it is running, creating
interactive computing
– Response time should be < 1 second
– Several jobs competes for CPU time (Scheduling)
– If processes don’t fit in memory, swapping moves
them in and out to run
– Virtual memory allows execution of processes not
completely in memory (Paging)
42
Operating-System Operations (1)
• 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
• Each device controller type has an
operating system device driver to
manage it
• CPU moves data from/to main memory
to/from local buffers
• I/O is from the device to local buffer of
controller
•
Operating-System Operations (2)
• An operating system is Interrupt driven
− Hardware interrupt by one of the
devices
− Software interrupt (exception or trap):
• Software error (e.g., division by zero)
• Request for operating system service
• Other process problems (infinite loop,
processes modifying each other or the
operating system)
• Separate segments of code determine
what action should be taken for each type
of interrupt
Operating-System Operations (3)
• Interrupt transfers control to the interrupt
resources)
• Set to interrupt the computer after some
period
• Keeps a counter that is decremented by the
physical clock
• Operating system set the counter (privileged
instruction)
• When counter zero generate an interrupt
• Set up before scheduling process to regain
Exercise 1
CPU utilization = 9 %
Question 1
• Describe the operating system's two modes of
operation.
• Answer :
stored?
• Answer :
• Answer :
− Interrupts are signals emitted by hardware devices or
some software
− Generally, should be handled by processor immediately.
− The interrupt vector is a table of pointers to specific
interrupt-handling routines.
− Because there are a fixed number of interrupts, this
table allows for more efficient handling of the interrupts
than with a general-purpose, interrupt-processing
Question 4
Answer 4