0% found this document useful (0 votes)
42 views

Slide-2-OS Operating System Components and Structure-2024

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)
42 views

Slide-2-OS Operating System Components and Structure-2024

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/ 52

Operating Systems

Operating System
Structure

Alok Kumar Jagadev


System Components
• Process Management
• Main Memory Management
• File Management
• I/O System Management
• Secondary Management
• Networking
• Protection System
• Command-Interpreter System
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
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 OS 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.
– Allocate and deallocate memory space as needed.
I/O Management
• Much of the OS kernel is concerned with I/O.
• The OS provides a standard interface between programs (user or
system) and devices.
• Device drivers are the processes/programs responsible for each
device type:
– A driver encapsulates device-specific knowledge
– for device initiation and control, interrupt handling, and errors.
• There may be a process for each device, or even for each I/O request,
depending on the particular OS.
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 principal


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
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.
Protection System
• 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.

• protection mechanisms help to


– detect errors
– prevent malicious destruction
Command Interpreter
• 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
What is a kernel?
• Kernel is a program that is core of an Operating System
• Kernel has control over everything in the system
• It is most important part of an Operating System
• Whenever a system starts, the kernel is the first program that is
loaded to handle the system for the Operating System
• Kernel remains in the memory until the Computer System is shut-
down
What is a kernel? (Contd…)
• Kernel is responsible for low-level tasks such as disk management,
memory management, task management, etc.
• Provides an interface between the user and the hardware
components of the system.
• Kernel is provided with a protected Space which is a separate area
of memory.
– this area is not accessible by other application programs.
Mode of Operation
• Hardware must provide two execution levels:
– Kernel mode
– User mode
Mode of Operation
• Kernel mode
– Processes in kernel mode can access both: kernel and user addresses
– Kernel mode allows an unconditional, unrestricted, and full permission
to access the hardware including execution of privileged instructions
– Various instructions (such as I/O instructions) are privileged and can be
executed only in kernel mode
– The transition from user mode to kernel mode occurs when the
application requests the help of operating system or an interrupt or a
system call occurs.
– A system call from a user program leads to a switch to kernel mode
Mode of Operation
• User mode
– Processes access their own instructions and data but not kernel
instructions and data (or those of other processes).
– When a user application requests a service from OS (via a system call),
the system must transition from user to kernel mode to fulfill the
request.
– Isolated virtual address space for each process in user mode.
– User mode ensures isolated execution of each process so that it does not
affect other processes.
– The system is in user mode when the operating system is running a user
application such as handling a text editor.
Mode of Operation
• Two areas are defined at application level:
– Kernel space: memory area where the kernel executes and provides its
services
– User space: memory locations in which user processes (other than the
kernel) run
High-level View of Kernel Space vs.
User Space

Process 1 Process 2  Process n

The Kernel

Hardware (disks, network interfaces, etc.)


System Calls
• System call: Programming interface to provide services 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 use.
System Calls
§ System calls are usually called when a process in user mode requires
access to a resource.
§ Then it requests the kernel to provide the resource via a system call.
§ Steps to system call:

§ Processes executed in the user


mode till the time a system
call interrupts it.
§ The system call is executed in
the kernel-mode on a priority
basis.
§ Once system call execution is
over, control returns to the
user mode.
§ The execution of user
processes resumed in user
mode.
Need of System Calls
In general, system calls are required in the following situations:
• If a file system requires the creation or deletion of files.
• Reading and writing from/to files
• Creation and management of processes.
• Network connections ( includes sending and receiving packets)
• Access to a hardware devices such as a printer, scanner etc.
Types of System Calls
Five types of system calls used in OS:
• Process Control
• File Management
• Device Management
• Information Maintenance
• Communications
Types of System Calls
• Process control: system calls perform the task of process creation, process
termination, etc.
– End and Abort
– Load and Execute
– Create Process and Terminate Process
– Wait Event
– Allocate and free memory
Types of System Calls
• File management: File management system calls handle file manipulation
jobs like creating a file, reading, and writing, etc.
– create file, delete file
– open, close file
– read, write, reposition
– get and set file attributes

• Device management: Device management does the job of device


manipulation like reading from device buffers, writing into device buffers,
etc.
– request device, release device
– read, write, reposition
– get device attributes, set device attributes
– logically attach or detach devices
Types of System Calls
• Information maintenance: handles information and its transfer
between the OS and the user program.
– get time or date, set time or date
– get system data, set system data
– get and set process, file, or device attributes

• Communications: specially used for interprocess communications


– Create, delete communication connections
– Send, receive message
– Help OS to transfer status information
– Attach or detach remote devices
Examples of Windows and Unix System Calls
Standard C Library Example
• C program invoking printf() library call, which calls write() system call
Operating System Design and Implementation

• Complicated to define all the goals and specifications of OS while


designing.
• Design changes depending on the type of OS (batch system, time shared
system, single user system, multi user system, distributed system etc.)

• User goals and System goals


– User goals – OS should be convenient to use, easy to learn, reliable,
safe, and fast.
– System goals – OS should be easy to design, implement, and
maintain, as well as flexible, reliable, error-free, and efficient.
Operating Systems Structures
§ OS is very large program
§ It has to be designed carefully such that it will
§ function properly and
§ modified easily
§ Various ways to structure OS
§ Simple Structure
§ Monolithic (one unstructured program)
§ Layered
§ Microkernel
§ Virtual Machines
Simple Structure
• Not very well-defined
structures/ levels.
• interfaces and levels of
functionality are not well
separated.
• All layers are accessible to
basic h/w.
• such freedom leads the OS
volenerable to malicious
programs.
• So, errors in applications
cause the whole system
crash.
• Ex: MS-DOS and the original
UNIX. (Old OS, designed
long back)
Simple Structure
• Not well protected
• Not well structured
• Not well defined
• Pros:
• better application performance : few interfaces between the
application program and the hardware.
• Easy for kernel developers to develop such an OS.
• Cons:
• very complicated as no clear boundaries exists between modules.
• Does not enforce data hiding in the OS.
Monolithic OS
• A collection of functions.
• Everything (system calls, system programs, device drivers, etc) packed
into a single level.
• Too many functions packed into a single level
• This makes the implementation and maintenace difficult
• Ex: Multics, Unix, Linux
Monolithic OS
• Pros
• Every component contained in kernel
– direct communication among all components
– All OS services operate in kernel space
– high performance
• Cons
– Large size makes it hard to maintain
– Complexity is more
– Dependencies between system components
– Not easily extended/modified: new devices, emerging technologies not
easily added
Layered Approach
• Breaks up the operating system into different layers and
provide different functionalities
– Allows implementers to change the inner workings, and increases
modularity.
– A layer can only use the services provided by layer below.
– The bottom layer is the hardware, while the highest layer is the user
interface.
Layered Approach (Contd…)
Layered Approach
• Pros:
– Information hiding between layers
– Increased security and protection
– Easy to debug, test, and modify OS

• Cons:
– If one layer stops working, entire system will stop
– Mapping overhead between layers
– Difficult to categorize into layers
Microkernel OS
• Move as much functionality as possible from the kernel into user
space.
• Only a few essential functions in the kernel
– primitive memory management (address space)
– I/O and interrupt management
– Inter-Process Communication (IPC)
– basic scheduling

• Other OS services are provided by processes running in user mode :


– device drivers,
– file system,
– virtual memory…
Layered vs. Microkernel Architecture

A. Frank - P. Weisberg
Microkernel OS
• Communication between components of the OS is provided by
message passing.
Microkernel System Structure

Application File Device user


Program System Driver mode

messages messages

Interprocess memory CPU kernel


Communication managment scheduling mode

microkernel

hardware
Benefits of a Microkernel
• Extensibility/Reliability
– 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
– small microkernel can be rigorously tested.

• Portability
– Environment mostly independent on the instruction set architecture.
Virtual Machine
• A Virtual Machine is a software that creates a virtualized
environment between the computer platform and the end user
in which the end user can operate software.
Description
• A virtual machine provides an interface identical to the
underlying bare hardware.
• The operating system creates the illusion of multiple
processes, each executing on its own processor with its own
(virtual) memory.
Virtualization
• Virtualization is an abstraction that decouples the physical
hardware from the operating system to deliver greater IT resource
utilization and flexibility.
• Allows multiple virtual machines, with heterogeneous operating
systems to run in isolation, side-by-side on the same physical
machine.
Virtualization contd..
• Each virtual machine has its own set of virtual hardware
(e.g., RAM, CPU, etc.) upon which an operating system
and applications are loaded.
• The OS creates the illusion of multiple processes, each
executing on its own processor with its own (virtual)
memory.
History
• Virtualization was first introduced in the 1960s to allow
partitioning of large, mainframe hardware.
• In the 1990s, researchers began to see how virtualization could
solve some of the problems associated with the proliferation of
less expensive hardware, including underutilization, escalating
management costs and vulnerability.
Virtual Machine Monitor
• The host software that provides virtualization is often referred to
as a virtual machine monitor (VMM) or hypervisor.
• The VMM gives each virtual machine an illusion of a complete
computer to itself.

46
Architecture
Features
• Each virtual machine has its own set of virtual hardware (e.g.,
RAM, CPU, NIC, etc.) upon which an operating system and
applications are loaded.
• The operating system sees a consistent, normalized set of hardware
regardless of the actual physical hardware components.
Benefits
1. Partitioning
- Multiple applications and operating systems can be supported
within a single physical system.
- There is no overlap of memory as each Virtual Memory has
its own memory space.
Benefits

2. Isolation
- Virtual machines are completely isolated from the host
machine and other virtual machines. If a virtual machine
crashes, all others are unaffected.
- Data does not leak across virtual machines.
Summary
• Virtual machines are a number of discrete identical
execution environments on a single computer, each of which
runs an operating system.
• This can allow applications written for one OS to be
executed on a machine which runs a different OS which
provide a greater level of isolation between processes than is
achieved when running multiple processes on the same
instance of an OS.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy