0% found this document useful (0 votes)
129 views41 pages

Unit 1 - Overview of OS

This document provides an overview of the topics that will be covered in Unit 1 of an Operating Systems course. The unit will cover 6 hours of material from chapters 1 and 2 of the textbook. Topics that will be discussed include operating system operations, process management, memory management, storage management, protection and security, and distributed and special purpose systems. The structure of operating systems, system calls, system programs, and OS design and implementation will also be covered. The document provides definitions of operating systems and discusses their main functions and goals. It describes the four main components of a computer system - hardware, operating system, application programs, and users. Key operating system concepts like kernels, storage hierarchy, computer architectures, and dual mode of operation

Uploaded by

Anushka
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)
129 views41 pages

Unit 1 - Overview of OS

This document provides an overview of the topics that will be covered in Unit 1 of an Operating Systems course. The unit will cover 6 hours of material from chapters 1 and 2 of the textbook. Topics that will be discussed include operating system operations, process management, memory management, storage management, protection and security, and distributed and special purpose systems. The structure of operating systems, system calls, system programs, and OS design and implementation will also be covered. The document provides definitions of operating systems and discusses their main functions and goals. It describes the four main components of a computer system - hardware, operating system, application programs, and users. Key operating system concepts like kernels, storage hierarchy, computer architectures, and dual mode of operation

Uploaded by

Anushka
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/ 41

Unit 1: Overview of OS 11-03-2023

UNIT 1
OVERVIEW OF OPERATING SYSTEM: 6 HOURS

Chapter 1 and 2 of TB1

DR. NEEPA SHAH 1

SYLLABUS CONTENT

 1.1 Introduction:
 Operating System operations
 Process management
 Memory management
 Storage management
 Protection and security
 Distributed and special purpose Systems.
 1.2 System Structure:
 Operating system services and interface
 System calls and its types
 System programs
 Operating System Design and implementation
 OS structure
 Virtual machines
 OS debugging and generation
 System boot

DR. NEEPA SHAH 2

Dr. Neepa Shah 1


Unit 1: Overview of OS 11-03-2023

WHAT IS AN OPERATING SYSTEM?

 A program that acts as an intermediary between a user of a computer and the computer hardware (interface)
 An operating system (OS) is a collection of software that manages computer hardware resources and provides
common services for computer program
 User View of an OS
 Ease of use
 Performance
 Resource utilization

DR. NEEPA SHAH 3

WHAT IS AN OPERATING SYSTEM? CONTD.

 System View of an OS
 OS is a resource allocator / manager
 Manages all resources
 Decides between conflicting requests for efficient and fair resource use

 OS is a control program
 Controls execution of programs to prevent errors and improper use of the computer

 Operating system goals:


 Execute user programs and make solving user problems easier
 Make the computer system convenient to use
 Use the computer hardware in an efficient manner

DR. NEEPA SHAH 4

Dr. Neepa Shah 2


Unit 1: Overview of OS 11-03-2023

COMPUTER SYSTEM STRUCTURE

 Computer system can be divided into four components:


 Hardware – provides basic computing resources
 Operating system
 Application programs – define the ways in which the system resources are used to solve the computing problems of the
users
 Users
 People, machines, other computers

DR. NEEPA SHAH 5

FOUR COMPONENTS OF A COMPUTER SYSTEM

DR. NEEPA SHAH 6

Dr. Neepa Shah 3


Unit 1: Overview of OS 11-03-2023

WHAT IS AN OPERATING SYSTEM? CONTD.

 Functions the same way as ordinary computer software


 It is a program that is executed, but with extra privileges
 Kernel: Portion of operating system that is in main memory (RUNS ALL THE TIME)
 Loads first, and it remains in main memory
 Contains most frequently used functions
 Also called the nucleus
 It is important for the kernel to be as small as possible
 Typically, the kernel is responsible for memory management, process and task management, and disk management.
 The kernel connects the system hardware to the application software. Every operating system has a kernel.

DR. NEEPA SHAH 7

VIEW OF A KERNEL

DR. NEEPA SHAH 8

Dr. Neepa Shah 4


Unit 1: Overview of OS 11-03-2023

STORAGE STRUCTURE

 RAM and ROM


 Volatile and non-volatile
 Main memory – only large storage media that the CPU can access directly
 Random access
 Typically volatile
 Secondary storage – extension of main memory that provides large nonvolatile storage capacity
 Hard disks

DR. NEEPA SHAH 9

STORAGE HIERARCHY

 Storage systems organized in hierarchy


 Speed
 Cost
 Volatility
 Caching – copying information into faster storage system; main memory can be viewed as a cache for secondary
storage
 Device Driver for each device controller to manage I/O
 Provides uniform interface between controller and kernel

DR. NEEPA SHAH 10

Dr. Neepa Shah 5


Unit 1: Overview of OS 11-03-2023

STORAGE-DEVICE HIERARCHY

DR. NEEPA SHAH 11

COMPUTER-SYSTEM ARCHITECTURE

 Single-Processor system
 Multi-Processor system
 Clustered System
 Loosely coupled system v/s tightly coupled system
 HPC
 Parallel Computing, etc.

DR. NEEPA SHAH 13

Dr. Neepa Shah 6


Unit 1: Overview of OS 11-03-2023

OPERATING SYSTEM OPERATIONS

 Modern operating systems are interrupt driven.


 If there are no processes to execute, OS will sit idle and wait for some event to happen.
 Interrupts could be hardware interrupts or software interrupts.The OS is designed to handle both.
 A trap (or an exception) is a software generated interrupt caused either by an error (e.g. divide by zero) or by a
specific request from a user program.
 A separate code segment is written in the OS to handle different types of interrupts. These codes are known as
interrupt handlers/ interrupt service routine.
 A properly designed OS ensures that an illegal program should not harm the execution of other programs. (e.g.
infinite loop)
 To ensure this, the OS operates in dual mode.

DR. NEEPA SHAH 15

DUAL MODE OF OPERATION

 The OS is designed in such a way that it is capable of differentiating between the execution of OS code and user
defined code.
 To achieve this, OS needs two different modes of operations (User and Kernel / supervisor / system /
privileged)
 This is controlled by mode bit added to hardware of computer system
 When a user application is executing on the computer system, OS is working in user mode. (mode bit = 1)
 When a user application requests a service from OS (via a system call), the computer system transits from user
mode to kernel mode to service that request (mode bit = 0)
 Some instructions designated as privileged, only executable in kernel mode

DR. NEEPA SHAH 16

Dr. Neepa Shah 7


Unit 1: Overview of OS 11-03-2023

DUAL MODE OF OPERATION CONTD.

DR. NEEPA SHAH 17

COMPUTER STARTUP

 Bootstrap program is loaded at power-up or reboot


 Typically stored in ROM or EPROM, generally known as firmware
 Initializes all aspects of system
 Loads operating system kernel and starts execution

DR. NEEPA SHAH 18

Dr. Neepa Shah 8


Unit 1: Overview of OS 11-03-2023

DUAL MODE AND STARTUP

DR. NEEPA SHAH 19

TIMER

 Timer to prevent infinite loop (or process hogging resources)


 We cannot allow a user program to get stuck in an infinite loop or to fail to call system services and never return control
to the operating system
 Timer is set to interrupt the computer after some time period
 Keep a counter that is decremented by the physical clock
 Operating system sets this counter (privileged instruction)
 When counter reaches zero, generate an interrupt
 Set up before scheduling process to regain control or terminate program that exceeds allotted time

DR. NEEPA SHAH 20

Dr. Neepa Shah 9


Unit 1: Overview of OS 11-03-2023

MAJOR OS FUNCTIONS

 Process management
 Memory management
 Storage management
 Information protection and security
 Distributed and special purpose Systems

DR. NEEPA SHAH 21

PROCESS MANAGEMENT: UNIT 2 AND 3

 A process is a program in execution. It is a unit of work within the system. Program is a passive entity, process is an
active entity.
 Process needs resources to accomplish its task
 CPU, memory, I/O, files
 Initialization data
 Process termination requires reclaim of any reusable resources
 Single-threaded process has one program counter specifying location of next instruction to execute
 Process executes instructions sequentially, one at a time, until completion
 Multi-threaded process has one program counter per thread
 Typically system has many processes, some user, some operating system running concurrently on one or more CPUs

DR. NEEPA SHAH 22

Dr. Neepa Shah 10


Unit 1: Overview of OS 11-03-2023

PROCESS MANAGEMENT ACTIVITIES

 Creating and deleting both user and system processes


 Suspending and resuming processes
 Process switching
 Providing mechanisms for process synchronization
 Providing mechanisms for process communication (IPC)
 Providing mechanisms for deadlock handling

DR. NEEPA SHAH 23

MEMORY MANAGEMENT: UNIT 4

 To execute a program all (or part) of the instructions must be in memory


 All (or part) of the data that is needed by the program must be in memory.
 Memory management determines what is in memory
 Memory management activities
 Keeping track of which parts of memory are currently being used and by whom
 Deciding which processes (or parts thereof) and data to move into and out of memory (swapping)
 Allocating and deallocating memory space to various processes as needed
 Page and segment management

DR. NEEPA SHAH 24

Dr. Neepa Shah 11


Unit 1: Overview of OS 11-03-2023

STORAGE MANAGEMENT: UNIT 5

 OS provides uniform, logical view of information storage


 Abstracts physical properties to logical storage unit: file
 Each medium is controlled by device (i.e., disk drive, tape drive)
 Varying properties include access speed, capacity, data-transfer rate, access method (sequential or random)

 File-System management
 Files usually organized into directories
 Access control on most systems to determine who can access what
 OS activities include
 Creating and deleting files and directories
 Primitives to manipulate files and directories
 Mapping files onto secondary storage
 Backup files onto stable (non-volatile) storage media

DR. NEEPA SHAH 25

MASS-STORAGE MANAGEMENT: UNIT 6

 Usually disks used to store data that does not fit in main memory or data that must be kept for a long period of time
 Proper management is of central importance
 Entire speed of computer operation hinges on disk subsystem and its algorithms
 OS activities
 Free-space management
 Storage allocation
 Disk scheduling
 Partitioning
 Protection
 Mounting and unmounting
 Some storage need not be fast
 Tertiary storage includes optical storage, magnetic tape
 Still must be managed – by OS or applications
 Varies between WORM (write-once, read-many-times) and RW (read-write)

DR. NEEPA SHAH 26

Dr. Neepa Shah 12


Unit 1: Overview of OS 11-03-2023

CACHING

 Important principle, performed at many levels in a computer (in hardware, operating system, software)
 Information in use copied from slower to faster storage temporarily
 Faster storage (cache) checked first to determine if information is there
 If it is, information used directly from the cache (fast)
 If not, data copied to cache and used there
 Cache management important design problem
 Cache size and replacement policy

DR. NEEPA SHAH 27

MIGRATION OF DATA “A” FROM DISK TO REGISTER

 Multitasking environments must be careful to use most recent value, no matter where it is stored in the storage
hierarchy

 Multiprocessor environment must provide cache coherency in hardware such that all CPUs have the most
recent value in their cache
 Distributed environment situation even more complex
 Several copies of a datum can exist

DR. NEEPA SHAH 28

Dr. Neepa Shah 13


Unit 1: Overview of OS 11-03-2023

PERFORMANCE OF VARIOUS LEVELS OF STORAGE

DR. NEEPA SHAH 29

I/O SUBSYSTEM: UNIT 6

 One purpose of OS is to hide peculiarities of hardware devices from the user


 I/O subsystem responsible for
 Memory management of I/O including buffering (storing data temporarily while it is being transferred), caching (storing
parts of data in faster storage for performance), spooling (the overlapping of output of one job with input of other jobs)
 General device-driver interface
 Drivers for specific hardware devices

DR. NEEPA SHAH 30

Dr. Neepa Shah 14


Unit 1: Overview of OS 11-03-2023

PROTECTION AND SECURITY: UNIT 6

 Protection – any mechanism for controlling access of processes or users to resources defined by the OS
 Security – defense of the system against internal and external attacks
 Huge range, including denial-of-service, worms, viruses, identity theft, theft of service
 Systems generally first distinguish among users, to determine who can do what
 User identities (user IDs, security IDs) include name and associated number, one per user
 User ID then associated with all files, processes of that user to determine access control
 Group identifier (group ID) allows set of users to be defined and controls managed, then also associated with each
process, file
 Privilege escalation allows user to change to effective ID with more rights

DR. NEEPA SHAH 31

DISTRIBUTED SYSTEMS

 Collection of separate, possibly heterogeneous, systems networked together


 Network is a communications path, TCP/IP most common
 Local Area Network (LAN)
 Wide Area Network (WAN)
 Metropolitan Area Network (MAN)
 Personal Area Network (PAN)

 Network Operating System provides features between systems across network


 Communication scheme allows systems to exchange messages
 Illusion of a single system

DR. NEEPA SHAH 32

Dr. Neepa Shah 15


Unit 1: Overview of OS 11-03-2023

OTHER COMPUTING ENVIRONMENTS

 Traditional computing
 Portal
 Wireless network
 Thin / Thick client
 Mobile computing
 iOS and Android
 Client / server architecture
 Compute server
 File server
 Peer-to-Peer (P2P)
 Virtualization
 Cloud computing
 Real-Time Embedded Systems
 Free and Open Source OSs

DR. NEEPA SHAH 33

1.2 SYSTEM STRUCTURE:


Operating system services and interface
System calls and its types
System programs
Operating System Design and implementation
OS structure
Virtual machines
OS debugging and generation
System boot

DR. NEEPA SHAH 34

Dr. Neepa Shah 16


Unit 1: Overview of OS 11-03-2023

VIEWS OF OS

 3 views:
 The services that the system provides
 The interface that it makes available to users and programmers
 Its components and their interconnections

DR. NEEPA SHAH 35

SERVICES PROVIDED BY THE OS


 An operating system provides an environment for the execution of programs.
 It provides certain services to programs and to the users of those programs

DR. NEEPA SHAH 36

Dr. Neepa Shah 17


Unit 1: Overview of OS 11-03-2023

SERVICES PROVIDED BY THE OS CONTD.

 Functions helpful to the user:


 User Interface: CLI, GUI, Batch
 Program Execution: load a program into memory and execute, end its execution, either normally
or abnormally / forcefully.
 Input / output Operations: OS provide a means to do Input / Output (read or write) operation
with any file
 File system manipulation: create and delete, allowing or denying access to files or directories based
on file ownership
 Communication: Processes can communicate using shared memory or via message passing.

DR. NEEPA SHAH 37

SERVICES PROVIDED BY THE OS CONTD.

Functions helpful to the user:

 Error Detection  Error Response


 Internal and external hardware errors  Simply report error to the application
 Memory error  Retry the operation
 Device failure  Abort the application
 Software errors
 Arithmetic overflow
 Access forbidden memory locations
 Inability of OS to grant request of application

DR. NEEPA SHAH 38

Dr. Neepa Shah 18


Unit 1: Overview of OS 11-03-2023

SERVICES PROVIDED BY THE OS CONTD.

 Functions for ensuring the efficient operation of the system itself:


 Resource Allocation: Facilitate resource sharing (CPU, main memory storage, file storage and I/O devices)
 Accounting
 Collect statistics on resource usage
 Monitor performance (e.g.: response time)
 Keeps track of which users are using how much and what kinds of computer resources

 Security: the user needs to authenticate him or her to the system before using
 Protection: access to system resources in a controlled manner

DR. NEEPA SHAH 39

USER-OS INTERFACE

 Command interpreter  GUI


 It is present in the kernel  Varies from system to system and user to user
 Examples: In Unix and Linux: Shell, MS-DOS  Usually mouse, keyboard, and monitor
 Implementations of the commands:  Icons represent files, programs, actions, etc.
 Command interpreter itself has the code  KDE and GNOME
 Separate system programs (E.g. UNIX)  Many systems now include both CLI and GUI
interfaces

 Touch Screen Interface

DR. NEEPA SHAH 40

Dr. Neepa Shah 19


Unit 1: Overview of OS 11-03-2023

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): strong
correlation between a function in the API and its associated system call within the kernel
 Available in the form of commands
 Systems execute thousands of system calls per second.
 When a program in user mode requires access to RAM or a hardware resource, it must ask the
kernel to provide access to that resource. When a program makes a system call, the mode is switched
from user mode to kernel mode.

DR. NEEPA SHAH 41

SYSTEM CALLS CONTD.

 Generally, system calls are made by the user level programs in the following situations:
 Creating, opening, closing and deleting files in the file system.
 Creating and managing new processes.
 Creating a connection in the network, sending and receiving packets.
 Requesting access to a hardware device, like a mouse or a printer.

 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): strong correlation between a function in the API and its associated system call within
the kernel

DR. NEEPA SHAH 42

Dr. Neepa Shah 20


Unit 1: Overview of OS 11-03-2023

SYSTEM CALL SEQUENCE TO COPY THE CONTENTS OF ONE FILE


TO ANOTHER FILE

DR. NEEPA SHAH 43

SYSTEM CALL EXAMPLES: THE HANDLING OF A USER APPLICATION INVOKING THE OPEN() SYSTEM CALL

DR. NEEPA SHAH 44

Dr. Neepa Shah 21


Unit 1: Overview of OS 11-03-2023

EXAMPLE OF STD API

FILE *fopen(const char *file_name, const char *mode_of_operation);


R, w, a, r+, w+, a+

DR. NEEPA SHAH 45

SYSTEM CALL PARAMETERS

 Three general methods used to pass parameters to the OS


 Simplest: pass the parameters in registers
 In some cases, may be more parameters than registers
 Parameters stored in a block, or table, in memory, and address of block is passed as a parameter in
a register. (Linux and Solaris)
 Parameters can be placed, or pushed, onto the stack by the program and popped off the stack by
the operating system
 Block and stack methods do not limit the number or length of parameters being passe

DR. NEEPA SHAH 46

Dr. Neepa Shah 22


Unit 1: Overview of OS 11-03-2023

PARAMETER PASSING VIA TABLE

6 TYPES OF SYSTEM CALLS

1. Process control
2. File Management
3. Device Management
4. Information Maintenance
5. Communication
6. Protection

DR. NEEPA SHAH 48

Dr. Neepa Shah 23


Unit 1: Overview of OS 11-03-2023

6 TYPES OF SYSTEM CALLS CONTD.


1. Process control
 A running program needs to be able to stop execution either normally or abnormally.
 When execution is stopped abnormally, often a dump of memory is taken and error message is generated.
 CLI: Back to command interpreter
 GUI: pop-up window
 System Calls
 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

DR. NEEPA SHAH 49

EXAMPLE: MS-DOS

 Single-tasking
 Shell invoked when system booted
 Single memory space
 Loads program into memory
 Program exit -> shell reloaded

At system startup running a program

DR. NEEPA SHAH 50

Dr. Neepa Shah 24


Unit 1: Overview of OS 11-03-2023

EXAMPLE: FREEBSD
 Unix variant
 Multitasking
 User login -> invoke user’s choice of shell
 Shell executes fork() system call to create process
 Executes exec() to load program into process
 Shell waits for process to terminate or continues with user commands
 Exit ( ) system call to terminate
 Process exits with:
 code = 0 – no error
 code > 0 – error code

DR. NEEPA SHAH 51

6 TYPES OF SYSTEM CALLS CONTD.

2. File Management
 Some common system calls are create, delete, read, write, reposition, or close.
 Also, there is a need to determine the file attributes – get and set file attribute.
 File attributes include the file name, file type, protection codes, accounting information.
 Additional system calls: Move and copy
 Many times the OS provides an API to make these system calls.
 Similar functions for directories too

DR. NEEPA SHAH 52

Dr. Neepa Shah 25


Unit 1: Overview of OS 11-03-2023

6 TYPES OF SYSTEM CALLS CONTD.

3. Device Management
 Process usually require several resources to execute, if these resources are available, they will be granted and control
returned to the user process.
 These resources are also thought of as devices.
 Some are physical, such as a video card, and others are abstract, such as a file.
 User programs request the device, and when finished they release the device.
 System Calls
 request device, release device
 read, write
 get device attributes, set device attributes

DR. NEEPA SHAH 53

6 TYPES OF SYSTEM CALLS CONTD.

4. Information Maintenance
 Some system calls exist purely for transferring information between the user program and the operating
system. An example of this is time, or date, number of current users, version of OS, amount of free
space etc.
 The OS also keeps information about all its processes and provides system calls to report this
information.
 System Calls
 get time or date, set time or date
 get system data, set system data
 get and set process, file, or device attributes

DR. NEEPA SHAH 54

Dr. Neepa Shah 26


Unit 1: Overview of OS 11-03-2023

6 TYPES OF SYSTEM CALLS CONTD.

5. Communication
 There are two models of inter process communication, the message-passing model and the shared memory model.
 Message-passing uses a common mailbox to pass messages between processes.
 Shared memory use certain system calls to create and gain access to regions of memory owned by other processes.
 The two processes exchange information by reading and writing in the shared data.
 System Calls
 Get hostid and get processeid
 Open connection and close connection
 create, delete communication connection
 send, receive messages if message passing model to host name or process name i.e. From client to server
 Shared-memory model create and gain access to memory regions
 transfer status information
 attach and detach remote devices

DR. NEEPA SHAH 55

6 TYPES OF SYSTEM CALLS CONTD.

6. Protection
 Control access to resources
 Get and set permissions
 Allow and deny user access

DR. NEEPA SHAH 56

Dr. Neepa Shah 27


Unit 1: Overview of OS 11-03-2023

EXAMPLES OF WINDOWS AND UNIX SYSTEM CALLS

DR. NEEPA SHAH 57

SYSTEM PROGRAMS

 System programs (system utilities) provide a convenient environment for program development and execution.
 Some of them are simply user interfaces to system calls.
 The can be divided into:
 File manipulation
 Status information
 File modification
 Programming language support
 Program loading and execution
 Communications
 Background services
 Application programs
 Most users’ view of the operating system is defined by system programs and application programs, not the actual system calls

DR. NEEPA SHAH 58

Dr. Neepa Shah 28


Unit 1: Overview of OS 11-03-2023

SYSTEM PROGRAMS CONTD.

 File management
 Create, delete, copy, rename, print, dump, list, and generally manipulate files and directories

 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

DR. NEEPA SHAH 59

SYSTEM PROGRAMS CONTD.

 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

 Program loading and execution


 Absolute loaders, relocatable loaders, linkage editors, overlay loaders, debugging systems for higher-level and machine
language

DR. NEEPA SHAH 60

Dr. Neepa Shah 29


Unit 1: Overview of OS 11-03-2023

SYSTEM PROGRAMS CONTD.

 Communications:
 Provide the mechanism for creating virtual connections among processes, users, and computer systems
 Allow users to send messages to one another’s screens, browse web pages, send electronic-mail messages, log in remotely,
transfer files from one machine to another
 Background Services:
 Some processes terminate after completion of their task while others continue until system is halted
 Launch at boot time
 Some for system startup, then terminate
 Some from system boot to shutdown
 Provide facilities like disk checking, process scheduling, error logging, printing
 Constantly running system program processes are known as services, subsystems, or daemons
 n/w daemon, process schedulers

DR. NEEPA SHAH 61

SYSTEM PROGRAMS CONTD.

 Application programs
 Don’t pertain to system
 Run by users
 Not typically considered part of OS
 Launched by command line, mouse click
 Include word processors and text formatters, spreadsheets, database systems, statistical-analysis packages, etc.

DR. NEEPA SHAH 62

Dr. Neepa Shah 30


Unit 1: Overview of OS 11-03-2023

OS DESIGN AND IMPLEMENTATION

 Start by defining goals and specifications


 Design will be affected by choice of hardware, type of system: batch, time shared, single user, multi
user, network, distributed, real time, 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

DR. NEEPA SHAH 63

OS DESIGN AND IMPLEMENTATION CONTD.

 Important principle is to separate


 Policy: What will be done?
 Mechanism: How to do it?
 Example:Timer, Scheduler, setting priority, etc.
 The separation of policy from mechanism is a very important principle, it allows maximum
flexibility if policy decisions are to be changed later
 Policy decisions are important for all resource allocation.

DR. NEEPA SHAH 64

Dr. Neepa Shah 31


Unit 1: Overview of OS 11-03-2023

OS DESIGN AND IMPLEMENTATION CONTD.

 Implementation:
 Earlier in Assembly language
 Then system programming languages like Algol, PL/1
 Nowadays, in HLL like C/C++
 Problems with HLL: reduced speed and increased storage requirements
 Performance improvement:
 through better data structures and algorithms than excellent assembly codes
 The critical and high performance parameters like MM and CPU scheduler can be coded in assembly (if becoming performance
bottleneck)

So, 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

DR. NEEPA SHAH 65

OPERATING SYSTEM STRUCTURE

 General-purpose OS is very large program


 Various ways to structure ones
 Simple structure – MS-DOS
 More complex -- UNIX
 Layered – an abstraction and information hiding
 Microkernel –Mach
 Modular – Solaris
 Hybrid – Mac OS x

DR. NEEPA SHAH 66

Dr. Neepa Shah 32


Unit 1: Overview of OS 11-03-2023

OPERATING SYSTEM STRUCTURE CONTD.

 Simple Structure
 No well defined structure
 Started as small, simple and limited systems
 MS-DOS: written to provide the most functionality in the least space
 Not divided into modules
 Although MS-DOS has some structure, its interfaces and levels of functionality are not well separated
 Another example, Original UNIX

DR. NEEPA SHAH 67

MS-DOS LAYER STRUCTURE

 In MS-DOS, the interfaces and levels of


functionality are not well separated.
(application programs are able to access
the basic I/O libraries; i.e. to write
directly to the display and disk drives.
Such freedom leaves MS-DOS
vulnerable to errant (or malicious)
programs, causing entire system crashes
when user programs fail.

DR. NEEPA SHAH 68

Dr. Neepa Shah 33


Unit 1: Overview of OS 11-03-2023

TRADITIONAL UNIX LAYER STRUCTURE: MONOLITHIC

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

Avoid monolithic and prefer modular structure

DR. NEEPA SHAH 69

LAYERED APPROACH

 Uses top-down approach


 Abstract object
 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
 Each layer hides the existence of certain data structures,
operations, and hardware from higher-level layers.
 Advantages: Simplicity of construction and debugging
 Disadvantages: delay and clear separation of layers

DR. NEEPA SHAH 70

Dr. Neepa Shah 34


Unit 1: Overview of OS 11-03-2023

MICROKERNEL SYSTEM STRUCTURE

 Structures the OS by removing all non essential components from kernel and
implementing them as system and user level programs.
 The result is smaller kernel.
 The main functionality, communication, takes place using message passing.
 Program and service never interact directly, indirectly by message passing with
microkernel
 Disadvantages: System overhead due to communication

DR. NEEPA SHAH 71

MICROKERNEL SYSTEM STRUCTURE CONTD.

DR. NEEPA SHAH 72

Dr. Neepa Shah 35


Unit 1: Overview of OS 11-03-2023

BENEFITS OF MICROKERNEL

 Ease of extending OS: new services are added to user space, no modification required for
kernel.
 Easier to port from h/w design to another
 Provides more security and reliability: since most services are running as user rather than
kernel processes. If a service fails, rest of the OS remains untouched.
 Examples:
 Tru64 UNIX (formerly Digital UNIX) provides a UNIX interface to the user, but it is
implemented with a Mach kernel.
 The Mac OS X kernel (Darwin)
 QNX, a real-time operating system

DR. NEEPA SHAH 73

MODULES

 Kernel has a set of core components and links in additional services via modules at boot or
run time
 Many modern operating systems implement loadable kernel modules (to be loaded
dynamically)
 Uses object-oriented approach
 Each core component is separate
 Each talks to the others over known interfaces (Adv. over layered Approach (pass thru all the layers))
 Each is loadable as needed within the kernel (similar to microkernel but adv over microkernel as
communication is not needed)
 Overall, similar to layers but with more flexibility; similar to microkernel but no need of
communication
 Linux, Solaris, etc.
DR. NEEPA SHAH 74

Dr. Neepa Shah 36


Unit 1: Overview of OS 11-03-2023

SOLARIS MODULAR APPROACH

DR. NEEPA SHAH 75

HYBRID SYSTEMS

 Most modern operating systems are actually not one pure model
 Hybrid combines multiple approaches to address performance, security, usability needs
 Linux and Solaris kernels in kernel address space, so monolithic, plus modular for dynamic loading of
functionality
 Windows mostly monolithic, plus microkernel for different subsystems
 Apple Mac OS X hybrid, layered,Aqua UI plus Cocoa programming environment
 Below is kernel consisting of Mach microkernel and BSD Unix parts, plus I/O kit and dynamically
loadable modules (called kernel extensions)
 Mach: MM, IPC and RPC, Message-passing and thread scheduling
 BSD: CLI, Network and FM, POSIX API and Pthread.

DR. NEEPA SHAH 76

Dr. Neepa Shah 37


Unit 1: Overview of OS 11-03-2023

HYBRID SYSTEMS CONTD.: MAC OS X STRUCTURE

graphical user interface


Aqua

application environments and services

Java Cocoa Quicktime BSD

kernel environment
BSD

Mach

I/O kit kernel extensions

DR. NEEPA SHAH 77

VIRTUAL MACHINES

 A virtual machine takes the layered approach to its logical conclusion.


 The operating system host creates the illusion that a process has its own processor and (virtual)
memory
 Idea is to abstract the hardware of a single computer (CPU, Memory, disks, etc.) into several different
computing environments.
 A virtual machine provides an interface identical to the underlying bare hardware
 Each guest provided with a (virtual) copy of underlying computer

 VM software runs in kernel mode and VM itself runs in user mode


 Examples:VMWare, JVM, .NET framework

DR. NEEPA SHAH 78

Dr. Neepa Shah 38


Unit 1: Overview of OS 11-03-2023

VIRTUAL MACHINES CONTD.

DR. NEEPA SHAH 79

VMWARE ARCHITECTURE

DR. NEEPA SHAH 80

Dr. Neepa Shah 39


Unit 1: Overview of OS 11-03-2023

JVM

DR. NEEPA SHAH 81

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
 What CPU is to be used?
 How much memory is available?
 What devices are available?
 What OS options are available?
 Booting–starting a computer by loading the kernel
 Bootstrap program–code stored in ROM that is able to locate the kernel, load it into memory, and start
its execution.WHY ROM?

DR. NEEPA SHAH 82

Dr. Neepa Shah 40


Unit 1: Overview of OS 11-03-2023

SYSTEM BOOT

 Operating system must be made available to hardware so hardware can start it.
 Small piece of code –bootstrap loader, locates the kernel, loads it into memory, and starts it
 Sometimes two-step process where boot block at fixed location loads bootstrap loader
 When power initialized on system, execution starts at a fixed memory location
 Firmware used to hold initial boot code

DR. NEEPA SHAH 83

BIOS V/S KERNEL

BIOS Kernel
Lives in motherboard Lives in boot drive
OS independent OS dependent
Should be up and running
before kernel
Used during booting process 1st thing that is loaded and
remains in main memory for
entire session

DR. NEEPA SHAH 84

Dr. Neepa Shah 41

You might also like