Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
573 views44 pages

PPT-Unit-2-Services and Components of Operating Systems

ppt

Uploaded by

catstudysss
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)
573 views44 pages

PPT-Unit-2-Services and Components of Operating Systems

ppt

Uploaded by

catstudysss
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/ 44

Unit-2 Services and Components of Operating System

Chapter Outcomes:
• Start, stop, and restart the given service in Linux.
• Explain use of the given system call of specified OS.
• Explain process the OS follows in managing the given resource.
• Explain use of the given operating system tool.

Learning Objectives:
• To understand different Services of Operating System
• To learn Concepts of System Calls
• To study different Components of Operating Systems
• To learn Use of Operating System Tools
Operating System Services
Operating System Services
Program Execution: The purpose of computer system is to allow the users to execute
programs in an efficient manner. The operating system provides an environment where the
user can conveniently run these programs. The user does not have to worry about the
memory allocation or de-allocation or any other thing because these things are taken care of
by the operating system. The operating system must be able to load the program into memory
and to execute it. The program must be able to terminate its execution, either normally or
abnormally.

I/O Operations: Each program requires an input and after processing the input submitted by
user it produces output. This involves the use of I/O devices. The input may be either from a
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. Since user programs cannot
execute I/O operations directly, the operating system must provide some means to perform
I/O.
Operating System Services
File System Manipulation: While working on the computer, generally a user is required to
manipulate various types of files like as opening a file, saving a file and deleting a file from the
storage disk. Program needs to read a file or write a file. The operating system gives the
permission to the program for operation on file. Maintain details of files or directories with
their respective details. This is an important task that is also performed by the operating
system.

Communications: Operating system performs the communication among various types of


processes in the form of shared memory. In multitasking environment, the processes need to
communicate with each other and to exchange their information. These processes are created
under a hierarchical structure where the main process is known as parent process and the sub
processes are known as child processes.
Operating System Services
Error Detection: Error can occur anytime and anywhere. Error may occur in CPU, in I/O devices
or in the memory hardware. Operating system deals with hardware problems. To avoid
hardware problems the operating system constantly monitors the system for detecting the
errors and fixing these errors (if found). The main function of operating system is to detect the
errors like bad sectors on hard disk, memory overflow and errors related to I/O devices. After
detecting the errors, operating system takes an appropriate action for consistent computing.

Resource Allocation: In the multitasking environment, when multiple jobs are running at a
time, it is the responsibility of an operating system to allocate the required resources (like as
CPU, main memory, tape drive or secondary storage etc.) to each process for its better
utilization. For this purpose various types of algorithms are implemented such as process
scheduling, CPU scheduling, disk scheduling etc.
Operating System Services
Accounting: Operating system keeps an account of all the resources accessed by each process
or user. In multitasking, accounting enhances the system performance with the allocation of
resources to each process ensuring the satisfaction to each process.

Protection: If a computer system has multiple users and allows the concurrent execution of
multiple processes, then the various processes must be protected from one another's
activities. Protection refers to mechanism or a way to control the access of programs,
processes, or users to the resources defined by a computer system. Providing protection to
program, data, and files and to ensure data security.

User Interface: Providing a User Interface (UI) to interact with users is essential for an
operating system. This interface can be in one of the several forms. One is Command Line
Interface (CLI) in which users interact with the operating system by typing commands. Another
is batch interface, in which several commands and directives to control those commands are
collected into files which are then executed. Another is Graphical User Interface (GUI), in which
users interact with the system with a pointing device, such as a mouse
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.
• This may include hardware-related services (for example, accessing a hard disk drive),
creation and execution of new processes, and communication with integral kernel services
such as process scheduling.
• Operating system provides a variety of system calls to control the process. Almost all
modern processors provide instructions that can be used as system calls.
• A system call is an instruction that does not execute a specific function in hardware but
instead generates an interrupt that cause the operating system to gain control of the
processor.
• The operating system then determines what kind of system call it is and perform the
appropriate service for the system caller
Concept of System Calls
• System calls provide the interface between a running program and the operating system.
• These calls are generally available as routines written in C and C++, although certain low-
level tasks (for example, tasks where hardware must be accessed directly), may need to be
written using assembly-language instructions.
• System calls allow user-level processes to request some services from the operating
system which process itself is not allowed to do.
• for I/O a process involves a system call telling the operating system to read or write
particular area and this request is satisfied by the operating system.
• 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).
Concept of System calls
System call Parameters
Three general methods exist for passing
parameters to the OS:
1. Parameters can be passed in registers.
2. When there are more parameters than
registers, parameters can be stored in a block
and the block address can be passed as a
parameter to a register.
3. Parameters can also be pushed on or popped
off the stack by the operating system.
System call Implementation
• System-call interface maintains a table
indexed according to these numbers. The
system call interface invokes intended system
call in operating system kernel and returns
status of the system call and any return
values.
• The caller needs to know nothing about how
the system call is implemented. Just needs to
obey API and understand what operating
system will do as a result call.
• Most details of operating system interface
hidden from programmer by API. It is
managed by run-time support library.
Types of System calls (Process and Job Control)
• A running program needs to be able to halt its execution either normally (end) or
abnormally (abort). If the program discovers an error in its input and wants to terminate
abnormally, it may also want to define an error level.

• A process or job executing one program may want to load and execute another program.
This allows the control card interpreter to execute program as directly by the control cards
of the user job. If we create a new job or process, we should able to control its execution.

• We may also want to terminate a job or process that we created (terminate process). If we
find that it is incorrect or no longer needed we need waiting time to finish execution (wait
time). Another set of system calls are helpful in debugging a program.
Types of System calls (Process and Job Control)
Example of Process related system call:
• End, Abort.
• Load, Execute.
• Create process, Terminate process.
• Ready process, Dispatch process.
• Suspend process, Resume process.
• Get process attributes, Set process attributes.
• Wait for Time.
• Wait event, Signal event.
• Change priority of process.
Types of System calls (File Management)
• We can identify several common system calls dealing with files. We first need to be able to
create and delete files such a system call requires the name of the file and perhaps some of
its attributes.
• Once, the file is created, we need to open it and use it. We may also read, write and
reposition. Finally we need to close the file, indicating that we are no longer using it.
• We may need these same sets of operations for directories it we have a directory structure
in the file system. In addition for either files or directories we need to be able to determine
the values of various attributes and perhaps reset them if necessary.
• File attributes include the file name, a file type, protection codes, accounting information
and so on. Two system calls get file attributes and set file attributes are required for this
function. Some operating systems provide many more calls, such as calls for file move and
copy.
Types of System calls (File Management)
Example of file related system call:
• Create file, Delete file
• Open a file, Close a file.
• Create directory.
• Read, Write, Reposition.
• Get file attributes, Set file attributes.
• Create a link.
• Change working directory.
Types of System calls (Device Management)
• Files can be thought of as abstract or virtual devices. Thus many of the system calls for files
are also needed for devices.
• If there are multiple users of the system however we must first request the device to
ensure that we have exclusive use of it. After we are finished with the device, we must
release it. These functions are similar to the open/close system calls for files.
• Once, the device has been requested we can read, write and reposition the device just as
with files. In fact the similarity between input/output devices and files is so great that many
operating systems merge the two into a combined file/device structure. In this case
input/output devices are identified by special file names.

System call related to device management:


• Request device, Release device.
• Read, Write, Reposition.
• Get device attributes, set device attributes.
Types of System calls (Information Maintenance)
• Many system calls exist simply for the purpose of transferring information between the
user program and the operating system. For example most systems have a system call to
return the current time and date.
• Other system calls may return information about the system such as the number of current
users, the version number of the operating system, the amount of free memory or disk
space and so on.
• In addition the operating system keeps information about all of its jobs and processes and
there are system calls to access this information. Generally, there are also calls to reset it.
(get process attributes and set process attributes).

Information Maintenance related system call:


• 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.
Types of System calls (Communication)
There are two models of inter-process communication, the message-passing model and the
shared memory model.
• Message-passing uses a common mailbox to pass messages between processes
• Shared memory use certain system calls to create and gain access to regions of memory
owned by other processes

Communication related system calls:


• Establish a connection.
• Send, receive messages.
• Terminate a connection
Operating System Components
We can create a system as large and complex as an operating system only by partitioning it into
smaller parts.
Each part is a well-defined portion of the system, with defined inputs, outputs and functions.
Process Management
• A process is a program in execution. A time shared user program such as compiler is a
process. A word processing program being run by an ideal machine is a process. Sending
printout to printer is also a process.
• Now we consider a process to be a job or a time shared program. A process needs certain
resources like CPU time, memory I/O devices and file to accomplish its task. These
resources are provided when process is created or allocated while it is running.
• Program is not a process; a program is a passive entity such as contents of file is stored on
disk, whereas a process is an active entity, with a program counter it specifies the next
instruction to execute.
• The execution of a process must be sequential. The CPU executes instructions one after
another, until the process completes.
• A process is the unit of work in a system. Such a system consists of a collection of
processes, some of our operating system processes and rest are user processes. All these
processes are executed concurrently.
Process Management
The operating system is responsible for the following activities w.r.t process management:
• Creating and deleting both user and system processes.
• Suspending and resuming processes.
• Providing mechanisms for process communication.
• Providing mechanisms for process synchronization.
• Providing mechanisms for deadlock handling.
Main memory Management
• The main memory is central to the operation of a modern computer system. Main memory
is a large array of words or bytes, ranging in size from hundreds of thousands to billions.
Each word or bytes has its own address. Main memory is act as an interface between CPU
and I/O devices and access data easily.
• The CPU process data from disk, those data first transferred to main memory by CPU
generated I/O calls. Equivalently instructions must be in memory for the CPU to execute
them.
• When a program to be executed, it must be mapped to absolute addresses and loaded in
memory. As the program executes, it accesses program instructions and data from memory
by generating these absolute addresses.
• When program is executed these memory space is reuse for the next program. To improve
the CPU utilization and speed of computers, we must keep several programs into memory.
Many different memory management schemes available to handle different situations.
Main memory Management
The operating system is responsible for the following activities w.r.t memory management:
• Keeping track of which parts of memory are currently being used and by whom.
• Deciding which processes are to be loaded into memory when memory space becomes
available.
• Allocating and de-allocating memory spaced as needed.
File Management
• Another important component of all the operating systems is file management, which
deals with the management and organisation of various files in the system.
• Computers can store information on several different types of physical media like magnetic
tape, magnetic disk and optical disk. Each of these media has its own characteristics and
physical organization. Each medium is controlled by device and this device also has unique
characteristics.
• These properties include access speed, capacity, and data transfer rate and access method.
A file is a collection of related information defined by its creator. Commonly file represents
program (source and object) and data.
• Data file may be numeric, alphabetic or alphanumeric. A file consists of a sequence of bits,
bytes, lines or records whose meanings are defined by its creators. Files are normally
organized into directories to easy their use.
File Management
The operating system is responsible for the following activities w.r.t file management:
• Creating and deleting files.
• Creating and deleting directories.
• Supporting primitives for manipulating files and directories.
• Mapping files on to secondary storage.
• Backing up files on storage media
I/O System Management
• The purpose of operating system is to hide the particular 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 subsystem.

The I/O subsystem consists of:


• 1. A memory management component that includes buffering, caching and spooling.
• 2. A general device driver interface.
• 3. Drivers for specific hardware devices.

• Only the device driver knows the peculiarities of the specific device to which it is assigned.
Secondary Storage Management
• The main purpose of operating system is to execute programs. These programs with data
must be in a main memory of in a primary storage during execution.
• Main memory is too small to accommodate all data and programs, and its data are lost
when power is lost, so that the computer system must provide secondary storage to back
up.
• Secondary storage consists of tapes, disks, and other media designed to hold information
that will eventually be accessed in primary storage (primary, secondary, cache) is ordinarily
divided into bytes or words consisting of a fixed number of bytes.
• Each location in storage has an address; the set of all addresses available to a program is
called an address space.
• Most programs including compilers, assemblers, editors and formatters are stored on a disk
until loaded into memory and then use the disk as both the source and destination of their
processing.
Secondary Storage Management
The operating system is responsible for the following activities w.r.t. disk management.
• Managing the free space available on the secondary-storage device.
• Allocation of storage space when new files have to be written.
• Scheduling the requests for memory access.
Use of Operating System Tools
Just like Windows XP, Windows 7, Windows 8, and Mac OS X, Linux is an operating system. An
operating system is software that manages all of the hardware resources associated with the
desktop computer or laptop
User Management
• As the administrator, it is your job to create and manage the accounts for all required users
(real and pseudo). To facilitate this, Linux comes with several tools for user management.
• User management includes everything from creating a user to deleting a user on your
system. User management can be done in three ways on a Linux system.
• Graphical tools are easy and suitable for new users, as it makes sure you'll not run into any
trouble.
• Command line tools includes commands like useradd, userdel, passwd, etc. These are
mostly used by the server administrators.
• Third and very rare tool is to edit the local configuration files directly using vi.
• Following are the Linux command line tools for managing users and groups:
• 1. useradd.
• 2. usermod.
• 3. userdel.
• root: The root user is the superuser and have all the powers for creating a user, deleting a
user and can even login with the other user's account. The root user always has userid 0.
Useradd: Creating new users
• To add new users in Linux system we can use
useradd command.
• The useradd command creates a new user
account using the value specified on the command
line and the default values from the system.
• Syntax: useradd login_name
• Example: useradd xyz
• The creation of this user can be confirmed by
examining the /ect/passwd file which should now
have an entry for this user.
• The –D parameter shows what defaults the
useradd command uses if you don’t specify them
in the command line when creating a new user
account.
• $ useradd –D
Passwd command
• The passwd command is used to set up passwords for users.
• Syntax: password user_name
• Example: $ passwd vijay

Changing password for vijay:


(current) UNIX password: 123 45
Enter new UNIX password: abc@123
Retype new UNIX password: abc@123
passwd: password updated successfully
Modify and delete users
• Usermod: Modifying Properties of User
• The command usermod is used to modify the properties of an existing user.
• Syntax: usermod -c <'newName'> <oldName>

• Userdel: Delete a user account


• To delete a user account userdel command is used. Syntax: userdel -r <userName>
Security Policy
1) Keep system updated
$ yum updates
$ yum check-update

2) Deactivate Networking Ports


With the help of ‘netstat‘ networking command you can view all open ports and associated
programs. Use ‘chkconfig‘ command to disable all unwanted network services from the
system.
$ netstat –tulpn

3) Lock and Unlock Features:


They are very useful, instead of removing an account from the system, you can lock it for an
week or a month. To lock a specific user, you can use the follow command.
$ passwd -1 accountname
Security Policy
4) Enables Iptables (Firewall)
It is highly recommended to enable Linux firewall to secure unauthorised access of your
servers. Apply rules in iptables to filters incoming, outgoing and forwarding packets.
We can specify the source and destination address to allow and deny in specific udp/tcp port
number.

5) Use Strong Password Policy:


Passwords are always a security problem because humans are. People often cannot be
bothered to come up with a lot of different passwords, so they use the same ones in different
places or combinations that are easy to remember, like “password” or “abcde”. Basically, a gift
to hackers.
Security Policy
6) Use SFTP, not FTP
File Transfer Protocol (FTP) is not safe anymore, even if you encrypt your connection.
SFTP is “FTP over SSH” (also called “secure FTP”), and it encrypts all the data, credentials and
files included.

7) Install Antimalware/Antivirus Software:


It is true that there are free anti-malware programs out there, but as you might expect you get
what you pay for. Paid software means better programmers and greater safety.
Device Management
• Device management is the process
of managing the implementation,
operation and maintenance of a
physical and/or virtual device.
• 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.
• The device nodes in the /dev
directory provide access to the
corresponding kernel devices.
Performance Monitor
• Linux top command is a performance monitoring program which is used frequently by
many system administrators to monitor Linux performance and it is available under many
Linux/Unix like operating systems.
• The top command used to display all the running and active real-time processes in ordered
list and updates it regularly. It display CPU usage, Memory usage, Swap Memory, Cache
Size, Buffer Size, Process PID, User, Commands and much more. It also shows high memory
and CPU utilization of a running processes.
• The top command is much useful for system administrator to monitor and take correct
action when required.
• $ top
Top command
Task Scheduler
• Crontab files can be used to automate backups, system maintenance and other repetitive
tasks. The syntax is powerful and flexible, so you can have a task run every fifteen minutes
or at a specific minute on a specific day every year.
• First, open a terminal window from your Linux desktop’s applications menu. You can click
the Dash icon, type Terminal and press Enter to open one if you’re using Ubuntu.
• Use the crontab -e command to open your user account’s crontab file.
• $ crontab -e
Task Scheduler
• You may be asked to select an editor. Select Nano if it’s available by typing its number and
pressing Enter. Vi and other more advanced editors may be preferred by advanced users,
but Nano is an easy editor to get started with.
Task Scheduler
Thank You

Vijay Patil
Department of Computer Engineering (NBA Accredited)
Vidyalankar Polytechnic
Vidyalankar College Marg, Wadala(E), Mumbai 400 037
E-mail: [email protected] 43
Copy protected with Online-PDF-No-Copy.com 44

You might also like