You are on page 1of 25

Operating System(22516)

Class:CO5I
Prof. Shilpa Budhavale
Department of Computer Engineering
School of Polytechnic & Skill Development
Unit II:Services and Components of
Operating System
[ Marks-10]
Course Outcome
CO 2: Use operating system tools to perform various functions.

Unit Outcomes
a. Start, stop services in Linux
b. Use system calls
c. Understand process of OS in managing given recourses
Points to be Covered
▪Services of operating system
▪System call
▪OS components
A View of Operating System Services
Operating System Services
Operating systems provide an environment for execution of programs and services
to programs and users
One set of operating-system services provides functions that are helpful to the
user:
◦User interface - Almost all operating systems have a user interface (UI).
◦Varies between Command-Line (CLI), Graphics User Interface (GUI), Batch
◦Program execution - The system must be able to load a program into memory
and to run that program, end execution, either normally or abnormally
(indicating error)
◦I/O operations - A running program may require I/O, which may involve a file or
an I/O device
◦File-system manipulation - The file system is of particular interest. Programs
need to read and write files and directories, create and delete them, search
them, list file Information, permission management.
Operating System Services (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.
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 Program Interface (API) rather than
direct system call use
Example of System Calls
System call sequence to copy the contents of one file to another file
System Call Implementation
Typically, a number associated with each system call
◦ System-call interface maintains a table indexed according to these numbers

The system call interface invokes intended system call in OS kernel and returns status of the
system call and any return values

The caller need know nothing about how the system call is implemented
◦ Just needs to obey API and understand what OS will do as a result call
◦ Most details of OS interface hidden from programmer by API
◦ Managed by run-time support library (set of functions built into libraries included with
compiler)
API – System Call – OS Relationship
Types of System Calls
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

File management
◦ create file, delete file
◦ open, close file
◦ read, write, reposition
◦ get and set file attributes
Types of System Calls (Cont.)
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 and set process, file, or device attributes

Communications
◦ create, delete communication connection
◦ send, receive messages
◦ transfer status information
◦ attach and detach remote devices
Examples of Windows and
Unix System Calls
Component activities
1. Process management
2. Memory management
3. Secondary storage management
4. File management
5. I/O system
6. Networking
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
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
• User process Single Threaded
• System process Multi threaded

• The OS is responsible for the following activities in connection with processes managed.
• The creation and deletion of both user and system processes
• The suspension are resumption of processes.
• The provision of mechanisms for process synchronization
• Process communication
• The provision of mechanisms for deadlock handling
Main Memory Management
• Memory is central to the operation of a modern computer system.

• Memory is a large array of words or bytes, each with its own address. I

• interaction is achieved through a sequence of reads or writes of specific memory address. The CPU fetches from and stores in
memory.

• In order for a program to be executed it must be mapped to absolute addresses and loaded in to memory.

• In order to improve both the utilization of CPU and the speed of the computer's response to its users, several processes must
be kept in memory.

• The operating system is responsible for the following activities in connection with memory management.

• Keep track of which parts of memory are currently being used and by whom.

• Decide which processes are to be loaded into memory when memory space becomes available.

• Allocate and deallocate memory space as needed


Secondary Memory Management
• Since the main memory is too small to permanently accommodate all data and program, the
computer system must provide secondary storage to backup main memory.

• Most modem computer systems use disks as the primary on-line storage of information, of
both programs and data.

• The operating system is responsible for the following activities in connection with disk
management

• Free space management

• Storage allocation
File Management
•Computers can store information in several different physical forms; magnetic tape, disk, and drum
are the most common forms. Each of these devices has it own characteristics and physical
organization.
• Files are mapped, by the operating system, onto physical devices.

• In general a files is a sequence of bits, bytes, lines or records whose meaning is defined by its
creator and user.

• A file is a collection of related information defined by its creator. Commonly, files represent

• programs (both source and object forms)

• data files may be numeric, alphabetic or alphanumeric , text files


• Also files are normally organized into directories to ease their use. Finally, when multiple users have
access to files, it may be desirable to control by whom and in what ways files may be accessed.

The operating system is responsible for the following activities in connection with file management:

The creation and deletion of files

The creation and deletion of directory

The support of primitives for manipulating files and directories

The mapping of files onto disk storage.

Backup of files on stable (non volatile) storage.


I/O Management
• One of the purposes of an operating system is to hide the peculiarities of specific hardware devices
from the user.

• For example, in Unix, the peculiarities of I/O devices are hidden from the bulk of the operating
system itself by the I/O system.

• The I/O system consists of:

• A buffer caching system

• A general device driver code

• Drivers for specific hardware devices.


Operating System Tools

User management,
Security policy,
Device management
Performance monitor,
Task scheduler
THANK YOU

You might also like