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

Module 1

This document provides an introduction to operating systems, outlining their key components and functions. It discusses how operating systems act as an intermediary between the user and computer hardware to efficiently execute programs and allocate resources. The document describes operating system structures like process management, memory management, file systems, I/O management, and protection. It also outlines the goals of operating systems and common system services they provide like program execution, file manipulation, communication, and error detection.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
45 views

Module 1

This document provides an introduction to operating systems, outlining their key components and functions. It discusses how operating systems act as an intermediary between the user and computer hardware to efficiently execute programs and allocate resources. The document describes operating system structures like process management, memory management, file systems, I/O management, and protection. It also outlines the goals of operating systems and common system services they provide like program execution, file manipulation, communication, and error detection.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 67

UNIT 1 :

INTRODUCTION TO
OPERATING
SYSTEM
OUTLINE
What is an Operating System?
Mainframe Systems
Multiprocessor Systems
OS Components
OS Services
System calls
System programs
OS Structures
Virtual Machines.
WHAT IS AN OPERATING SYSTEM?
A program that acts as an intermediary between a user of a
computer and the computer hardware.
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.
COMPONENTS OF A COMPUTER
SYSTEM
Computer system can be divided into four components
⚫ Hardware – provides basic computing resources
CPU, memory, I/O devices
⚫ Operating system
Controls and coordinates use of hardware among
various applications and users
⚫ 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
FOUR COMPONENTS OF A COMPUTER
SYSTEM
VIEWS OF OS
User View:
❖ Single user PC- ease of use, performance
❖ Mainframe or Minicomputer and Workstation- resource utilization
❖ Embedded computers- run without user intervention
System View:
OS is a resource allocator
⚫ 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
⚫ Make the computer system convenient to use.
⚫ efficient operation of the computer system.
⚫ Execute user programs and make solving user problems
easier.
⚫ Use the computer hardware in an efficient manner
MAINFRAME SYSTEMS
Evolved from simple batch systems(computer runs one -and only
one-application) to time-shared systems( allow for user interaction
with the computer system).
1. Simple Batch Systems
Introduced to improve the utilization of computer systems.
Reduce setup time by batching similar jobs
Automatic job sequencing – automatically transfers control from one
job to another.
Resident monitor
⚫ initial control in monitor
⚫ control transfers to job
⚫ when job completes control transfers back to monitor
⚫ Advantage: monitor automates the execution of multiple jobs thus
much time is saved by avoiding manual operations.
⚫ Disadvantage: CPU is often idle
MEMORY LAYOUT FOR A SIMPLE BATCH SYSTEM
2. Multiprogrammed batch systems
Even with the automatic job processing by a monitor, the
processor is still often idle.
single user cannot keep either the CPU or the I/0 devices busy at
all times
Solution: multiprogramming or multitasking(runs multiple
programs concurrently).
Advantage: Efficient utilization of processor
Problem: To run multiple programs concurrently, some form of
scheduling is needed to obtain better performance.
Does not provide for user interaction with the computer
MULTIPROGRAMMED BATCH SYSTEMS
Several jobs are kept in main memory at the same time, and the
CPU is multiplexed among them- job pool.
3. Time Sharing Systems
CPU executes multiple jobs by switching among them, and
switches occur so frequently that the users can interact with each
program while it is running.
provides direct communication between the user and the system
allows many users to share the computer simultaneously
provide a mechanism for concurrent execution
Disadvantages: more complex than multiprogrammed operating
systems
difficult and expensive to build
system must have memory management and protection
COMPUTER-SYSTEM ARCHITECTURE

1. Single Processor Systems


2. Multi Processor Systems/parallel system/tightly coupled
system
sharing the computer bus, memory and peripheral devices.
Multi processor systems are of two types
1. Symmetric Multi processors ( SMP)
▪ All the CPU shares the common memory
2. Asymmetric Multi processors
▪ uses a master slave relationship
Advantages of Multi Processor Systems
Increased Throughput
Economy Of Scale
Increased Reliability
▪ Clustered Systems

composed of two or more individual system coupled


together and shares common memory
Advantage: High availability
Can be symmetric or asymmetric
COMMON OPERATING SYSTEM
COMPONENTS

1. Process Management
2. Main Memory Management
3. File Management
4. I/O System Management
5. Secondary Management
6. Networking
7. Protection System
8. Command-Interpreter System
PROCESS MANAGEMENT
A process is a program in execution. Program is a passive
entity, process is an active entity.
Process needs resources to accomplish its task
⚫ CPU, memory, I/O, files
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
PROCESS MANAGEMENT ACTIVITIES
Creating and deleting both user and system processes
Suspending and resuming processes
Providing mechanisms for process synchronization
Providing mechanisms for process communication
Providing mechanisms for deadlock handling
MEMORY MANAGEMENT
All data in memory before and after processing
Memory management determines what is in memory when
⚫ Optimizing CPU utilization and computer response to users
Memory management activities
⚫ Keeping track of which parts of memory are currently being
used and by whom
⚫ Deciding which processes and data to move into and out of
memory
⚫ Allocating and deallocating memory space as needed
STORAGE MANAGEMENT
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 dirs
Mapping files onto secondary storage
Backup files onto stable (non-volatile) storage media
MASS-STORAGE MANAGEMENT
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.
OS activities
⚫ Free-space management
⚫ Storage allocation
⚫ Disk scheduling
Storage devices includes optical storage, magnetic tape,
magnetic disk
⚫ Varies between WORM (write-once, read-many-times)
and RW (read-write)
I/O SUBSYSTEM
I/O subsystem responsible for
⚫ Memory management of I/O including buffering, caching
and spooling (the overlapping of output of one job with
input of other jobs)
⚫ General device-driver interface
⚫ Drivers for specific hardware devices
PROTECTION AND SECURITY
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
⚫ including denial-of-service, worms, viruses, identity theft
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
⚫ 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
COMMAND-INTERPRETER SYSTEM
One of the most important systems programs for an operating
system
interface between the user and the OS.
Some operating systems include the command interpreter in the
kernel.
Other operating systems, such as MS-DOS and UNIX, treat the
command interpreter as a special program that is running when a
job is initiated, or when a user first logs on.
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.
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 and networking
USER INTERFACE
CLI allows direct command entry
Sometimes implemented in kernel, sometimes by systems
program
Primarily fetches a command from user and executes it
Sometimes commands built-in, sometimes just names of
programs
User Operating System Interface – GUI
User-friendly desktop interface
Usually mouse, keyboard, and monitor
OPERATING SYSTEM SERVICES
Provides functions that are helpful to the user:
1. User interface - Almost all operating systems have a user interface
(UI)
Varies between Command-Line (CLI), Graphics User Interface
(GUI), Batch
2. Program execution - The system must be able to load a program
into memory and to run that program, end execution
3. I/O operations - involve a file or an I/O device.
4. File-system manipulation - programs need to read and write files
and directories, create and delete them, search them, list file
Information, permission management.
OPERATING SYSTEM SERVICES (CONT.)
5. Communications – Processes may exchange information
Communications may be via shared memory or through message
passing
6. Error detection
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 efficient use the of
system
OPERATING SYSTEM SERVICES (CONT.)
Another set of OS functions exists for ensuring the efficient operation of
the system itself via resource sharing
1. Resource allocation - When multiple users or multiple jobs running
concurrently, resources must be allocated to each of them
2. Accounting - To keep track of which users use how much and what
kinds of computer resources.
3. 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
SYSTEM CALLS
Provides interface between the process & the OS
● Generally available as assembly-language instructions.
system call instruction generates an interrupt and allows OS to
gain control of the processors
Mostly accessed by programs via API rather than direct system
calls.
Three most common APIs are Win32 API for Windows, POSIX
API for POSIX-based systems and Java API for JVM
SYSTEM CALL – OS RELATIONSHIP
STANDARD C LIBRARY EXAMPLE
C program invoking printf() library call, which calls write() system call
SYSTEM CALL PARAMETER PASSING
Three general methods used to pass parameters to the OS
1. Simplest: pass the parameters in registers
In some cases, may be more parameters than registers
2. Parameters stored in a block, or table, in memory, and address of
block passed as a parameter in a register
This approach taken by Linux and Solaris
3. Parameters 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 passed
PARAMETER PASSING VIA TABLE
TYPES OF SYSTEM CALLS
1. Process control
2. File management
3. Device management
4. Information maintenance
5. Communications
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
A running program needs to be able to halt its execution either
normally (end) or abnormally (abort).
Under either normal or abnormal circumstances, the OS must
transfer control to the command interpreter.
The MS-DOS operating system is an example of a single-tasking
system, which has a command interpreter that is invoked when
the computer is started.
UNIX is a multitasking system, the command interpreter may
continue running while another program is executed
To start a new process, the shell executes a fork system call.
Then, the selected program is loaded into memory via an exec
system call, and the program is then executed.
MS-DOS EXECUTION

At System Start-up Running a Program


UNIX RUNNING MULTIPLE PROGRAMS
FILE MANAGEMENT
create file, delete file
open, close
read, write, reposition
get file attributes, set file attributes
DEVICE MANAGEMENT
request device, release device
read, write, reposition
get device attributes, set device attributes
logically attach or detach devices
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
COMMUNICATIONS
There are two common models of communication.
In the message-passing model, information is exchanged through
an inter process-communication facility provided by the operating
system.
Before communication can take place, a connection must be
opened.
The name of the other communicator must be known.
In the shared-memory model, processes use map memory
system calls to gain access to regions of memory owned by
other processes.
They may then exchange information by reading and writing
data in these shared areas.
Message passing is useful when smaller numbers of data
need to be exchanged, because no conflicts need to be avoided.
It is also easier to implement than is shared memory for inter
computer communication.
Shared memory allows maximum speed and convenience of
communication, as it can be done at memory speeds when
within a computer.
Problems exist, however, in the areas of protection and
synchronization.
COMMUNICATION MODELS
● Communication may take place using either message passing or
shared memory.

Msg Passing Shared Memory

Message Passing Shared Memory


COMMUNICATIONS
create, delete communication connection
send, receive messages
transfer status information
attach or detach remote devices
SYSTEM PROGRAMS
System programs provide a convenient environment for program
development and execution.
They can be divided into these categories:
File management: These programs create, delete, copy, rename, print,
dump, list, and generally manipulate files and directories.
Status information: Some programs simply ask the system for the
date, time, amount of available memory or disk space, number of users,
or similar status information.
• That information is then formatted, and is printed to the terminal or
other output device or file.
File modification: Several text editors may be available to create and
modify the content of files stored on disk or tape.
Programming-language support: Compilers, assemblers, and
interpreters for common programming languages (such as C, C++, Java,
Visual Basic, and PERL) are often provided to the user with the operating
system.
• Some of these programs are now priced and provided separately.
Program loading and execution: Once a program is assembled or
compiled, it must be loaded into memory to be executed.
• The system may provide absolute loaders, relocatable loaders, linkage
editors, and overlay loaders.
• Debugging systems for either higher-level languages or machine language
are needed also.
Communications: These programs provide the mechanism for creating
virtual connections among processes, users, and different computer
systems.
• They allow users to send messages to one another's screens, to browse
web pages, to send electronic-mail messages, to log in remotely, or to
transfer files from one machine to another.
Most users’ view of the operation system is defined by system programs,
not the actual system calls.
Most operating systems are supplied with programs that solve common
problems, or perform common operations.
Such programs include web browsers, word processors and text
formatters, spreadsheets, database systems, compiler compilers, plotting
and statistical-analysis packages, and games.
These programs are known as system utilities or application programs.
SYSTEM STRUCTURE
Operating system is large and complex, so a common approach is to
partition the task into small components to function properly, rather
than have one monolithic system.
Each of these modules should be a well-defined portion of the system,
with carefully defined inputs, outputs, and function.
1. Simple Structure
Many commercial systems do not have a well-defined structure.
Frequently, such operating systems started as small, simple, and
limited systems, and then grew beyond their original scope.
MS-DOS is an example of such a system.
MS-DOS SYSTEM STRUCTURE
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
MS-DOS LAYER STRUCTURE
It was written to provide the most functionality in the least space
(because of the limited hardware on which it ran), so it was not
divided into modules.
UNIX is another system that was initially limited by hardware
functionality.
It consists of two separable parts: the kernel and the system programs.
The kernel is further separated into a series of interfaces and device
drivers, which were added and expanded over the years as UNIX
evolved.
The kernel provides the file system, CPU scheduling, memory
management, and other operating-system functions through system
calls.
UNIX SYSTEM STRUCTURE
2. 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.
The main advantage of the layered approach is modularity.
With modularity, layers are selected such that each uses functions
(operations) and services of only lower-level layers.
This approach simplifies debugging and system verification.
LAYERED APPROACH
The first layer can be debugged without any concern for the rest of
the system, because, by definition, it uses only the basic hardware
(which is assumed correct) to implement its functions.
Thus, the design and implementation of the system are simplified
when the system is broken down into layers.
The major difficulty with the layered approach involves the careful
definition of the layers, because a layer can use only those layers
below it.
A final problem with layered implementations is that they tend to be
less efficient than other types.
• Each layer adds overhead to the system call; the net result is a system
call that takes longer than does one on a non layered system.
AN OPERATING SYSTEM LAYER
OS/2 is a descendant of MSDOS that adds multitasking and
dual-mode operation, as well as other new features.
Because of this added complexity and the more powerful
hardware for which OS/2 was designed, the system was
implemented in a more layered fashion.
OS/2 has the advantage: direct user access to low-level facilities is
not allowed, providing the operating system with more control
over the hardware and more knowledge of which resources each
user program is using.
OS/2 LAYER STRUCTURE
3. Microkernel System Structure
As the UNIX operating system expanded, the kernel became large and
difficult to manage.
In the mid-1980s, researchers developed an os called Mach that
modularizes the kernel using the microkernel approach.
Moves as much from the kernel into “user” space. This results in a small
kernel.
Communication takes place between user modules using message
passing.
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
Microkernels provide minimal process and memory management, in
addition to a communication facility between the client program and
the various services that are also running in user space.
Ex: UNIX, Apple MacOS, QNX.
Windows NT uses a hybrid structure.
Part of the Windows NT architecture uses layering.
Windows NT is designed to run various applications, including Win32
,0S/2, and POSIX.
The kernel coordinates the message passing between client
applications and application servers.
WINDOWS NT CLIENT-SERVER
STRUCTURE
VIRTUAL MACHINES
A virtual machine takes the layered approach to its logical conclusion.
It treats hardware and the operating system kernel as though they were
all hardware.
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.
The resources of the physical computer are shared to create the virtual
machines.
VIRTUAL MACHINES (CONT.)
⚫ CPU scheduling can create the appearance that users have their own
processor.
Advantages: The virtual-machine concept provides complete protection
of system resources since each virtual machine is isolated from all other
virtual machines.
System development is done on the virtual machine, instead of on a
physical machine and so does not disrupt normal system operation.
Disadvantages: The virtual machine concept is difficult to implement .
Due to isolation, no direct sharing of resources is permitted.
SYSTEM MODELS

Non-virtual Machine Virtual Machine

Non-virtual Machine Virtual Machine


JAVA VIRTUAL MACHINE
Java is a very popular object-oriented language introduced by Sun
Microsystems in late 1995.
In addition to a language specification and a large API library, Java
also provides a specification for a JVM.
Java program consists of one or more classes.
For each Java class, the Java compiler produces an platform-neutral
bytecode output (. class) file that will run on any implementation of
the JVM.
JVM consists of
- class loader
- class verifier
- runtime interpreter to execute platform-neutral bytecodes.
Just-In-Time (JIT) compilers increase performance
JAVA VIRTUAL MACHINE
JIT compiler that turns the platform-neutral bytecodes into native
machine language for the host computer.
The JVM makes it possible to develop programs that are architecture
neutral and portable.
Java takes advantage of the complete environment that a virtual
machine implements.
Its virtual-machine design provides a secure, efficient, object
oriented, portable, and architecture-neutral platform on which to
run Java programs.

You might also like