Os Unit 1
Os Unit 1
Services
Operating Systems Function (Component)
Process Management
Memory Management
Device Management
File Management
Protection & Security
Networking
Command-Interpreter System
Process Management
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
Concurrency by multiplexing the CPUs among the processes /
threads
Process Management Activities
The operating system is responsible for the following activities in connection
with process management:
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
All instructions in memory in order to execute
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 (or parts thereof ) and data to move into and out
of memory
Allocating and deallocating memory space as needed
Storage Management
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 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.
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
Some storage need not be fast
Tertiary storage includes optical storage, magnetic tape
Still must be managed
Varies between WORM (write-once, read-many-times) and RW (read-write)
I/O Subsystem
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
Device Management
Opening or attaching a device to a process
Reading data from a device
Writing data to a device
Closing or releasing a device
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
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
Networking
Establish a connection to a remote service
Listening for connection from remote client
Sending message to a remote system
Receiving message from remote system
Closing connection to a remote system
Operating Systems Services
1. Program creation
2. Program execution
3. Input/output operations
4. Error detection
5. Resource allocation
6. Accounting
7. protection
A View of Operating System Services
Operating System Services (Cont)
One set of operating-system services provides functions that are
helpful to the user (Cont):
Communications – Processes may exchange
information, on the same computer or between
computers over a network
Communications may be via shared memory or through
message passing (packets moved by the OS)
Error detection – OS needs to be constantly aware of
possible errors
May occur in the CPU and memory hardware, in I/O devices,
in user program
For each type of error, OS should take the appropriate action
to ensure correct and consistent computing
Debugging facilities can greatly enhance the user’s and
programmer’s abilities to efficiently use the system
Operating System Services (Cont)
Another set of OS functions exists for ensuring the efficient operation of the system
itself via resource sharing
Resource allocation - When multiple users or multiple jobs running
concurrently, resources must be allocated to each of them
Many types of resources - Some (such as CPU cycles, main memory, and
file storage) may have special allocation code, others (such as I/O devices)
may have general request and release code
Accounting - To keep track of which users use how much and what kinds of
computer resources
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.
Command-Interpreter System
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
Commands may have counterparts for use in
programming
Ascii command line vs. graphic interface,
Windows explorer, “add-ins” like Norton Utilities
Command-Interpreter System (Cont.)
The program that reads and interprets control
statements is called variously:
command-line interpreter (Control card interpreter in
the “old batch days”)
shell (in UNIX)
Command.com for external commands in DOS
Read-only memory
basic input/output
device drivers were
here. (burned in
chips)
Simple Structure (continued)
Detriments:
Communications occurs between user modules using message passing
This means that Clients acquire service only indirectly by communication via
messages with the microkernel
So, clearly, overall performance suffers because of increased system
function overhead (passing parameters, and more)
This is very significant!
Kernel
Kernel provide basic interface between the m/c itself
&
the rest of the operating system. it is responsible for the
management of the central processor.
It takes control early in the boot process & manages
disk, n/w and process.
OS kernel can be seen as the interface between devices
& processes.
Function of Kernel
To provide a mechanism for creation and deletion of
process.
To provide CPU scheduling , memory management &
device management for the process
To provide synchronization tools so that processes can
synchronize their action.
To provide communication tools so that process can
communicate with each other.
Give security and privacy services.
System Call System Call System Call System Call
Hardware OS User
Kernel Shell or
Command interpreter