0% found this document useful (0 votes)
4 views42 pages

Chapter 1 Os

Operating systems serve as an interface between hardware and application programs, managing resources like memory and I/O devices for efficiency and convenience. They evolve over time due to hardware upgrades and new services, transitioning from simple batch systems to more complex multiprogrammed systems. Key functions include process management, resource allocation, and providing user interfaces, with various architectural designs such as monolithic, layered, and microkernel systems.

Uploaded by

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

Chapter 1 Os

Operating systems serve as an interface between hardware and application programs, managing resources like memory and I/O devices for efficiency and convenience. They evolve over time due to hardware upgrades and new services, transitioning from simple batch systems to more complex multiprogrammed systems. Key functions include process management, resource allocation, and providing user interfaces, with various architectural designs such as monolithic, layered, and microkernel systems.

Uploaded by

Glen Dhin
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Operating

Systems:
Internals Chapter 2
and Design
Principles Operating System
Overview
Seventh Edition
By William Stallings
Operating Systems:
Internals and Design Principles
Operating systems are those programs that interface the machine with
the applications programs. The main function of these systems is to
dynamically allocate the shared system resources to the executing
programs. As such, research in this area is clearly concerned with
the management and scheduling of memory, processes, and other
devices. But the interface with adjacent levels continues to shift with
time. Functions that were originally part of the operating system have
migrated to the hardware. On the other side, programmed functions
extraneous to the problems being solved by the application programs
are included in the operating system.

—WHAT CAN BE AUTOMATED?: THE COMPUTER SCIENCE AND


ENGINEERING RESEARCH STUDY,
MIT Press, 1980
Operating System
 Exploits the hardware resources of one or more
processors to provide a set of services to system users
 Manages secondary memory and I/O devices
 An OS is a program that controls the execution of
application programs and acts as an interface between
applications and the computer hardware.
Operating System
Main objectives of an OS:

• Convenience: An OS makes a computer more


convenient to use.
• Efficiency: An OS allows the computer system
resources to be used in an efficient manner.
• Ability to evolve: An OS should be constructed
in such a way as to permit the effective
development, testing, and introduction of new
system functions without interfering with service
efficiency
Operating System
Main Functions of an OS:

• Establish user interface


• Manage the computer's resources, such
as the central processing
unit, memory, disk drives, and printers,
• Execute and provide services for
applications software.
The OS as a
User/Computer Interface

 OS provides services to users


 Program development
 Program execution
 Access I/O devices
 Controlled access to files
 System access
 Error detection and response
 Accounting
The Operating System as a
Resource Manager

Acomputer is a set of resources for


moving, storing, & processing data
 TheOS is responsible for managing
these resources
 TheOS exercises its control
through software
Operating
System
as
Resource
Manager
 Functionsin the same way as ordinary
computer software
 Program, or suite of programs, executed
by the processor
 Frequentlyrelinquishes control and must
depend on the processor to allow it to
regain control
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
Multiprogrammed Systems
Batch Systems
Simple Batch
Systems
Serial
Processing
Serial Processing
Earliest Computers: Problems:
 Scheduling:
 No operating system
 most installations used a
 programmers interacted
hardcopy sign-up sheet to
directly with the computer
reserve computer time
hardware
 time allocations could
 Computers ran from a console run short or long,
with display lights, toggle resulting in wasted
switches, some form of input computer time
device, and a printer
 Setup time
 Users have access to the
computer in “series”  a considerable amount of
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 software
 user no longer has direct access to processor
 user submits the job on cards or tape to a computer
operator, who batches the jobs together sequentially and
places the entire batch on an input device, for use by the
monitor.
 program branches back to the monitor when finished
 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 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
Modes of Operation

User Mode Kernel Mode


• user program executes in • monitor executes in kernel
user mode mode
• certain areas of memory are • privileged instructions may
protected from user access be executed
• certain instructions may not • protected areas of memory
be executed may be 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
Multiprogrammed
Batch Systems
 Processor is
often idle
 even with
automatic
job
sequencing
 I/O devices
are slow
compared to
processor
 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
 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
 also known as multitasking
 memory is expanded to hold three, four, or more programs
and switch among all of them
 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
 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
 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
 A process contains  The execution context is
three components: essential:
 it is the internal data by
 an executable program which the OS is able to
 the associated data supervise and control the
process
needed by the program
 includes the contents of the
(variables, work space, various process registers
buffers, etc.)  includes information such as
the priority of the process and
 the execution context whether the process is waiting
(or “process state”) of for the completion of a
the program particular I/O event
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
 The
OS has five principal storage
management responsibilities:

automatic
support of protection
process allocation long-term
modular and access
isolation and storage
programming control
management
 The nature of the
threat that concerns
an organization will Main
vary greatly issues availability
depending on the
circumstances
authenticity confidentiality
 The problem involves
controlling access to data
computer systems integrity
and the information
stored in them
Scheduling and
Resource Management
 Keyresponsibility of an OS is managing
resources
 Resource allocation policies must consider:

fairness
efficiency

differential
responsiveness
Key Elements of an
Operating System
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
Performance running simultaneously, each on a
different processor

failure of a single process does not


Availability halt the system

Incremental performance of a system can be


enhanced by adding an
Growth additional processor

vendors can offer a range of products


Scaling based on the number of processors
configured in the system
Symmetric Multiprocessor
OS Considerations
 A multiprocessor OS must provide all the functionality of a multiprogramming
system plus additional features to accommodate multiple processors

 Key design issues:

Simultaneous Scheduling Memory Reliability


concurrent Synchronization
management and fault
processes or tolerance
any
threads with multiple the reuse of
processor
may perform active processes physical
kernel routines having potential pages is the the OS
need to be scheduling,
which access to shared biggest should
reentrant to address spaces problem of provide
allow several complicates
the task of or shared I/O concern graceful
processors to resources, care degradation
execute the enforcing a
scheduling must be taken to in the face of
same kernel provide effective processor
code policy
synchronization failure
simultaneously
 Programmatic way in which a computer program
requests a service from the kernel of the operating
system it is executed on.
 A system call is a way for programs to interact with
the operating system.
 System call provides the services of the operating
system to the user programs via Application Program
Interface(API).
 It provides an interface between a process and
operating system to allow user-level processes to
request services of the operating system.
 System calls are the only entry points into the kernel
system. All programs needing resources must use
system calls.
Types of System Calls :
- System Calls for Process Management- end, abort, create,
terminate, allocate and free memory.
- System Calls for File Management- create, open, close,
read file etc.
- System Calls for Directory Management- mount,
- Miscellaneous system calls- chdir, chmod etc.
 Monolithic Systems
 Entire operating system runs as a single program in kernel
mode.
 The operating system is written as a collection of procedures,
linked together into a single large executable binary program.
 When this technique is used, each procedure in the system is
free to call any other one, if the latter provides some useful
computation that the former needs.
 Having thousands of procedures that can call each other
without restriction often leads to an unwieldy and difficult to
understand system.
 Monolithic Systems
 No provision of information hiding
 This organization suggests a basic structure for the operating
system:
 1. A main program that invokes the requested service
procedure.
 2. A set of service procedures that carry out the system calls.
 3. A set of utility procedures that help the service procedures
 Layered Systems
 Operating system is organised as a hierarchy of layers, each
one constructed upon the one below it.

 The main advantage is simplicity of construction and


debugging.
 The main difficulty is defining the various layers. The main
disadvantage is that the OS tends to be less efficient than
other implementations
 Microkernel
 The basic idea behind the microkernel design is to achieve
high reliability by splitting the operating system up into small,
well-defined modules
 Only microkernel runs in kernel mode and the rest run as
relatively powerless ordinary user processes.
 Client Server Model
 Distinguishes two classes of processes, the servers,
each of which provides some service, and the
clients, which use these services.
 Often the lowest layer is a microkernel
 Communication between clients and servers is
often by message passing.

You might also like