You are on page 1of 56

OPERATING SYSTEM

SUSHMA RAWAL

Components of a computer system

SUSHMA RAWAL

Components of a computer system


Hardware provides basic computing resources
CPU, memory, I/O devices

Application programs define the ways in


which the system resources are used to solve
the computing problems of the users
Word processors, compilers, web browsers,
database systems, video games

Users
People, machines

Operating system
Controls and coordinates use of hardware among
various applications and users
SUSHMA RAWAL

Operating System
Operating System
is a program that manages the computer
hardware.
Provides basis for application programs
acts as an intermediary between the user
and computer hardware.

SUSHMA RAWAL

Operating System
Goals of OS
Efficient use of computer system when
shared by many users.
User convenience - PC.

SUSHMA RAWAL

Operating System
Operating System controls the execution of
application programs and coordinates the
use of the hardware among various
application programs for various users.

SUSHMA RAWAL

Operating System
OS can be viewed as
Resource Allocator- Manages all resources
i.e CPU time, memory space, file-storage space,
I/O devices etc.
- Decides between conflicting requests for
efficient and fair resource use
Control program- Manages execution of
programs to prevent errors. It is concerned with
operation and control of I/O devices
SUSHMA RAWAL

Defining operating systems


Goal of computer systems is to execute user
programs and to make solving user
problems easier.
Therefore computer hardware is constructed
and application programs are developed.
The common functions of controlling and
allocating resources are then brought
together into one piece of software : OS

SUSHMA RAWAL

Computer System Organization


Computer-system
CPU, device controllers connect through
common bus providing access to shared
memory
Concurrent execution of CPUs and devices
competing for memory cycles

SUSHMA RAWAL

Computer System Organization

SUSHMA RAWAL

10

Computer Startup
bootstrap program is loaded at power-up
or reboot
Typically stored in ROM or EEPROM,
generally known as firmware
Initializes all aspects of system from CPU
registers to device controllers
Loads operating system kernel

SUSHMA RAWAL

11

Computer-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
SUSHMA RAWAL

12

Common Functions of Interrupts


The occurrence of an event is signaled by an
interrupt.
Interrupt transfers control to the interrupt service
routine generally, through the interrupt vector,
which contains the addresses of all the service
routines.
Interrupt architecture must save the address of the
interrupted instruction.
Incoming interrupts are disabled while another
interrupt is being processed to prevent a lost
interrupt.
SUSHMA RAWAL

13

Common Functions of Interrupts


A trap is a software-generated interrupt
caused either by an error or a user request.
An operating system is interrupt driven.

SUSHMA RAWAL

14

Structure of an OS
Kernel
Non kernel programs
User interface

SUSHMA RAWAL

15

Structure of an OS
Kernel
- core of the OS
- controls the operation of the computer
- provides a set of functions and services to
use the CPU and resources of the computer.

SUSHMA RAWAL

16

Structure of an OS
Non-kernel programs
- implement user commands
- they use the facilities provided by kernel
programs to interact with the hardware.

SUSHMA RAWAL

17

Structure of an OS
Programs in the user interface
- provide a command line interface or GUI
to the user.
- these programs use the facilities of the
non-kernel programs.
- user interacts with the programs in the
user interface to request use of resources
and services provided by the system

SUSHMA RAWAL

18

Operating-System Structures

System Components
Operating System Services
System Calls
System Programs
System Structure

SUSHMA RAWAL

19

System Components

Process Management
Main Memory Management
File Management
I/O System Management
Secondary Memory Management
Networking
Protection System
Command-Interpreter System
SUSHMA RAWAL

20

Process Management
A process is a program in execution.
A process needs certain resources: 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

SUSHMA RAWAL

21

Main-Memory Management
Memory is a large array of bytes, each with its own
address.
Main memory 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.

SUSHMA RAWAL

22

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.
- File backup on stable (nonvolatile) storage media.
SUSHMA RAWAL

23

I/O System Management


Operating system hides the peculiarities of
specific hardware devices from the user.
The I/O system consists of:
A buffer system
A general device-driver interface
Drivers for specific hardware devices

SUSHMA RAWAL

24

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 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
SUSHMA RAWAL

25

Networking (Distributed Systems)


A distributed system is a collection of
physically separate, possibly heterogeneous
computer systems that are networked to
provide the users with access to various
resources that the system maintains.
The processors in the system are connected
through a communication network.

SUSHMA RAWAL

26

Networking (Distributed Systems)


Communication takes place using a
protocol.
A distributed system provides user access to
various system resources.
Access to a shared resource allows:
Computation speed-up
Increased functionality
Increased data availability
SUSHMA RAWAL

27

Protection System
Protection refers to a mechanism for
controlling access of programs, processes,
or users to resources.
The protection mechanism must:
distinguish between authorized and
unauthorized usage.
specify the controls to be imposed.
provide a means of enforcement.

SUSHMA RAWAL

28

Command-Interpreter System
An important systems programs for OS is
command interpreter.
It is an interface between user and the OS.
Many commands are given to the operating
system by control statements which deal with:

process creation and management


I/O handling
secondary-storage management
main-memory management
file-system access
protection
networking
SUSHMA RAWAL

29

Command-Interpreter System (Cont.)


The program that reads and interprets
control statements is called variously:
-command-line interpreter
shell (in UNIX)

Its function is to get and execute the next


command statement.

SUSHMA RAWAL

30

Operating System Services


Program execution system capability to
load a program into memory and to run it.
I/O operations for protection and
efficiency, user programs cannot control I/O
devices directly, the operating system must
provide some means to perform I/O.
File-system manipulation program
capability to read, write, create, and delete
files.
SUSHMA RAWAL

31

Operating System Services


Communications exchange of information
between processes executing either on the same
computer or on different systems tied together by
a network. Implemented via shared memory or
message passing.
Error detection ensure correct and consistent
computing by detecting errors in the CPU and
memory hardware, in I/O devices, or in user
programs by taking appropriate action.

SUSHMA RAWAL

32

Additional Operating System Functions


Additional functions for ensuring efficient
system operations.
Resource allocation allocating resources to
multiple users or multiple jobs running at the
same time.
Accounting keep track of and record which
users use how much and what kinds of
computer resources for account billing or for
accumulating usage statistics.
Protection ensuring that all access to system
resources is controlled.
SUSHMA RAWAL

33

System Calls
System calls provide an interface to the
services made available by the operating
system.
Generally available as assembly-language
instructions.
Languages defined to replace assembly
language for systems programming allow
system calls to be made directly (e.g., C, C++)

SUSHMA RAWAL

34

System Calls
Parameters need to be passed for some of the
system calls
Three general methods are used to pass parameters
between a running program and the operating
system.
Pass parameters in registers.
Store the parameters in a table in memory, and the table
address is passed as a parameter in a register.
Push (store) the parameters onto the stack by the
program, and pop off the stack by operating system.

SUSHMA RAWAL

35

Passing of Parameters As A Table

SUSHMA RAWAL

36

Types of System Calls

Process control
File management
Device management
Information maintenance
Communications

SUSHMA RAWAL

37

Types of System Calls


Process control

Create process, terminate process


Get process attributes, set process attributes
Wait event, signal event
Wait for time
End , abort

SUSHMA RAWAL

38

Types of System Calls


File management

Create file, delete file


Open, close
Read, write
Get file attributes, set file attributes

SUSHMA RAWAL

39

Types of System Calls


Device management

Request device, release device


Read, write
Get file attributes, set file attributes
Logically attach or detach devices

SUSHMA RAWAL

40

Types of System Calls


Information maintenance

Get time or date, set time or date


Get system data, set system data
Get process file, or device attributes
Set process file, or device attributes

SUSHMA RAWAL

41

Types of System Calls


Communications

Create, delete communication connection


Send, receive messages
Transfer status information
Attach or detach remote devices.

SUSHMA RAWAL

42

System Programs
System programs/system utilities provide a
convenient environment for program development
and execution.
They can be divided into:

File manipulation
Status information
File modification
Programming language support
Program loading and execution
Communications

Most users view of the operating system is defined by


system programs, not the actual system calls.
SUSHMA RAWAL

43

UNIX System Structure


UNIX the original UNIX operating system
had limited structuring. The UNIX OS
consists of two separable parts.
Systems programs
The kernel
Consists of everything below the system-call
interface and above the physical hardware
Provides the file system, CPU scheduling, memory
management, and other operating-system functions;
a large number of functions for one level.

SUSHMA RAWAL

44

UNIX System Structure

SUSHMA RAWAL

45

UNIX System Structure


Unix system structure was monolithic structure.
Large amount of functionality was combined into
one level
It was difficult to implement and maintain.

SUSHMA RAWAL

46

Layered Approach
The operating system is divided into a number of
layers (levels), each built on top of lower layers.
The bottom layer (layer 0), is the hardware; the
highest (layer N) is the user interface.
With modularity, layers are selected such that each
uses functions (operations) and services of only
lower-level layers.

SUSHMA RAWAL

47

An Operating System Layer

SUSHMA RAWAL

48

Kernel Space and User Space


 The program code corresponding to the kernel
applications/services are kept in a contiguous area (OS
dependent) of primary (working) memory and is protected
from
the
un-authorized
access
by
user
programs/applications
 The memory space at which the kernel code is located is
known as Kernel Space
 All user applications are loaded to a specific area of
primary memory and this memory area is referred as User
Space

SUSHMA RAWAL

49

Kernel Space and User Space


 The partitioning of memory into kernel and user space is
purely Operating System dependent
 Most of the operating systems keep the kernel application
code in main memory and it is not swapped out into the
secondary memory

SUSHMA RAWAL

50

Monolithic Kernel
 All kernel services run in the kernel space
 All kernel modules run within the same memory space
under a single kernel thread
 The tight internal integration of kernel modules in
monolithic kernel architecture allows the effective
utilization of the low-level features of the underlying
system
 The major drawback of monolithic kernel is that any error
or failure in any one of the kernel modules leads to the
crashing of the entire kernel application
 LINUX, SOLARIS, MS-DOS kernels are examples of
monolithic kernel
SUSHMA RAWAL

51

Monolithic Kernel

Applications

Monolithic kernel with all


operating system services
running in kernel space

SUSHMA RAWAL

52

Microkernel
 The microkernel design incorporates only the essential set
of Operating System services into the kernel
 Rest of the Operating System services are implemented in
programs known as Servers which runs in user space
 All servers are kept separate and run in different address
spaces
 The kernel design is highly modular and provides OSneutral abstraction
 Memory management, process management, timer systems
and interrupt handlers are examples of essential services,
which forms the part of the microkernel
SUSHMA RAWAL

53

Microkernel
 The communication in microkernels is done via message
passing.
 The servers communicate through IPC (Interprocess
Communication).
 Servers invoke "services" from each other by sending
messages.
 Mach, QNX, Minix 3, windows NT kernels are examples
for microkernel

SUSHMA RAWAL

54

Microkernel
Servers (kernel
services running
in user space)

Applications

Microkernel with essential


services like memory
management, process
management, timer system etc...
SUSHMA RAWAL

55

Microkernel
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

SUSHMA RAWAL

56

You might also like