0% found this document useful (0 votes)
32 views9 pages

Osy Chapter 02

Uploaded by

Khan Rahil Ahmed
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)
32 views9 pages

Osy Chapter 02

Uploaded by

Khan Rahil Ahmed
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/ 9

CHAPTER NO 02:-SERVICES AND COMPONENTS OF

OPERATING SYSTEM
Services in Operating System:

Program Execution

 It is the Operating System that manages how a program is going to be


executed. It loads the program into the memory after which it is executed.
 The OS provides an environment where the user can conveniently run
these programs
 The OS must be able to load the program into memory and to execute it.
The order in which they are executed depends on the CPU Scheduling
Algorithms.
 The Operating System is responsible for the smooth execution of both user
and system programs. The Operating System utilizes various resources
available for the efficient running of all types of functionalities.
 The program must be able to terminate its execution,either normally or
abnormally

Input Output Operations

 Operating System manages the input-output operations and establishes


communication between the user and device drivers.
 Device drivers are software that is associated with hardware that is being
managed by the OS so that the sync between the devices works properly.
 It also provides access to input-output devices to a program when needed.
 Each program requires an input and after processing the input submitted
by the user it produces output.This involves use of I/O devices
 The input maybe written to some file on the disk or from some other input
device.The output may be written to some file on the disk or sent to some
output devices such as printer,plotter etc.

File Management

 File system manipulation is a fundamental operating system service that


involves managing and controlling the organization, storage, retrieval,
naming, sharing, and protection of files and directories on a computer's
storage devices.
 While working on computer generally a user is required to manipulate
various types of files like as opening a file,saving a file,deleting a file
 The operating system helps in managing files also. If a program needs
access to a file, it is the operating system that grants access.
 These permissions include read-only, read-write, etc. It also provides a
platform for the user to create, and delete files.
 Examples of file system manipulation functions in various operating systems
include open, close, read, write, create, delete, rename.These functions are typically
accessible through system calls or APIs provided by the operating system.

Error Handling

 Error handling is a crucial operating system service that involves managing


and responding to various types of errors, exceptions, and abnormal
conditions that can occur during the execution of programs and services.
 The Operating System also handles the error occurring in the CPU, in Input-
Output devices, etc. It also ensures that an error does not occur frequently
and fixes the errors.
 The well-secured OS sometimes also acts as a countermeasure for
preventing any sort of breach of the Computer System from any external
source and probably handling them.
 When errors occur, the operating system needs to provide clear and
informative error messages to users, administrators, and applications. These
messages should help diagnose the problem and suggest possible solutions.

Resource Management

 Resource management is a critical operating system service that involves the


allocation, monitoring, and control of various hardware and software
resources within a computer system
 Effective resource management ensures that different processes and
applications running on the system can share resources efficiently
 System resources are shared between various processes. It is the Operating
system that manages resource sharing.
 It also manages the CPU time among processes using CPU Scheduling
Algorithms. It also helps in the memory management of the system and
controls input-output devices.
 The OS also ensures the proper use of all the resources available by
deciding which resource to be used by whom.

Communication between Processes

 The Operating system manages the communication between processes.


 Communication system services in an operating system facilitate the
exchange of information, data, and signals between different processes,
applications, and devices within a computer system.
 These services enable efficient and reliable communication, coordination,
and synchronization among various components.
 In multitasking environment the processes needs to communicate with
each other to exchange information among them and the communication
between these process is done by the OS.

Security

 In an operating system, protection is a mechanism that controls the access


of the process, programs, or users over any resources of the computer
system.
 Security services in an operating system are essential components that are
responsible for ensuring the protection, integrity, and confidentiality of
system resources, data, and user activities.
 The operating system ensures that all access to system resources must be
monitored and controlled.
 When multiple users are involved and there is a concurrent execution of
multiple processes then various process must be protected from one
another’s activities.

Accounting

 Accounting refers to the process of tracking and monitoring the resource


usage of various processes and users within a computer system.
 This service provides insights into how system resources, such as CPU time,
memory, disk I/O, and network usage, are allocated and utilized by different
processes.
 To keep track of which users use how much and what kinds of computer
resources.OS keeps an account of all the resources accessed by each process
or user.
 Accounting services are often implemented as part of the operating system
kernel or as system utilities.

System Calls:
 A system call is the programmatic way in which a computer program
requests a service from the kernel of the operating system it is executed on.
 OS provides a variety of system calls to control the process.All the processors
provide instructions that can be used as a system calls.
 They act as a bridge between user-space and kernel-space, enabling user
programs to access operating system services and resources in a controlled
and secure manner.
 It provides the interface between a running program and the operating
system.
 A number of services are requested by the program, and the OS
responds by launching a number of systems calls to fulfill the request.

System call parameters:


Three general method exist for passing parameters to the OS:
1. Parameters can be passed in registers
2. When there are more parameters that registers, parameters can be stored in
the block and the block address can be passed as a parameter to the register
3. Parameters can also be pushed on or popped off the stack by the operating
system.
Types of System Calls:

1. Process Control:
 If we create a new job or process we should able to control its execution
 Process control system calls are a category of system calls that allow user-
level processes to manage and control processes within an operating system.
 These system calls provide essential functionalities for process creation,
termination, and process status management.
 These system calls enable user-level processes and applications to control
the execution of processes, and perform other process-related operations.
 Examples of process related system call:
I. End,Abort
II. Load,Execute
III. Create process, Terminate process
IV. Suspend process,Resume process
V. Get process attribute, Set process attribute
VI. Wait event,Signal event

2. File management:
 File management system calls in an operating system provide a way for
processes and applications to interact with files and directories.
 System allows us to create and delete files. For create and delete operation
system call requires the name of the file and other attributes of the file.
 File attributes include file type, file size, protection codes, accounting
information and so on. Systems access these attributes for performing
operations on file and directories.
 Once the file is created, we can open it and use it. System also allows
performing reading, writing or repositioning operations on file.
i. create file delete file
ii. open, close
iii. read, write, reposition
iv. get file attributes, set device attributes
v. logically attach or detach devices
3.Device Management:
 Device management system calls in an operating system provide a way for
processes and applications to interact with hardware devices, such as disks,
printers, network interfaces, and other peripherals.
 When a process is in running state, it requires several resources to execute.
These resources include main memory, disk drives, files and so on.
 If the resource is available, it is assigned to the process. Once the resource is
allocated to the process, process can read, write and reposition the device.
i. request device, release device
ii. read, write, reposition
iii. get device attributes, set device attributes
iv. logically attach or detach devices

4.Information Maintenance:
 Transferring information between the user program and the operating
system requires system call.
 System information includes displaying current date and time, the number
of current user, the version number of the operating system, the amount of
free memory or disk space and so on.
 Operating system keeps information about all its processes that can be
accessed with system calls such as get process attributes and set process
attributes.
i. get time or date, set time or date
ii. get system data, set system data
iii. get process, file, or devices attributes
iv. set process, file, or devices attributes

Communication:
 Processes in the system, communicate with each other. Communication is
done by using two models: message passing and shared memory.
 In message passing the communicating processes exchange messages with
one another to transfer information. It uses a common mailbox to pass
messages between processes
 Shared memory is a mechanism where two or more processes can directly
access a common region of memory. This memory region is allocated by the
operating system and can be used for reading and writing data. For
transferring messages, sender process connects itself to receiving process by
specifying receiving process name or identity. Once the communication is
over system close the connection between communicating processes.
I. Establish a connection
II. Send,receive messages
III. Terminate a connection
Operating System Components:

1. Process Management:
 A program is a set of instructions. When CPU is allocated to a program, it can
start its execution. A program in execution is a process.
 A word processing program run by a user on a PC is a process. A process
needs various system resources including CPU time, memory, files and I/O
devices to complete the job execution. These resources can be given to the
process when it is created or allocated to it while it is running.
 The operating system responsible for the following activities in connection
with process management:
 Creation and deletion of user and system processes.
 Suspension and resumption of processes.
 A mechanism for process synchronization.
 A mechanism for process communication.
 A mechanism for deadlock handling.

2. Main-Memory Management:
 Main memory is a large array of words or bytes, ranging in size from
hundreds of thousands to billions. Each word or byte has its own address.
Main memory is a repository of quickly accessible data shared by the CPU
and I/O devices. The central processor reads instructions from main
memory during the instruction fetch cycle and both reads and writes data
from main memory during the data fetch cycle. The main memory is
generally the only large storage device that the CPU is able to address and
access directly.
 The operating system responsible for the following activities in connection
with main memory s management:
1. Keeping track of which parts of memory are currently being used and by
whom.
2. Deciding which processes (or parts thereof) and data to move into and out of
memory.
3. Allocating and deallocating memory space as needed.

3. File Management:
 A file is a collection of related information defined by its creator. Computer
can store files on the disk (secondary storage), which provide long term
storage. Some examples of storage media are magnetic tape, magnetic disk
and optical disk. Each of these media has its own properties like speed,
capacity, and data transfer rate and access methods. A file system normally
organized into directories to ease their use. These directories may contain
files and other directions.
 The operating system responsible for the following activities in connection
with file management:
1. The creation and deletion of files.
2. The creation and deletion of directions.
3. The support of primitives for manipulating files and directions.
4. The mapping of files onto secondary storage.
5. The backup of files on stable storage media

4. I/O device Management


 Input / Output device management provides an environment for the better
interaction between system and the I / O devices (such as printers, scanners,
tape drives etc.). To interact with I/O devices in an effective manner, the
operating system uses some special programs known as device driver. The
device drivers take the data that operating system has defined as a file and
then translate them into streams of bits or a series of laser pulses (in regard
with laser printer).
The I/O subsystem consists of several components:
1. A memory management component that includes buffering, caching,
spooling
2. A general device driver interface
3. Drivers for specific hardware devices

4. Secondary-Storage Management:
 The computer system provides secondary storage to back up main memory.
Secondary storage is required because main memory is too small to
accommodate all data and programs, and the data that it holds is lost when
power is lost. Most of the programs including compilers, assemblers, word
processors, editors, and formatters are stored on a disk until loaded into
memory. Secondary storage consists of tapes drives, disk drives, and other
media.
 The operating system is responsible for the following activities in connection
with disk management:
1. Free space management
2. Storage allocation
3. Disk scheduling.

Use of Operating System Tools:

User Management:
 As the administrator it is your job to create and manage the accounts for all
required users. To facilitate this, linux comes with several tools for user
management.
 It includes everything from creating a user to deleting a user on your system
 Following are the linux command line tools for managing users and groups:
 Useradd
 Usermod
 Userdel
 Root:The root is the superuser, and haqve all the powers for creating a
user,deleting a user.
Security Policy:
 Keep system updated:Always keep the system with latest releases
patches,security fixes and kernel when its available.
 Deactivate network port: With the help of ‘netstat’ networking command you
can view all openports. Use ‘chckconfig’ command to disable all unwanted
network services.
 Lock and unlock features: Instead of removing an account from the system
you can lock it for an week or a month.
 Turn of IPV6: If you are not using iPV6 protocol then you should disable it
because most of the application does not require IPV6 protocol.
 Enables firewall: It is higly recommended to enable linux firewall to secure
unauthorised access of your system.
 Use strong password policy
 Install Antimalware/Antivirus software

Device Management:
 Device files are employed to provide the operating system and users an
interface to the devices that they represent.
 All Linux device files are located in the /dev directory, which is an integral
part of the root (/) filesystem because these device files must be available to
the operating system during the boot process.
 Data is passed from an application or the operating system to the device file
which then passes it to the device driver which then sends it to the physical
device.

Task Scheduler:
 "Task Scheduler" is a combination of several tools and services that allow
users to schedule and automate tasks or jobs. These tools are typically used
through the command line or configuration files.
 One of the most commonly used task scheduling tools in Linux is the cron
system.
 cron: cron is a time-based job scheduler in Linux and other Unix-like
operating systems. It allows users to schedule tasks (known as cron jobs) to
run at specified intervals or times.
 These tasks can be scripts, commands, or any executable file. The cron jobs
are defined in the crontab (cron table) files.

You might also like