0% found this document useful (0 votes)
14 views

Lecture1 Overview

The document introduces operating systems and their key components, including hardware, the operating system software, system/application programs, and users. It describes the main functions of an operating system as controlling hardware resources, coordinating program execution, providing common services to applications, and acting as an interface between users and the computer hardware. The document also outlines different operating system structures like multiprocessing and multitasking that allow for efficient utilization of computer resources and interactive use by multiple users or programs simultaneously.

Uploaded by

kingm7130
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

Lecture1 Overview

The document introduces operating systems and their key components, including hardware, the operating system software, system/application programs, and users. It describes the main functions of an operating system as controlling hardware resources, coordinating program execution, providing common services to applications, and acting as an interface between users and the computer hardware. The document also outlines different operating system structures like multiprocessing and multitasking that allow for efficient utilization of computer resources and interactive use by multiple users or programs simultaneously.

Uploaded by

kingm7130
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 55

Introduction to Operating

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

• An engineer can build for 10 pounds what any


fool can build for 10 million pounds
– Software engineer is an engineer
– Software engineers build programs

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.

Computer hardware (subsystems) 7


Main memory
• The only large storage media that the CPU can access directly
− Random access in the form of Dynamic Random-access
Memory (DRAM)
− Volatile : erased when the power is turned off
• Device controller
− Directly transfers data from I/O buffer to main memory
without CPU intervention
− Can transfer blocks of data rather than one byte
− Used for high-speed I/O devices able to transmit information at
close to memory speeds 8
Central Processing Unit
The central processing unit (CPU) performs operations on
data. In most architectures it has three parts: an arithmetic
logic unit (ALU), a control unit and a set of registers, fast
storage locations.

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

• Each device has a controller


• Device Driver for each device controller to manage I/O
− Provides uniform interface
• Divided into two broad categories
– Storage devices store programs and data
– Non-storage devices allow a computer to
communicate with the outside world
22
Storage devices (1)
• Extension of the main memory
• Cheaper than main memory
• Can store large amounts of data
• Contents are nonvolatile (not erased when the power is
turned off)
• Sometimes referred to as auxiliary storage devices
• Categorize them as either magnetic or optical

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

service routine generally, through the


interrupt vector, which contains the
addresses of all the service routines
Interrupt Handling
• After I/O starts,
Two methods to
return the
control returns
to user program
− Synchronous :
Only upon I/O
completion
− Asynchronous :
Without waiting
for I/O
completion
Interrupt Timeline
• The OS preserves the state of the CPU
by storing registers and the program
counter
Dual-mode
• Allows OS to protect itself and other system
components
• User mode and kernel mode
− Depends on Mode bit value (provided by
hardware)
• Some instructions designated as privileged,
only executable in kernel mode
• How do we guarantee that user does not
explicitly set the mode bit to “kernel”?
− System call changes mode to “kernel”
− When it return from the call, it resets it to
“user”
Timer
• Prevents infinite loop (or process hogging

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 :

− When the computer system is executing on


behalf of a user application, the system is in
user mode.
− However, when a user application requests a
service from the operating system via a
system call, it must transition from user to
kernel mode to fulfill the request.
Question 2
• What is a bootstrap program, and where is it

stored?
• Answer :

− A bootstrap program is the initial program that


is run when the computer is powered up or
rebooted.
− It initializes all aspects of the system, from
CPU registers to device controllers to memory
contents.
− Typically, it is stored in read-only memory
Question 3
• What is an interrupt?

• What is the purpose of an interrupt vector?

• 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

You might also like