Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
10 views18 pages

Chapter 2

Uploaded by

ahmed
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)
10 views18 pages

Chapter 2

Uploaded by

ahmed
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
You are on page 1/ 18

Chapter 2: Operating System

Structures

Operating System Concepts Silberschatz, Galvin and Gagne ©2013


Operating-System Operation
 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.
 CPU moves data from/to main memory to/from
local buffers
 I/O is from the device to local buffer of controller.
 Device controller informs CPU that it has finished
its operation by causing an interrupt.

Operating System Concepts 1.2 Silberschatz, Galvin and Gagne ©2013


Operating System Components
 Process Management
 Main Memory Management
 Secondary-Storage Management
 I/O System Management
 File Management
 Protection System
 Networking
 Command-Interpreter System

Operating System Concepts 1.3 Silberschatz, Galvin and Gagne ©2013


Process Management

 A process is a program in execution. A process needs


certain resources, including CPU time, memory, files,
and I/O devices, to accomplish its task.
 The operating system is responsible for the following
activities in connection with process management.
 Process creation and deletion.
 process suspension and resumption.
 Provision of mechanisms for:
process synchronization
process communication

Operating System Concepts 1.4 Silberschatz, Galvin and Gagne ©2013


Main-Memory Management

 Memory is a large array of words or bytes, each with its


own address. It is a repository of quickly accessible data
shared by the CPU and I/O devices.
 Main memory is a volatile storage device. It loses its
contents in the case of system failure.
 The operating system is responsible for the following
activities in connections with memory management:
 Keep track of which parts of memory are currently
being used and by whom.
 Decide which processes to load when memory space
becomes available.
 Allocate and deallocate memory space as needed.
Operating System Concepts 1.5 Silberschatz, Galvin and Gagne ©2013
Secondary-Storage Management

 Since main memory (primary storage) is volatile and too


small to accommodate all data and programs
permanently, the computer system must provide
secondary storage to back up main memory.
 Most modern computer systems use disks as the
principle on-line storage medium, for both programs and
data.
 The operating system is responsible for the following
activities in connection with disk management:
 Free space management
 Storage allocation
 Disk scheduling
Operating System Concepts 1.6 Silberschatz, Galvin and Gagne ©2013
File Management

 A file is a collection of related information defined by its


creator. Commonly, files represent programs (both
source and object forms) and data.
 The operating system is responsible for the following
activities in connections with file management:
 File creation and deletion.
 Directory creation and deletion.
 Support of primitives for manipulating files and
directories.
 Mapping files onto secondary storage.
 File backup on stable (nonvolatile) storage media.

Operating System Concepts 1.7 Silberschatz, Galvin and Gagne ©2013


Operating System Services

 Operating systems provide an environment for the


execution of programs.
 Operating systems provides certain services to:
 Programs
 Users of those programs
 Basically two types of services:
 Set of operating-system services provides functions
that are helpful to the user:
 Set of operating-system functions for ensuring the
efficient operation of the system itself via resource
sharing

Operating System Concepts 1.8 Silberschatz, Galvin and Gagne ©2013


A View of Operating System Services

Operating System Concepts 1.9 Silberschatz, Galvin and Gagne ©2013


System Calls
 Programming interface to the services provided by the
OS
 Typically written in a high-level language (C or C++)
 Mostly accessed by programs via a high-level
Application Programming Interface (API) rather than
direct system call
 Three most common APIs are:
 Win32 API for Windows,
 POSIX API for POSIX-based systems (including
virtually all versions of UNIX, Linux, and Mac OS X),
 Java API for the Java virtual machine (JVM)

Note that the system-call names used throughout this


text are generic
Operating System Concepts 1.10 Silberschatz, Galvin and Gagne ©2013
Types of System Calls
 System calls can be grouped roughly into six major
categories:
 Process control,
 File manipulation,
 Device manipulation,
 Information maintenance,
 Communications,
 Protection.
 The figure in the slide # 28 summarizes the types of
system calls normally provided by an operating system.

Operating System Concepts 1.11 Silberschatz, Galvin and Gagne ©2013


Operating System Structure

 Various ways to structure an operating


system:
 Monolithic structure
Simple structure – MS-DOS
More complex – UNIX
More complex – Linux
 Layered – An abstraction
 Microkernel - Mach

Operating System Concepts 1.12 Silberschatz, Galvin and Gagne ©2013


MS-DOS

 MS-DOS – written to
provide the most
functionality in the least
amount of space
 MS-DOS was limited by
hardware funcionality.
 Not divided into
modules
 Although MS-DOS
has some structure,
its interfaces and
levels of functionality
are not well separated
Operating System Concepts 1.13 Silberschatz, Galvin and Gagne ©2013
Layered Approach
 A system can be made modular in many
ways. One method is the layered approach,
in which the operating system is broken into
a number of layers (levels). The bottom layer
(layer 0) is the hardware; the highest (layer
N) is the user interface.

Operating System Concepts 1.14 Silberschatz, Galvin and Gagne ©2013


Layered Approach (Cont.)
 A typical operating-system layer -- say, layer M -- consists of data
structures and a set of routines that can be invoked by higher-level
layers. Layer M in turn, can invoke operations on lower-level layers.
 Each layer is implemented only with operations provided by lower-
level layers. A layer does not need to know how these operations are
implemented; it needs to know only what these operations do.
 The main advantage of the layered approach is simplicity of
construction and debugging. The layers are selected so that each
uses functions (operations) and services of only lower-level layers.
 This approach simplifies debugging and system verification. The first
layer can be debugged without any concern for the rest of the
system. Once the first layer is debugged, its correct functioning can
be assumed while the second layer is debugged, and so on. If an
error is found during the debugging of a particular layer, the error
must be on that layer.

Operating System Concepts 1.15 Silberschatz, Galvin and Gagne ©2013


Microkernel System Structure
 Moves as much from the kernel into user space
 Mach example of microkernel
 Mac OS X kernel (Darwin) partly based on Mach
 Communication takes place between user modules using message
passing
 Benefits:
 Easier to extend a microkernel
 Easier to port the operating system to new architectures
 More reliable (less code is running in kernel mode)
 More secure
 Detriments:
 Performance overhead of user space to kernel space
communication

Operating System Concepts 1.16 Silberschatz, Galvin and Gagne ©2013


Microkernel System Structure

Application File Device user


Program System Driver mode

messages messages

Interprocess memory CPU kernel


Communication managment scheduling mode

microkernel

hardware

Operating System Concepts 1.17 Silberschatz, Galvin and Gagne ©2013


Operating System Generation
 Operating systems are designed to run on any of
a class of machines; the system must be
configured for each specific computer site
 SYSGEN program obtains information
concerning the specific configuration of the
hardware system
 Used to build system-specific compiled kernel
or system-tuned
 Can general more efficient code than one
general kernel

Operating System Concepts 1.18 Silberschatz, Galvin and Gagne ©2013

You might also like