0% found this document useful (0 votes)
7 views17 pages

Introduction

An operating system (OS) is essential software that manages computer hardware and enables application programs to function. It performs tasks such as memory management, process scheduling, and input/output control, while also providing a user interface. Various types of operating systems exist, including mainframe, desktop, real-time, and distributed systems, each designed to meet specific user needs and computing environments.

Uploaded by

Ria Singh
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)
7 views17 pages

Introduction

An operating system (OS) is essential software that manages computer hardware and enables application programs to function. It performs tasks such as memory management, process scheduling, and input/output control, while also providing a user interface. Various types of operating systems exist, including mainframe, desktop, real-time, and distributed systems, each designed to meet specific user needs and computing environments.

Uploaded by

Ria Singh
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

Roadmap What is an Operating System?

• Definition: OPERATING SYSTEM • Operating System is a software, which makes a computer to


actually work.
• Mainframe Systems
• It is the software that enables all the programs we use.
• Desktop Systems • The OS organizes and controls the hardware.
• OS acts as an interface between the application programs and the
• Multiprocessor Systems machine hardware.
• Distributed Systems
Examples: Windows, Linux, Unix and Mac OS, etc.,
• Clustered System • Operating system goals:
– Make the computer system convenient to use.
• Real -Time Systems
– Use the computer hardware in an efficient manner.
• Handheld Systems – Execute user programs and make solving user problems easier.

• Computing Environments
Operating System Concepts Operating System Concepts

Operating System Example – MS-Paint over Windows


An operating system performs basic tasks such • Assume we are using MS-Paint over Windows - when do we
need to access the OS?
as, – Loading the application / terminating the application
• controlling and allocating memory, – Memory allocation / management (e.g., paging)
• prioritizing system requests, – Access to IO devices – keyboard, mouse, printer, monitor
– CPU allocation
• controlling input and output devices, – Copy / Paste (inter-process communication)
• facilitating networking and
• managing file systems.

Operating System Concepts


Mainframe, PC, Handheld
Operating System Design & Goals • Supercomputer - computer at the frontline of current processing
capacity, particularly speed of calculation.
• Each OS has different goals and design: • Mainframe – powerful computers used mainly by large
– Mainframe – maximize HW utilization/efficiency organizations for critical applications (the term originally referred to
the large cabinets that housed the central processing unit and main
– PC – maximum support to user applications memory of early computers. Later the term was used to distinguish
– Handheld – convenient interface for running high-end commercial machines from less powerful units)
applications, performance per amount of battery life • Personal Computer (PC) - any general-purpose computer whose
size, capabilities, and original sales price make it useful for
individuals (and which is intended to be operated directly by an
end-user with no intervening computer operator)
efficiency convenience • Handheld - pocket-sized computing device, typically having a
display screen with touch input and/or a miniature keyboard.
performance, ease of use
resource utilization
• Of course, one generation's "supercomputer" is
the next generation's "mainframe"

Computer System Structure Computer System Structure


• Computer system can be divided into four components
– Hardware – provides basic computing resources
: CPU, memory, I/O devices, file storage space
– 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
• People, machines (e.g., embedded), other computers
Operating System Operating System Definition
• No universally accepted definition
• OS is a resource allocator • “Everything a vendor ships when you order an
– Manages all resources (OS as a government allegory) operating system” is good approximation.
– Decides between conflicting requests for efficient and
fair resource use
• OS is a control program • “The one program running at all times on the
– Controls execution of programs to prevent errors and computer” is the kernel. Everything else is
improper use of the computer
either a system program (ships with the
• Resource allocation and control is especially important operating system) or an application program-
when having several users connected to the same
mainframe or microcomputer

Computer Startup Simple Batch Systems


• Hire an operator
• bootstrap program is loaded at power-up or reboot
• User ≠ operator
– Typically stored in ROM or EPROM, generally
• Add a card reader
known as firmware
• Reduce setup time by batching similar jobs
– Initializes all aspects of system (CPU registers,
device controllers, memory contents, etc.) • Automatic job sequencing – automatically transfers control
from one job to another. First rudimentary operating system.
– Loads operating system kernel and starts execution
• Resident monitor
– initial control in monitor
– control transfers to job
OS initializes, starts its first
process and waits for an – when job completes control transfers back to monitor
event…

Operating System Concepts


Memory Layout for a Simple Batch System Spooling
• Overlap I/O of one job with computation of another job.
While executing one job, the OS.

– Reads next job from card reader into a storage area on


the disk (job queue).
– Outputs printout of previous job from disk to printer.

• Job pool – data structure that allows the OS to select


which job to run next in order to increase CPU utilization.

Operating System Concepts Operating System Concepts

Multiprogrammed Systems Memory Layout for Multiprogrammed System

• Multiprogramming needed for efficiency


– Single user cannot keep CPU and I/O devices busy at all times
– Multiprogramming organizes jobs (code and data) so CPU
always has one to execute
– A subset of total jobs in system is kept in memory
– One job selected and run via job scheduling
– When it has to wait (for I/O for example), OS switches to
another job
• Unlike sitting idle in a non-multiprogrammed system
– The idea is common in other life situations (e.g., lawyers)

as long as at least one job needs to execute, the CPU is never idle…
OS Features Needed for Multiprogramming Time sharing Systems
• Timesharing (multitasking) is logical extension in which CPU
• I/O routine supplied by the system. switches jobs so frequently that users can interact with each
job while it is running, creating interactive computing
• Memory management – the system must – Response time should be < 1 second
allocate the memory to several jobs. – Each user has at least one program executing in memory
process
• CPU scheduling – the system must choose – If several jobs ready to run at the same time  CPU
among several jobs ready to run. scheduling
– If processes don’t fit in memory, swapping moves them
• Allocation of devices. in and out to run
– Virtual memory allows execution of processes not
completely in memory

Operating System Concepts

Personal-Computer Systems Parallel Systems


• Multiprocessor systems with more than one CPU in close
• Personal computers – computer system dedicated to communication.
a single user. • Tightly coupled system – processors share bus, clock and
sometimes memory and peripheral devices; communication
• I/O devices – keyboards, mice, display screens, small
usually takes place through the shared memory.
printers.
• Advantages of parallel system:
• User convenience and responsiveness. – Increased throughput
• Can adopt technology developed for larger operating – Economical
system’ often individuals have sole use of computer – Increased reliability
and do not need advanced CPU utilization of • graceful degradation
protection features.

Operating System Concepts Operating System Concepts


Parallel Systems (Cont.) Symmetric Multiprocessing Architecture
• Symmetric multiprocessing (SMP)
– Each processor runs an identical copy of the
operating system.
– Many processes can run at once without
performance deterioration.
– Most modern operating systems support SMP
• Asymmetric multiprocessing
– Each processor is assigned a specific task; master
processor schedules and allocates work to slave
processors.
– More common in extremely large systems

Operating System Concepts Operating System Concepts

Distributed Systems Distributed Systems


• Collection of separate, possibly heterogeneous, • Distribute the computation among several physical
systems networked together processors.
– Network is a communications path
• Loosely coupled system – each processor has its own
– Local Area Network (LAN) local memory; processors communicate with one
– Wide Area Network (WAN) another through various communications lines, such as
– Metropolitan Area Network (MAN) high-speed buses or telephone lines.
• Network Operating System provides features • Advantages of distributed systems.
between systems across network – Resources Sharing
– Communication scheme allows systems to – Computation speed up – load sharing
exchange messages – Reliability
– Illusion of a single system – Communications
Operating System Concepts
Distributed Systems Distributed Systems
Client-Server Computing Peer to Peer systems (P2P):Another model of
Dumb terminals supplanted by smart PCs distributed system
Many systems now servers, responding to requests
generated by clients •P2P does not distinguish clients and servers
Compute-server provides an interface to client to
– Instead all nodes are considered peers
request services (i.e. database) – May each act as client, server or both
 File-server provides interface for clients to store and – Node must join P2P network
retrieve files • Registers its service with central lookup service
on network, or
• Broadcast request for service and respond to
requests for service via discovery protocol
– Examples include Napster and Gnutella

Clustered Systems
Real-Time Systems
• Like multiprocessor systems, but multiple systems working
A real time system has well-defined, fixed-time constraints.
together
Processing must be done within the defined constraints or the
– Usually sharing storage via a storage-area network (SAN) system will fail. Often used as a control device in a dedicated
– Provides a high-availability service which survives failures application such as:
• Asymmetric clustering has one machine in hot-standby ✓controlling scientific experiments
mode
✓medical imaging systems
• Symmetric clustering has multiple nodes running ✓ industrial control systems, display systems
applications, monitoring each other
✓automobile engine fuel injection system
– Some clusters are for high-performance computing (HPC)
✓ home-appliance controllers and weapon systems.
• Applications must be written to use parallelization
A real time system functions correctly only if it returns the correct
result within its time constraints in contrast to time sharing or
batch applications.
Operating System Concepts



Types
• Hard real-time system: Guarantees the completion of critical Open-Source Operating Systems
task to be completed on time.
– Secondary storage limited or absent, data stored in short- • Operating systems made available in source-code format
term memory, or read-only memory (ROM) rather than just binary closed-source
– Doesn’t support advanced features of Operating system like • Counter to the copy protection and Digital Rights Management
virtual memory. (DRM) movement
– Conflicts with time-sharing systems, not supported by
general-purpose operating systems. • Started by Free Software Foundation (FSF), which has
“copyleft” GNU Public License (GPL)
• Soft real-time system: a less restrictive where critical real time
task is given higher priority. • Examples include GNU/Linux, BSD UNIX (including core of Mac
OS X), and Sun Solaris
– Limited utility in industrial control or robotics
– Useful in applications (multimedia, virtual reality) requiring
advanced operating-system features.

Operating System Concepts

Special-Purpose Systems Operating System Components


• Process Management
• Multimedia systems • Main Memory Management
– Streams of data must be delivered according
to time restrictions • File Management

• Handheld systems • I/O System Management


– PDAs, smart phones, limited CPU, memory, • Secondary Management
power • Networking
– Reduced feature set OS, limited I/O
• Protection System
• Command-Interpreter System

Operating System Concepts


Process Management Process Management Activities
• 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. The operating system is responsible for the following activities in connection with
process management:
• Process needs resources to accomplish its task
– CPU, memory, I/O, files, Initialization data • Creating and deleting both user and system processes
• Process termination requires reclaim of any reusable resources
• Suspending and resuming processes
• Single-threaded process has one program counter specifying location of
next instruction to execute
– Process executes instructions sequentially, one at a time, until • Providing mechanisms for Process communication
completion
• Multi-threaded process has one program counter per thread • Providing mechanisms for Process synchronization
• Typically system has many processes, some user, some operating system
running concurrently on one or more CPUs • Providing mechanisms for Deadlock handling
– Concurrency by multiplexing the CPUs among the processes /
threads

File Management
Memory Management • A file is a collection of related information defined by its creator.
Commonly, files represent programs (both source and object forms)
• Memory is a large array of words or bytes, each with its own
and data.
address. It is a repository of quickly accessible data shared by the
CPU and I/O devices. • OS provides uniform, logical view of information storage
– Abstracts physical properties to logical storage unit - file
• Main memory is a volatile storage device. It loses its contents in the
case of system failure.
• File-System management
• All data in memory before and after processing
– Files usually organized into directories
• All instructions in memory in order to execute – Access control on most systems to determine who can access what
• Memory management determines what is in memory when – OS activities include
– Optimizing CPU utilization and computer response to users • Creating and deleting files and directories
• Memory management activities • Primitives to manipulate files and directories
– Keeping track of which parts of memory are currently being • Mapping files onto secondary storage
used and by whom • Backup files onto stable (non-volatile) storage media
– Deciding which processes (or parts thereof) and data to move
into and out of memory
– Allocating and De-allocating memory space as needed
Secondary Storage Management I/O Subsystem
• Since main memory (primary storage) is volatile and too small • One purpose of OS is to hide peculiarities of hardware devices from the
to accommodate all data and programs permanently, the user
computer system must provide secondary storage to back up
main memory. • I/O subsystem responsible for
• Most modern computer systems use disks as the principle on- – Memory management of I/O includes
line storage medium, for both programs and data. • Buffering (storing data temporarily while it is being transferred)
• Usually disks used to store data that does not fit in main • Caching (storing parts of data in faster storage for performance)
memory or data that must be kept for a “long” period of time. • Spooling (the overlapping of output of one job with input of
• Proper management is of central importance other jobs)
– General device-driver interface
• OS activities
– Drivers for specific hardware devices
– Free-space management
– Storage allocation
– Disk scheduling

Protection and Security


• Protection – any mechanism for controlling access of processes or Networking (Distributed Systems)
users to resources defined by the OS • A distributed system is a collection processors that do not
• Security – defense of the system against internal and external attacks share memory or a clock. Each processor has its own local
– Huge range, including denial-of-service, worms, viruses, identity memory.
theft, theft of service
• Systems generally first distinguish among users, to determine who can
• The processors in the system are connected through a
do what communication network.
– User identities (user IDs, security IDs) include name and associated • Communication takes place using a protocol.
number, one per user
• A distributed system provides user access to various system
– User ID then associated with all files, processes of that user to resources.
determine access control
– Group identifier (group ID) allows set of users to be defined and • Access to a shared resource allows:
controls managed, then also associated with each process, file – Computation speed-up
– Privilege escalation allows user to change to effective ID with more – Increased data availability
rights – Enhanced reliability

Operating System Concepts


Command-Interpreter System Command-Interpreter System (Cont.)
• Many commands are given to the operating • The program that reads and interprets control statements
system by control statements which deal with: is called variously:
– Process creation and management
– I/O handling – command-line interpreter
– Secondary-storage management – shell (in UNIX)
– Main-memory management
– File-system access Its function is to get and execute the next command
– Protection statement.
– Networking

Operating System Concepts Operating System Concepts

Operating System Services Operating System Services (Cont.)


• Operating systems provide an environment for execution of programs and
services to programs and users – Communications – Processes may exchange information, on
• One set of operating-system services provides functions that are helpful to the same computer or between computers over a network
the user: • Communications may be via shared memory or through
– User interface - Almost all operating systems have a user interface (UI). message passing (packets moved by the OS)
• Varies between Command-Line (CLI), Graphics User Interface (GUI),
Batch – Error detection – OS needs to be constantly aware of possible
– Program execution - The system must be able to load a program into errors
memory and to run that program, end execution, either normally or • May occur in the CPU and memory hardware, in I/O devices,
abnormally (indicating error) in user program
– I/O operations - A running program may require I/O, which may involve • For each type of error, OS should take the appropriate
a file or an I/O device action to ensure correct and consistent computing
– File-system manipulation - The file system is of particular interest. • Debugging facilities can greatly enhance the user’s and
Programs need to read and write files and directories, create and delete programmer’s abilities to efficiently use the system
them, search them, list file Information, permission management.
Operating System Services (Cont.) A View of Operating System Services
• 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
– 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
• If a system is to be protected and secure, precautions must be instituted
throughout it. A chain is only as strong as its weakest link.

System Calls Example of System Calls


• Programming interface to the services provided by • System call sequence to copy the
the OS contents of one file to another file
• Typically written in a high-level language (C or C++)
• Mostly accessed by programs via a high-level
Application Program Interface (API) rather than
direct system call use
• 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)
System Call Parameter Passing
Parameter Passing via Table
• 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 passed as a parameter in a register
• This approach taken by Linux and Solaris

– 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

Types of System Calls Types of System Calls (Cont.)


• Process control • Device management
– end, abort – request device, release device
– load, execute – read, write, reposition
– create process, terminate process – get device attributes, set device attributes
– get process attributes, set process attributes – logically attach or detach devices
– wait for time


wait event, signal event
allocate and free memory
• Information maintenance
– get time or date, set time or date
– get system data, set system data
• File management – get and set process, file, or device attributes
– create file, delete file


open, close file
read, write, reposition
• Communications
– get and set file attributes – create, delete communication connection
– send, receive messages
– transfer status information
– attach and detach remote devices
Examples of Windows and
Unix System Calls System Programs
• 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

• They can be divided into:


– File Management
– Status information
– File modification
– Programming language support
– Program loading and execution
– Communications
– Application programs

• Most users’ view of the operation system is defined by system


programs, not the actual system calls

System Programs System Programs (Cont.)


• File management - Create, delete, copy, rename, print, dump, list,
and generally manipulate files and directories
• Programming-language support - Compilers, assemblers, debuggers
and interpreters sometimes provided
• Status information
– System info - date, time, amount of available memory, disk • Program loading and execution- Absolute loaders, relocatable
space, number of users loaders, linkage editors, and overlay-loaders, debugging systems for
– Detailed performance, logging, and debugging information higher-level and machine language
– registry - used to store and retrieve configuration information
• Communications - Provide the mechanism for creating virtual
• File modification connections among processes, users, and computer systems
– Text editors to create and modify files – Allow users to send messages to one another’s screens, browse
– Special commands to search contents of files or perform web pages, send electronic-mail messages, log in remotely,
transformations of the text transfer files from one machine to another
Operating System Design and Implementation Operating System Design and
Implementation (Cont.)
• Design and Implementation of OS not “solvable”,
but some approaches have proven successful • Important principle to separate
• Internal structure of different Operating Systems Policy: What will be done?
can vary widely Mechanism: How to do it?
• Start by defining goals and specifications
• Affected by choice of hardware, type of system • Mechanisms determine how to do something,
• User goals and System goals policies decide what will be done
– User goals – operating system should be convenient to use, easy to – The separation of policy from mechanism is a very
learn, reliable, safe, and fast important principle, it allows maximum flexibility if
policy decisions are to be changed later
– System goals – operating system should be easy to design,
implement, and maintain, as well as flexible, reliable, error-free, and
efficient

Simple Structure MS-DOS Layer 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
UNIX Traditional UNIX System Structure
• UNIX – limited by hardware functionality, the original UNIX
operating system had limited structuring. The UNIX OS consists of
two separable parts

– Systems programs

– The kernel
• Consists of everything below the system-call interface and
above the physical hardware
• Provides the file system, CPU scheduling, memory
management, and other operating-system functions; a large
number of functions for one level

Layered Approach Layered 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.

• With modularity, layers are selected such that each uses


functions (operations) and services of only lower-level
layers
OS/2 Layer Structure Microkernel System Structure
• Moves as much from the kernel into “user” space

• Communication takes place between user modules using message


passing

• PROS:
– 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
• CONS:
– Performance overhead of user space to kernel space
communication

Operating System Concepts

You might also like