chapter no 2 power point of operating system

rabiyanaseer1 8 views 42 slides Mar 05, 2025
Slide 1
Slide 1 of 42
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34
Slide 35
35
Slide 36
36
Slide 37
37
Slide 38
38
Slide 39
39
Slide 40
40
Slide 41
41
Slide 42
42

About This Presentation

Operating system structure all detail


Slide Content

Silberschatz, Galvin and Gagne ©2013Operating System Concepts – 9
th
Edition
Chapter 2: Operating-System
Structures

2.2 Silberschatz, Galvin and Gagne ©2013
Operating System Concepts – 9
th
Edition
Operating System Services
Operating systems provide an environment for execution of
programs and services (helpful functions) to programs and
users
User services:
User interface
Command-Line (CLI), Graphics User Interface (GUI),
Batch
Program execution - Loading a program into memory
and running it, end execution, either normally or
abnormally (indicating error)
I/O operations - A running program may require I/O,
which may involve a file or an I/O device
Q: What is Batch processing?

2.3 Silberschatz, Galvin and Gagne ©2013
Operating System Concepts – 9
th
Edition
Operating System Services (Cont.)
User services (Cont.):
File-system manipulation - Programs need to read and
write files and directories, create and delete them, search
them, list file Information, permission management.
Communications – Processes may exchange
information, on the same computer or between computers
over a network
Error detection – OS needs to be constantly aware of
possible errors
May occur in the CPU and memory hardware, in I/O
devices, in user program
For each type of error, OS should take the appropriate
action to ensure correct and consistent computing

2.4 Silberschatz, Galvin and Gagne ©2013
Operating System Concepts – 9
th
Edition
Operating System Services (Cont.)
System services:
For ensuring the efficient operation of the system itself via
resource sharing
Resource allocation - When multiple users or multiple
jobs running concurrently, resources must be allocated to
each of them
Accounting - To keep track of which users use how much
and what kinds of computer resources
Protection and security - The owners of information
stored in a multiuser or networked computer system may
want to control use of that information, concurrent
processes should not interfere with each other. Security
involves making the system secure from external attacks.
User authentication is used.

2.5 Silberschatz, Galvin and Gagne ©2013
Operating System Concepts – 9
th
Edition
A View of Operating System Services

2.6 Silberschatz, Galvin and Gagne ©2013
Operating System Concepts – 9
th
Edition
User Operating System Interface - CLI
CLI or command interpreter allows direct command entry
Sometimes implemented in kernel, sometimes by systems program
Primarily fetches a command from user and executes it
a shell is
a computer program which exposes an 
operating system's
services
to a human user or other program. In general, operating system
shells
use either a
 
command-line interface 
(CLI)
or 
graphical user
interface
 
(GUI),
depending on a computer's role and particular operation. It
is
named a shell because it is the outermost layer around the operating
system
Command-line
shells require the user to be familiar with commands and their
calling syntax,
and to understand concepts about the shell-specific scripting
language
(for example, 
bash).
Graphical
shells place a low burden on beginning computer users, and are
characterized
as being easy to use. Since they also come with certain
disadvantages,
most GUI-enabled operating systems also provide CLI
shells.

2.7 Silberschatz, Galvin and Gagne ©2013
Operating System Concepts – 9
th
Edition
User Operating System Interface - GUI
User-friendly desktop
Usually mouse, keyboard, and monitor
Icons represent files, programs, actions,
etc
Many systems now include both CLI and
GUI interfaces

2.8 Silberschatz, Galvin and Gagne ©2013
Operating System Concepts – 9
th
Edition
Touchscreen Interfaces
Touchscreen devices
require new interfaces
Mouse not possible or
not desired
Actions and selection
based on gestures
Virtual keyboard for
text entry
Voice commands.

2.9 Silberschatz, Galvin and Gagne ©2013
Operating System Concepts – 9
th
Edition
System Calls
Typically written in a high-level language (C
or C++)
System calls provide interface to the
services made available by an operating
system
Mostly accessed by programs via a high-
level Application Programming Interface
(API) rather than direct system call use
Three most common APIs are
Win32 API for Windows,
POSIX API for POSIX-based systems (UNIX, Linus, Mac
IOS)
Java API for the Java virtual machine (JVM)

2.10 Silberschatz, Galvin and Gagne ©2013
Operating System Concepts – 9
th
Edition
Example of System Calls
System call sequence to copy the contents of one file to another file

2.11 Silberschatz, Galvin and Gagne ©2013
Operating System Concepts – 9
th
Edition
Types of System Calls
Process control
create process, terminate process
end, abort
load, execute
get process attributes, set process attributes
wait for time
wait event, signal event
allocate and free memory
Dump memory if error
Debugger for determining bugs, single step execution
Locks for managing access to shared data between
processes

2.12 Silberschatz, Galvin and Gagne ©2013
Operating System Concepts – 9
th
Edition
Types of System Calls
File management
create file, delete file
open, close file
read, write, reposition
get and set file attributes
Device management
request device, release device
read, write, reposition
get device attributes, set device attributes
logically attach or detach devices

2.13 Silberschatz, Galvin and Gagne ©2013
Operating System Concepts – 9
th
Edition
Types of System Calls (Cont.)
Information maintenance
get time or date, set time or date
get system data, set system data
get and set process, file, or device attributes
Communications
create, delete communication connection
send, receive messages if message passing model to
host name or process name
From client to server
transfer status information
attach and detach remote devices

2.14 Silberschatz, Galvin and Gagne ©2013
Operating System Concepts – 9
th
Edition
Types of System Calls (Cont.)
Protection
Control access to resources
Get and set permissions
Allow and deny user access

2.15 Silberschatz, Galvin and Gagne ©2013
Operating System Concepts – 9
th
Edition
Examples of Windows and Unix System Calls

2.16 Silberschatz, Galvin and Gagne ©2013
Operating System Concepts – 9
th
Edition
Standard C Library Example
C program invoking printf() library call, which calls write() system call

2.17 Silberschatz, Galvin and Gagne ©2013
Operating System Concepts – 9
th
Edition
Example: MS-DOS
Single-tasking
Shell invoked when
system booted
Simple method to run
program
No process created
Single memory space
Loads program into
memory, overwriting
all but the kernel
At system startup running a program

2.18 Silberschatz, Galvin and Gagne ©2013
Operating System Concepts – 9
th
Edition
System Programs
Provide a convenient environment for program
development and execution
Some of them are simply user interfaces to system
calls; others are considerably more complex
File management - Create, delete, copy, rename, print,
dump, list, and generally manipulate files and
directories
Status information
Status information can be info - date, time, amount
of available memory, disk space, number of users,
detailed performance, logging, and debugging
information

2.19 Silberschatz, Galvin and Gagne ©2013
Operating System Concepts – 9
th
Edition
System Programs (Cont.)
File modification
Text editors to create and modify files
Special commands to search contents of files
or perform transformations of the text
Programming-language support - Compilers,
assemblers, debuggers and interpreters
sometimes provided
Program loading and execution- All types of
loaders, linkers and debuggers.
Communications - Provide the mechanism for
creating virtual connections among processes,
users, and computer systems

2.20 Silberschatz, Galvin and Gagne ©2013
Operating System Concepts – 9
th
Edition
System Programs (Cont.)
Background Services
Launch at boot time and shut down
Provide facilities like disk checking, process
scheduling, error logging, printing
Application programs
Don’t belong to system
Run by users
Not typically considered part of OS
Launched by command line, mouse click, finger
poke

2.21 Silberschatz, Galvin and Gagne ©2013
Operating System Concepts – 9
th
Edition
Operating System Design and Implementation
Internal structure of different Operating Systems can vary
widely
Start the design by defining goals and specifications
Affected by choice of hardware, type of system (batch, time
sharing, single user, multiuser, distributed, real time, or general
purpose)
Requirements can be divided into: User goals and System
goals
User goals – operating system should be convenient to
use, easy to learn, reliable, safe, and fast
System goals – operating system should be easy to
design, implement, and maintain, as well as flexible,
reliable, error-free, and efficient

2.22 Silberschatz, Galvin and Gagne ©2013
Operating System Concepts – 9
th
Edition
Operating System Design and Implementation (Cont.)
Important principle to separate
Policy: What will be done?
Mechanism: How to do it?
Specifying and designing an OS is
highly creative task of software
engineering

2.23 Silberschatz, Galvin and Gagne ©2013
Operating System Concepts – 9
th
Edition
Implementation
Much variation
Early OSes in assembly language
Then system programming languages like Algol,
PL/1
Now C, C++
Usually, a mix of languages
Lowest levels in assembly
Main body in C
Systems programs in C, C++, scripting languages
like PERL, Python, shell scripts

2.24 Silberschatz, Galvin and Gagne ©2013
Operating System Concepts – 9
th
Edition
Operating System Structure
General-purpose OS is a very large program
How to implement and structure it?
A common approach is to partition OS into modules/ components
Each modules is responsible for one (or several) aspect of the
desired functionality
Each module has carefully defined interfaces
Advantages:
Traditional advantages of modular programming:
–Simplifying development and maintenance of computer
programs, etc
–Modules can be developed independently from each other
Disadvantages:
Efficiency can decrease (vs monolithic approach)

2.25 Silberschatz, Galvin and Gagne ©2013
Operating System Concepts – 9
th
Edition
Operating System Structure (contd)
In general, various ways are used to structure OSes
Many OS’es don’t have well-defined structures
Not one pure model: Hybrid systems
Combine multiple approaches to address
performance, security, usability needs
Simple structure – MS-DOS
More complex structure - UNIX
Layered OSes
Microkernel OSes

2.26 Silberschatz, Galvin and Gagne ©2013
Operating System Concepts – 9
th
Edition
Simple Structure -- MS-DOS
In MS-DOS, the interfaces and
levels of functionality are not well
separated.
Not divided into modules
For instance, application programs
are able to access the basic I/O
routines to write directly to the
display and disk drives. Such
freedom leaves MS-DOS vulnerable
to malicious programs, causing
entire system crashes when user
programs fail.
No hardware protection

2.27 Silberschatz, Galvin and Gagne ©2013
Operating System Concepts – 9
th
Edition
Non Simple Structure -- UNIX
Traditional UNIX has limited structuring
UNIX consists of 2 separable parts:
1.Systems programs
2.Kernel

2.28 Silberschatz, Galvin and Gagne ©2013
Operating System Concepts – 9
th
Edition
Traditional UNIX System Structure
Beyond simple but not fully layered

2.29 Silberschatz, Galvin and Gagne ©2013
Operating System Concepts – 9
th
Edition
Layered Approach to structuring OS
One way to make OS modular – layered
approach
The OS is divided into a number of layers (levels)
Each layer is built on top of lower layers
The bottom layer (layer 0), is the hardware
The highest (layer N) is the user interface
the overall functionality and features are
determined and the separated into components.
Layers are selected such that each uses
functions (operations) and services of only lower-
level layers
Advantages:
simplicity of construction and debugging
Disadvantages:
can be hard to decide how to split
functionality into layers
less efficient due to high overhead
MULTICS is a prominent
example of a layered
operating system, designed
with eight layers formed into
protection rings, whose
boundaries could only be
crossed using specialized
instructions.

2.30 Silberschatz, Galvin and Gagne ©2013
Operating System Concepts – 9
th
Edition
Microkernel System Structure
Main idea:
Move as much from the kernel into the user space
Small
core OS runs at the kernel level
OS
services are built from many independent user-level
processes
Communication takes place between user modules using
message passing
Advantages:
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
Disadvantages:
Performance overhead of user space to kernel space
communication

2.31 Silberschatz, Galvin and Gagne ©2013
Operating System Concepts – 9
th
Edition
Microkernel System Structure
Q:Examples of operating system structures
In Monolithic kernels, the device drivers reside in the kernel
space while in the Microkernel the device drivers reside in the
user space.

2.32 Silberschatz, Galvin and Gagne ©2013
Operating System Concepts – 9
th
Edition
Modules
Many modern operating systems
implement loadable kernel modules
Kernel provides only core services
The rest is via modules
Modules loaded into the kernel space

2.33 Silberschatz, Galvin and Gagne ©2013
Operating System Concepts – 9
th
Edition
Solaris Modular Approach

2.34 Silberschatz, Galvin and Gagne ©2013
Operating System Concepts – 9
th
Edition
Hybrid Systems
Most modern operating systems are
actually not one pure model
Hybrid combines multiple approaches to
address performance, security, usability
needs

2.35 Silberschatz, Galvin and Gagne ©2013
Operating System Concepts – 9
th
Edition

2.36 Silberschatz, Galvin and Gagne ©2013
Operating System Concepts – 9
th
Edition
Mac OS X Structure

2.37 Silberschatz, Galvin and Gagne ©2013
Operating System Concepts – 9
th
Edition
Operating-System Debugging
Debugging is finding and fixing errors, or bugs
OS generate log files containing error information
Failure of an application can generate core dump file capturing memory of the
process
Operating system failure can generate crash dump file containing kernel memory
Beyond crashes, performance tuning can optimize system performance
Sometimes using trace listings of activities, recorded for analysis
Profiling is periodic sampling of instruction pointer to determine which code is
being executed, can show statistical trends but not individual activities
Q: What is core dump and crash dump?

2.38 Silberschatz, Galvin and Gagne ©2013
Operating System Concepts – 9
th
Edition
Performance Tuning
Improve
performance by
removing
bottlenecks
OS must provide
means of computing
and displaying
measures of system
behavior
For example, “top”
program or Windows
Task Manager

2.39 Silberschatz, Galvin and Gagne ©2013
Operating System Concepts – 9
th
Edition
DTrace
DTrace tool in Solaris,
FreeBSD, Mac OS X allows
live instrumentation on
production systems
Probes fire when code is
executed within a provider,
capturing state data and
sending it to consumers of
those probes
Probes are stored in a hash
table that is hashed by name
and indexed according to
unique probe identifier
Example of following
XEventsQueued system call
move from libc library to
kernel and back

2.40 Silberschatz, Galvin and Gagne ©2013
Operating System Concepts – 9
th
Edition
System Boot
How OS is loaded?
When power is initialized on system, execution starts at a
predefined memory location
Firmware ROM is used to hold initial bootstrap program
(=bootstrap loader)
Bootstrap loader
small piece of code
locates the kernel, loads it into memory, and starts it
Sometimes 2-step process is used instead
1.Simple bootstrap loader in ROM loads a more complex boot
program from (a fixed location on) disk
2.This more complex loader loads the kernel

2.41 Silberschatz, Galvin and Gagne ©2013
Operating System Concepts – 9
th
Edition
Computing environment
Traditional computing
Mobile computing
Distributed computing
Client- Server computing
Peer- to – Peer computing
Virtualization
Cloud computing
Real- time embedded systems

Silberschatz, Galvin and Gagne ©2013Operating System Concepts – 9
th
Edition
End of Chapter 2