0% found this document useful (0 votes)
41 views39 pages

Unit-2 OS Components & Structure

This document discusses the components and structure of operating systems. It describes the key components of an operating system as including process management, memory management, file management, I/O device management, secondary storage management, network management, protection and security management, and a command interpreter system. It also discusses the services an operating system provides, such as a user interface, program execution, I/O operations, file system manipulation, communications, error detection, resource allocation, accounting, and protection/security. Finally, it defines a system call as the interface between a user program and the operating system, allowing programs to request services from the OS.

Uploaded by

Amisha Sawant
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)
41 views39 pages

Unit-2 OS Components & Structure

This document discusses the components and structure of operating systems. It describes the key components of an operating system as including process management, memory management, file management, I/O device management, secondary storage management, network management, protection and security management, and a command interpreter system. It also discusses the services an operating system provides, such as a user interface, program execution, I/O operations, file system manipulation, communications, error detection, resource allocation, accounting, and protection/security. Finally, it defines a system call as the interface between a user program and the operating system, allowing programs to request services from the OS.

Uploaded by

Amisha Sawant
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/ 39

Unit 2:Operating System Components &

Structure
Objectives

■ To describe components of Operating


system
■ To describe the services an operating
system provides to users, processes, and
other systems
■ To describe what is System call and
System Program?
■ To discuss the various ways of structuring
an operating system

Operating System Concepts 2.2 Silberschatz, Galvin and Gagne ©2005


Components of Operating System
An operating system is a large and complex system that can only be
created by partitioning into small parts. These pieces should be a well-
defined part of the system, carefully defining inputs, outputs, and functions

There are the following components of an operating system

• Process Management
• File Management
• Network Management
• Main Memory Management
• Secondary Storage Management
• I/O Device Management
• Security Management
• Command Interpreter System
Components of Operating System
OS Components: 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.
• 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
OS Components: 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
OS Components: 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
OS Components: I/O Device Management
The I/O system consists of :
✦ A buffer-caching system
✦ A general device-driver interface
✦ Drivers for specific hardware device

OS Components: 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
OS Components: Network Management
Network management (in distributed system) is the process of
administering and managing computer networks. It includes
performance management, provisioning of networks, fault
analysis, and maintaining the quality of service.
■ A distributed system is a collection of machines connected
through a communication network, communication takes place
using a protocol.
Network management provides functions such as:
It helps to access shared resources that help computation to
speed up or offers data availability and reliability.
■ Access to a shared resource allows:
✦ Computation speed-up
✦ Increased data availability
✦ Enhanced reliability
OS Components: Protection & Security Management

■ Protection refers to a mechanism for controlling access by


programs, processes, or users to both system and user
resources.

■ The protection mechanism must:


✦ distinguish between authorized and unauthorized usage.
✦ specify the controls to be imposed.
✦ provide a means of enforcement
OS Components:Command Interpreter system

• One of the most important components of an operating system is its


command interpreter.
• The command interpreter is the primary interface between the user and
the rest of the system.
• Many commands are given to the operating system by control
statements.
• A program that reads and interprets control statements is automatically
executed when a new job is started, its function is quite simple, get the
next command statement, and execute it.
• The command statements deal with process management, I/O handling,
secondary storage management, main memory management, file
system access, protection, and networking.
Operating System Services
■ One set of operating-system services provides functions that are
helpful to the user:
● User interface - Almost all operating systems have a user
interface (UI)
 Varies between Command-Line (CLI), Graphics User
Interface (GUI)
● Program execution - The system must be able to load a
program into memory and to run that program, 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.
● File-system manipulation - The file system is of
particular interest. Obviously, programs need to read and
write files and directories, create and delete them, search
them, list file Information, permission management.

Operating System Concepts 2.12 Silberschatz, Galvin and Gagne ©2005


Operating System Services (Cont.)
■ One set of operating-system services provides functions that are
helpful to the user (Cont):
● Communications – Processes may exchange information, on
the same computer or between computers over a network
 Communications may be via shared memory or through
message passing (packets moved by the OS)
● 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
 Debugging facilities can greatly enhance the user’s and
programmer’s abilities to efficiently use the system
Operating System Concepts 2.13 Silberschatz, Galvin and Gagne ©2005
Operating System Services (Cont.)
■ Another set of OS functions exists 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
 Many types of resources - Some (such as CPU
cycles, main memory, and file storage) may have
special allocation code, others (such as I/O devices)
may have general request and release code.
● Accounting - To keep track of which users use how much
and what kinds of computer resources

Operating System Concepts 2.14 Silberschatz, Galvin and Gagne ©2005


Operating System Services (Cont.)
● 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
 Protection involves ensuring that all access to system
resources is controlled
 Security of the system from outsiders requires user
authentication, extends to defending external I/O devices
from invalid access attempts

Operating System Concepts 2.15 Silberschatz, Galvin and Gagne ©2005


System Calls
■ A system call is a way for a user program to interface with the
operating system. The program requests several services, and
the OS responds by invoking a series of system calls to satisfy
the request.
■ A system call can be written in assembly language or a high-
level language
■ It is a Programming interface to the services provided by the
OS
■ Mostly accessed by programs via a high-level Application
Program Interface (API) rather than direct system call use
■ The Application Program Interface (API) connects the
operating system's functions to user programs
■ 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), and Java API for the Java virtual
machine (JVM)
Operating System Concepts 2.16 Silberschatz, Galvin and Gagne ©2005
Example of System Calls
■ System call sequence to copy the contents of one file to another file

Operating System Concepts 2.17 Silberschatz, Galvin and Gagne ©2005


System Call Implementation
■ Typically, a number associated with each system call
● System-call interface maintains a table indexed according to
these numbers
■ The system call interface invokes intended system call in OS
kernel and returns status of the system call and any return values
■ The caller need know nothing about how the system call is
implemented
● Just needs to obey API and understand what OS will do as a
result call
● Most details of OS interface hidden from programmer
by API
 Managed by run-time support library (set of functions built
into libraries included with compiler)

Operating System Concepts 2.18 Silberschatz, Galvin and Gagne ©2005


API – System Call – OS Relationship

Operating System Concepts 2.19 Silberschatz, Galvin and Gagne ©2005


Standard C Library Example
■ C program invoking printf() library call, which calls write() system call

Operating System Concepts 2.20 Silberschatz, Galvin and Gagne ©2005


Types of System Calls
■ Process control
■ File management
■ Device management
■ Information maintenance
■ Communications

Operating System Concepts 2.21 Silberschatz, Galvin and Gagne ©2005


Process Control

■ End, abort, load, execute, create process,


terminate process
■ Get process attributes, set process
attributes
■ Wait for time, wait event, signal event
■ Allocate and free memory

Operating System Concepts 2.22 Silberschatz, Galvin and Gagne ©2005


File & Device Management

■ File Management:
● Create, delete, copy, rename, print, list, and generally
manipulate files and directories
● Open, close
● Read, write, reposition
● Get file attributes, set file attributes

■ Device Management:
● Request device, release device
● Red, write, reposition
● Get device attributes, set device attributes

Operating System Concepts 2.23 Silberschatz, Galvin and Gagne ©2005


Information Maintenances &
Communication
■ Information Maintenance:
● Get time or date, set time or date
● Get system data, set system data
● Get (set) file, device, or process attributes

■ Communication - Provide the mechanism for creating virtual


connections among processes, users, and computer
systems
● Allow users to send messages to one another’s screens

● Transfer status information


● Browse web pages, send electronic-mail messages, log in
remotely, transfer files from one machine to another

Operating System Concepts 2.24 Silberschatz, Galvin and Gagne ©2005


System Programs

■ System programs also known as system utilities,provide a


convenient environment for program development and
execution. They can be divided into:
● File Management
● Status information
● File modification
● Programming-language support
● Program loading and execution
● Communications

Operating System Concepts 2.25 Silberschatz, Galvin and Gagne ©2005


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
1. File management - Create, delete, copy, rename, print, dump, list,
and generally manipulate files and directories
2. Status information
● Some ask the system for info - date, time, amount of available
memory, disk space, number of users
● Others provide detailed performance, logging, and debugging
information
● Typically, these programs format and print the output to the terminal
or other output devices
● Some systems implement a registry - used to store and
retrieve configuration information

Operating System Concepts 2.26 Silberschatz, Galvin and Gagne ©2005


System Programs (cont.)

3. File modification
● Text editors to create and modify files
● Special commands to search contents of files or perform
transformations of the text
4. Programming-language support - Compilers, assemblers,
debuggers and interpreters sometimes provided
5. Program loading and execution- Absolute loaders,
relocatable loaders, linkage editors, and overlay-loaders,
debugging systems for higher-level and machine language
6. Communications - Provide the mechanism for creating
virtual connections among processes, users, and computer
systems

Operating System Concepts 2.27 Silberschatz, Galvin and Gagne ©2005


Operating System Design and
Implementation
■ Design and Implementation of OS not “solvable”, but some
approaches have proven successful
■ Internal structure of different Operating Systems can
vary widely
■ Start by defining goals and specifications
■ Affected by choice of hardware, type of system (batch, time-
shared, single user, multiple user,…)
■ 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

Operating System Concepts 2.28 Silberschatz, Galvin and Gagne ©2005


Operating System Design and
Implementation (Cont.)
■ Important principle to separate
Policy: What will be
done? Mechanism: How to
do it?
■ Mechanisms determine how to do something,
policies decide what will be done
● The separation of policy from mechanism is a very
important principle, it allows maximum flexibility if policy
decisions are to be changed later

Operating System Concepts 2.29 Silberschatz, Galvin and Gagne ©2005


1. Simple/Monolithic Structure

■ Simple/Monolithic OS is very basic Operating


system structure written to provide the most
functionality in the least space
● Not divided into modules
● The entire operating system works in the
kernel space in the monolithic system.
This increases the size of the kernel as
well as the operating system.
● Example is MS-DOS in which interfaces and levels of
functionality are not well separated
● This is an old operating system used to perform small
tasks like batch processing and time-sharing tasks

Operating System Concepts 2.30 Silberschatz, Galvin and Gagne ©2005


Advantages of Monolithic Kernel
Here are the following advantages of a monolithic kernel:
• The execution of the monolithic kernel is quite fast as the services such
as memory management, file management, process scheduling, etc.are
implemented under the same address space.
• A process runs completely in single address space in the monolithic
kernel.

Disadvantages of Monolithic Kernel


Here are some disadvantages of the monolithic kernel:
• If any service fails in the monolithic kernel, it leads to the failure of the
entire system.
• The entire operating system needs to be modified by the user to add any
new service.
2. Layered structure of Operating System

• 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.
• Layering provides a distinct advantage in an operating
system. All the layers can be defined separately and
interact with each other as required.
• Also, it is easier to create, maintain and update the system
if it is done in the form of layers. Change in one layer
specification does not affect the rest of the layers.
• Each of the layers in the operating system can only
interact with the layers that are above and below it.
• The lowest layer handles the hardware and the uppermost
layer deals with the user applications.

Operating System Concepts 2.33 Silberschatz, Galvin and Gagne ©2005


• The major difficulty with layered approach is how to define
various layers. Because a can use only lower level layers,
careful planning is necessary.

• For example, device driver for backing store must be at a


lower level than memory management routines, because
memory management requires the ability to use backing
store
Layered Operating System

Operating System Concepts 2.35 Silberschatz, Galvin and Gagne ©2005


Microkernel System Structure
■ This method structures the operating system by removing
many of the components from kernel into “user” space and
implementing them as system and user level programs
■ Hence kernel becomes smaller and called Microkernel
• The basic idea of microkernel design is to achieve high
reliability by splitting the operating system up into small,
well-defined modules.
• The main function of microkernel is to provide a
communication facility between the client program and
various services that are running in user space
• All new services are added to the user space and the
kernels don’t need to be modified.
• Microkernel provides high security and reliability because
most of the services are running in user space, if a service
fails the rest of the operating system remains untouched

Operating System Concepts 2.36 Silberschatz, Galvin and Gagne ©2005


Microkernel structure of OS
Microkernel structure of OS
■ 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
THANK - YOU

You might also like