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

Ch02-OS9e

Uploaded by

hussienayman366
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views

Ch02-OS9e

Uploaded by

hussienayman366
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 52

Operatin

g
Systems: Chapter 2
Internals
and Operating
Design System Overview
Principle Ninth Edition, Global Edition
By William Stallings
s

Copyright © 2018 Pearson Education, Ltd. All Rights Reserved.


Operating System
A program that controls the execution of
application programs
 An interface between applications and
hardware
Main objectives of an OS:
• Convenience
• Efficiency
• Ability to evolve

Copyright © 2018 Pearson Education, Ltd. All Rights Reserved.


Copyright © 2018 Pearson Education, Ltd. All Rights Reserved.
Operating System
Services

 Program development
 Program execution
 Access I/O devices
 Controlled access to files
 System access
 Error detection and response
 Accounting

Copyright © 2018 Pearson Education, Ltd. All Rights Reserved.


Key Interfaces
 Instruction set architecture (ISA)
 Application binary interface (ABI)
 Application programming interface
(API)

Copyright © 2018 Pearson Education, Ltd. All Rights Reserved.


The Operating
System as Resource
Manager
 The OS is responsible for
controlling the use of a
computer’s resources, such as
I/O, main and secondary
memory, and processor
execution time

Copyright © 2018 Pearson Education, Ltd. All Rights Reserved.


Operating System
as Resource
Manager
 Functions in the same way as
ordinary computer software
 Program, or suite of programs,
executed by the processor
 Frequently relinquishes control and
must depend on the processor to
allow it to regain control
Copyright © 2018 Pearson Education, Ltd. All Rights Reserved.
Copyright © 2018 Pearson Education, Ltd. All Rights Reserved.
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

Copyright © 2018 Pearson Education, Ltd. All Rights Reserved.


Evolution of
Operating Systems
 Stages include:

Time
Sharing
Multiprogramme Systems
d Batch
Systems
Simple
Batch
Systems
Serial
Processin
g
Copyright © 2018 Pearson Education, Ltd. All Rights Reserved.
Serial Processing
Earliest
Problems:
Computers:
 Scheduling:
 No operating system  Most installations used a
 Programmers hardcopy sign-up sheet
interacted directly with to reserve computer time
the computer hardware  Time allocations
 Computers ran from a could run short or
console with display lights, long, resulting in
toggle switches, some form wasted computer
of input device, and a printer time

 Users have access to the


 Setup time
computer in “series”  A considerable amount of
time was spent on setting
up the program to run
Copyright © 2018 Pearson Education, Ltd. All Rights Reserved.
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
Copyright © 2018 Pearson Education, Ltd. All Rights Reserved.
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

Copyright © 2018 Pearson Education, Ltd. All Rights Reserved.


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
Copyright © 2018 Pearson Education, Ltd. All Rights Reserved.
Job Control Language
(JCL)
Special type of
programming language
used to provide
instructions to the monitor

What compiler to
use

What data to use

Copyright © 2018 Pearson Education, Ltd. All Rights Reserved.


Desirable Hardware
Features
Memory protection

• While the user program is executing, it must not alter the


memory area containing the monitor

Timer

• Prevents a job from monopolizing the system

Privileged
instructions
• Can only be executed by the monitor

Interrupts

• Gives OS more flexibility in controlling user programs

Copyright © 2018 Pearson Education, Ltd. All Rights Reserved.


Modes of Operation

User Mode Kernel Mode


• User program executes • Monitor executes in
in user mode kernel mode
• Certain areas of • Privileged instructions
memory are protected may be executed
from user access • Protected areas of
• Certain instructions may memory may be
not be executed accessed

Copyright © 2018 Pearson Education, Ltd. All Rights Reserved.


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

Copyright © 2018 Pearson Education, Ltd. All Rights Reserved.


Multiprogrammed
Batch Systems
I/O
devices
are slow
compared
to
processor
Even
with
automati
c job
sequenci
ng
Processor is
often idle

Copyright © 2018 Pearson Education, Ltd. All Rights Reserved.


Copyright © 2018 Pearson Education, Ltd. All Rights Reserved.
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
Copyright © 2018 Pearson Education, Ltd. All Rights Reserved.
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
Copyright © 2018 Pearson Education, Ltd. All Rights Reserved.
Multiprogramming

 Also known as multitasking


 Memory is expanded to hold three, four, or more programs and
switch among all of them
Copyright © 2018 Pearson Education, Ltd. All Rights Reserved.
Multiprogramming
Example

Table 2.1 Sample Program Execution Attributes

Copyright © 2018 Pearson Education, Ltd. All Rights Reserved.


Copyright © 2018 Pearson Education, Ltd. All Rights Reserved.
Time-Sharing
Systems
 Can be used to handle multiple interactive
jobs
 Processor time is shared among multiple
users
 Multiple users simultaneously access the
system through terminals, with the OS
interleaving the execution of each user
program in a short burst or quantum of
computation
Copyright © 2018 Pearson Education, Ltd. All Rights Reserved.
Table 2.3 Batch Multiprogramming versus Time Sharing

Copyright © 2018 Pearson Education, Ltd. All Rights Reserved.


Compatible Time-
Sharing System
(CTSS)
 One of the first time-sharing operating systems
 Developed at MIT by a group known as Project MAC
 The system was first developed for the IBM 709 in 1961
 Ran on a computer with 32,000 36-bit words of main memory, with
the resident monitor consuming 5000 of that
 Utilized a technique known as time slicing
 System clock generated interrupts at a rate of approximately one every 0.2 seconds
 At each clock interrupt the OS regained control and could assign the processor to
another user
 Thus, at regular time intervals the current user would be preempted and another user
loaded in
 To preserve the old user program status for later resumption, the old user programs and
data were written out to disk before the new user programs and data were read in
 Old user program code and data were restored in main memory when that program was
next given a turn
Copyright © 2018 Pearson Education, Ltd. All Rights Reserved.
Copyright © 2018 Pearson Education, Ltd. All Rights Reserved.
Major Achievements
 Operating Systems are among the most
complex pieces of software ever
developed
 Major advances in development include:
 Processes
 Memory management
 Information protection and security
 Scheduling and resource management
 System structure

Copyright © 2018 Pearson Education, Ltd. All Rights Reserved.


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

Copyright © 2018 Pearson Education, Ltd. All Rights Reserved.


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
Copyright © 2018 Pearson Education, Ltd. All Rights Reserved.
Process
Management
 The entire state of
the process at any
instant is contained in
its context

 New features can be


designed and
incorporated into the
OS by expanding the
context to include any
new information
needed to support the
feature
Copyright © 2018 Pearson Education, Ltd. All Rights Reserved.
Causes of Errors
 Improper  Nondeterminate
synchronization program operation
 It is often the case that a  When programs share
routine must be suspended memory, and their execution is
awaiting an event elsewhere in interleaved by the processor,
the system they may interfere with each
 Improper design of the other by overwriting common
signaling mechanism can result memory areas in unpredictable
in loss or duplication ways
 Failed mutual exclusion  The order in which programs
 More than one user or program are scheduled may affect the
attempts to make use of a shared outcome of any particular
resource at the same time program
 There must be some sort of mutual
 Deadlocks
exclusion mechanism that permits  It is possible for two or
only one routine at a time to more programs to be
perform an update against the file hung up waiting for
each other
Copyright © 2018 Pearson Education, Ltd. All Rights Reserved.
Memory
Management
 The OS has five principal storage
management responsibilities:

Automatic
Support of
allocation Protection
Process modular Long-term
and and access
isolation programmi storage
manageme control
ng
nt

Copyright © 2018 Pearson Education, Ltd. All Rights Reserved.


Virtual Memory
A facility that allows programs to
address memory from a logical point of
view, without regard to the amount of
main memory physically available
 Conceived to meet the requirement of
having multiple user jobs reside in
main memory concurrently

Copyright © 2018 Pearson Education, Ltd. All Rights Reserved.


Paging
 Allows processes to be comprised of a number
of fixed-size blocks, called pages
 Program references a word by means of a
virtual address, consisting of a page number and
an offset within the page
 Each page of a process may be located anywhere in
main memory
 The paging system provides for a dynamic
mapping between the virtual address used in
the program and a real address (or physical
Copyright © 2018 Pearson Education, Ltd. All Rights Reserved.
Copyright © 2018 Pearson Education, Ltd. All Rights Reserved.
Copyright © 2018 Pearson Education, Ltd. All Rights Reserved.
Information
Protection
and Security
 The nature of the
threat that concerns Main
an organization will
vary greatly
issu Availability
depending on the es
circumstances
 The problem
involves controlling Authenticity Confidentiality
access to computer
systems and the Data
information stored integrity
in them

Copyright © 2018 Pearson Education, Ltd. All Rights Reserved.


Scheduling and
Resource
Management
 Key responsibility
of an OS is
Efficienc Fairness
managing y
resources
 Resource Differential
responsiven
allocation policies ess
must consider:

Copyright © 2018 Pearson Education, Ltd. All Rights Reserved.


Copyright © 2018 Pearson Education, Ltd. All Rights Reserved.
Different
Architectural
Approaches
 Demands on operating systems
require new ways of organizing the
OS
Different approaches and design elements have
been tried:

• Microkernel architecture
• Multithreading
• Symmetric multiprocessing
• Distributed operating systems
• Object-oriented design

Copyright © 2018 Pearson Education, Ltd. All Rights Reserved.


Microkernel
Architecture
 Assigns only a few essential functions
to the kernel:
Address
Interprocess
space Basic
communicatio
manageme scheduling
n (IPC)
nt

 The approach:

Simplifies Well suited to


Provides
implementatio a distributed
flexibility
n environment

Copyright © 2018 Pearson Education, Ltd. All Rights Reserved.


Multithreading
Threa Proce
 Technique in d ss
which a
process, Dispatchable unit of
work
A collection of one or
more threads and

executing an Program counter, stack


pointer
associated system
resources

application, is
divided into By breaking a single
application into
multiple threads, a
threads that Includes a processor
context and its own
programmer has
greater control over the

can run data area for a stack modularity of the


application and the

concurrently
timing of application-
related events

Executes sequentially
and is interruptible

Copyright © 2018 Pearson Education, Ltd. All Rights Reserved.


Symmetric
Multiprocessing
(SMP)
 Term that refers to a computer hardware
architecture and also to the OS behavior that
exploits that architecture
 The OS of an SMP schedules processes or threads
across all of the processors
 The OS must provide tools and functions to exploit
the parallelism in an SMP system
 Multithreading and SMP are often discussed
together, but the two are independent facilities
 An attractive feature of an SMP is that the existence
of multiple processors is transparent to the user
Copyright © 2018 Pearson Education, Ltd. All Rights Reserved.
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
Copyright © 2018 Pearson Education, Ltd. All Rights Reserved.
Copyright © 2018 Pearson Education, Ltd. All Rights Reserved.
OS Design
Distributed Object-Oriented
Operating System Design
 Provides the illusion of a
 Lends discipline to the
single main memory space process of adding modular
and a single secondary extensions to a small kernel
memory space plus other  Enables programmers to
unified access facilities, such customize an operating
as a distributed file system system without disrupting
system integrity
 State of the art for distributed
operating systems lags that  Also eases the development
of uniprocessor and SMP of distributed tools and full-
operating systems blown distributed operating
systems
Copyright © 2018 Pearson Education, Ltd. All Rights Reserved.
Questions
1) An __________ is a program that controls the execution of application programs and
acts as an interface between applications and the computer hardware.

2) The portion of the monitor that is always in main memory and available for execution
is referred to as the _________ .
3) __________ is a technique in which a process, executing an application, is divided into
threads that can run concurrently.

4) Two major problems with early serial processing systems were scheduling and __________ .

5) The central idea behind the simple batch-processing scheme is the use of a piece of software
known as the _________ .

6) Any resource allocation and scheduling policy must consider three factors: Fairness,
Differential responsiveness, and __________ .

7) A __________ is set at the beginning of each job to prevent any single job from
monopolizing the system.

8) The OS has five principal storage management responsibilities: process isolation, automatic
allocation and management, support of modular programming, protection and access control,
and __________ .

Copyright © 2018 Pearson Education, Ltd. All Rights


Reserved.
Questions
9) The earliest computers employed __________ processing, a name derived by the way
the users
have access to the systems.

10) __________ was designed to keep the processor and I/O devices, including storage
devices,
simultaneously busy to achieve maximum efficiency.

11) In a time-sharing, multiprogramming system, multiple users simultaneously access


the
system through __________ .

12) The principal objective of __________ is to maximize processor use.

13) Three major lines of computer system development created problems in timing and
synchronization that contributed to the development of the concept of the process:

multiprogramming batch operation, time sharing, and __________ .

14) ___________ is a facility that allows programs to address memory from a logical
point of
view,
Copyright © 2018 without
Pearson regard
Education, to the amount of main memory physically available.
Ltd. All Rights
Reserved.
Questions
16) The technique where a system clock generates interrupts, and at each clock interrupt the OS
regains control and assigns the processor to another user, is __________ .

A) time slicing B) multithreading

C) round robin D) clock cycle 16


17) is where the OS must prevent independent processes from interfering with each other's memory, both data
and instructions.

A) Support of modular programming B) Process isolation

C) Automatic allocation and management D) Protection and access control


18) A special type of programming language used to provide instructions to the monitor
is __________ .

A) FPL B) JCL
C) DML D) SML

Copyright © 2018 Pearson Education, Ltd. All Rights


Reserved.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy