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

Lecture 2 - OS Overview

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

Lecture 2 - OS Overview

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

Operatin

g
Systems: Chapter 2
Internals
and Operating
Design System Overview
Principle Eighth Edition
By William Stallings
s
Operating System
A program that controls the execution of
application programs
 Aninterface between applications and
hardware
Main objectives of an OS:
• convenience
• efficiency
• ability to evolve
Operating System
Services
 Program development
 application program development tools
 Program execution
 Access I/O devices
 provides a uniform interface
 Controlled access to files
 Protection mechanisms
Operating System
Services
 System access
 protection of resources and data from
unauthorized users and must
 resolve conflicts for resource contention.
 Error detection and response
 internaland external hardware errors
 Software errors
 Accounting
 monitor performance
Key Interfaces
 Instructionset architecture (ISA)
 Functional definition of operations,
mode, storage locations supported
by hardware
 Precise description of how to invoke
and access them
Key Interfaces
 Application binary interface (ABI)
 describes the low-level interface
between an application (or any type of)
program and the operating system or
another application.
 how parameters are passed between
caller and callee, how return values are
provided to callers, how libraries are
implemented, and how programs are
loaded into memory.
Key Interfaces
 Application programming
interface (API)
 An API is instructions to the
compiler about what
source code can and
cannot do.
 An API is instructions to a
programmer about what
functions expect and do.
The Role of an OS
A computer is a set of resources
for the movement, storage, and
processing of data
 The
OS is responsible for
managing these resources
Evolution of Operating
Systems

 A major OS will evolve over time


for a number of reasons:
hardware
upgrades
new types of
hardware
new services

Fixes
Evolution of
Operating Systems
 Stages include:

Time
Sharing
Multiprogramme Systems
d Batch
Systems
Simple
Batch
Systems
Serial
Processin
g
Serial Processing
Earliest
Problems:
Computers:
 Scheduling:
 No operating system  most installations used a
 programmers hardcopy sign-up sheet to
interacted directly with reserve computer time
the computer hardware  time allocations could
run short or long,
 Computers ran from a
resulting in wasted
console with display lights,
computer time
toggle switches, some form
of input device, and a printer  Setup time
 Users have access to the
 a considerable amount of
computer in “series” time was spent just on
setting up the program to
run
Simple Batch
Systems
 Early computers were very expensive
 important to maximize processor utilization
 Monitor
 user no longer has direct access to processor
 job is submitted to computer operator who
batches them together and places them on
an input device
 program branches back to the monitor when
finished
Monitor Point of
View
 Monitor controls the
sequence of events
 Resident Monitor is
software always in
memory
 Monitor reads in job and
gives control
 Job returns control to
monitor
Processor Point of
View
 Processor executes instruction from the
memory containing the monitor
 Executes the instructions in the user program
until it encounters an ending or error condition
 “control is passed to a job” means processor is
fetching and executing instructions in a user
program
 “control is returned to the monitor” means that
the processor is fetching and executing
instructions from the monitor program
Job Control Language
(JCL)
Special type of
programming language
used to provide
instructions to the monitor

what compiler to
use

what data to use


CPU Modes of
Operation

User Mode Kernel Mode


• user program executes • monitor executes in
in user mode kernel mode
• certain areas of memory • privileged instructions
are protected from user may be executed
access • protected areas of
• certain instructions may memory may be
not be executed accessed
Simple Batch System
Overhead
 Processor time alternates between execution of
user programs and execution of the monitor
 Sacrifices:
 some main memory is now given over to the
monitor
 some processor time is consumed by the
monitor
 Despite overhead, the simple batch system
improves utilization of the computer
Multiprogrammed
Batch Systems
 Processor is
often idle
 even with
automatic
job
sequencing
 I/O devices
are slow
compared
to
processor
Uniprogramming

 The processor spends a certain amount of time


executing, until it reaches an I/O instruction; it
must then wait until that I/O instruction
concludes before proceeding
Multiprogramming

 There must be enough memory to hold the OS


(resident monitor) and one user program
 When one job needs to wait for I/O, the processor can
switch to the other job, which is likely not waiting for
I/O
Multiprogramming

 Multiprogramming
 also known as multitasking
 memory is expanded to hold three, four, or more
programs and switch among all of them
Time-Sharing
Systems
 Can be used to handle multiple interactive
jobs
 Processor time is shared among multiple
users
 Multipleusers simultaneously access the
system through terminals, with the OS
interleaving the execution of each user
program in a short burst or quantum of
computation
Batch
Multiprogramming
vs. Time Sharing

Table 2.3 Batch Multiprogramming versus Time Sharing


Major Achievements
4 major advances
 Processes
 Memory Management
 Information Protection and Security
 Scheduling and resource
management
Process
 Fundamental to the structure of operating
systems
A process can be defined as:

a program in execution
an instance of a running program
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, and an associated set of system
resources
Components of
a Process
A  Theexecution context
process
contains three is essential:
 it is the internal data by
components: which the OS is able to
 an executable supervise and control the
program process
 the associated data
 includes the contents of the
various process registers
needed by the
 includes information such
program (variables,
as the priority of the
work space, buffers, process and whether the
etc.) process is waiting for the
 the execution completion of a particular
context (or “process I/O event
Different
Architectural
Approaches
 Demands on operating systems
require new ways of organizing the
OS
Different approaches and design elements have
been tried:

• kernel architecture
• multithreading
• symmetric multiprocessing
• distributed operating systems
• object-oriented design
Types of kernel
 Kernel is the core part of an operating system which
manages system resources. It also acts like a bridge
between application and hardware of the computer. It is
one of the first programs loaded on start-up (after the
Bootloader).
 Types of Kernel
 MONOLITHIC KERNEL
 MICRO KERNEL
 HYBRID KERNEL
Monolithnic vs
Microkernel
Types of kernel

Exercise : Determine the OS kernel of your


notebook/handphone.
Key Differences Between
Microkernel and Monolithic
Kernel
 The basic point on which microkernel and monolithic kernel is
distinguished is that microkernel implement user services and
kernel services in different address spaces and monolithic
kernel implement both user services and kernel services
under same address space.
 The size of microkernel is small as only kernel services reside in the
kernel address space. However, the size of monolithic kernel is
comparatively larger than microkernel because both kernel services
and user services reside in the same address space.
 The execution of monolithic kernel is faster as the communication
between application and hardware is established using the system
call. On the other hands, the execution of microkernel is slow as the
communication between application and hardware of the system is
established through message passing.
Key Differences Between
Microkernel and Monolithic
Kernel
 It is easy to extend microkernel because new service is to be
added in user address space that is isolated from kernel space,
so the kernel does not require to be modified. Opposite is the
case with monolithic kernel if a new service is to be added in
monolithic kernel then entire kernel needs to be modified.
 Microkernel is more secure than monolithic kernel as if a
service fails in microkernel the operating sytem remain
unaffected. On the other hands, if a service fails in monolithic
kernel entire system fails.
 Monolithic kernel designing requires less code, which further
leads to fewer bugs. On the other hands, microkernel designing
needs more code which furher leads to more bugs.
Conclusion

 Microkernel is slower but more secure and


reliable than monolithic kernel.
 Monolithickernel is fast but less secure as
any service failure may lead to system
crash.
Microkernel
Architecture
 Assignsonly a few essential functions
to the kernel:
interprocess
address basic
communicatio
spaces scheduling
n (IPC)

 The approach:
is well suited
simplifies
provides to a
implementatio
flexibility distributed
n
environment
Multithreading
 Technique in which a process, executing an
application, is divided into threads that can run
concurrently
Thread
• dispatchable unit of work
• includes a processor context and its own data area to
enable subroutine branching
• executes sequentially and is interruptible

Process
• a collection of one or more threads and associated system
resources
• programmer has greater control over the modularity of the
application and the timing of application related events
Symmetric
Multiprocessing
(SMP)
 Term that refers to a computer hardware
architecture and also to the OS behavior that
exploits that architecture
 Several processes can run in parallel
 Multiple processors are transparent to the user
 these processors share same main memory and
I/O facilities
 all processors can perform the same functions

 The OS takes care of scheduling of threads or


processes on individual processors and of
synchronization among processors
SMP Advantages
more than one process can be
Performa
running simultaneously, each
nce on a different processor

Availabilit failure of a single process


y does not halt the system

Incremen performance of a system


tal can be enhanced by adding
Growth an additional processor

vendors can offer a range of


products based on the number
Scaling of processors configured in the
system
OS Design
Distributed Object-Oriented
Operating System Design
 Provides the illusion of
 Used for adding modular
 a single main memory extensions to a small
space kernel
 single secondary memory  Enables programmers to
space
customize an operating
 unified access facilities system without disrupting
 State of the art for distributed
system integrity
operating systems lags that of
uniprocessor and SMP
 Eases the development of
operating systems distributed tools and full-
blown distributed operating
systems
REVIEW QUESTIONS
 Defineand provide examples of OS
which is described as the following :
 monolithic OS
 microkernel OS
 multithreading OS
 Foreach of the OS above, identify the
logo and the latest version/name for it.

You might also like