0% found this document useful (0 votes)
24 views

Unit 02

OSY diploma unit 2 notes

Uploaded by

tanvi.kute30
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)
24 views

Unit 02

OSY diploma unit 2 notes

Uploaded by

tanvi.kute30
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/ 17

Operating System (22516) CM 5I Unit No.

Chapter No. 2 Services and components of Operating System


Marks 10

2.1 Different services of Operating-System


2.2 System Calls: concept, types of system calls
2.3 OS Component: Process Management, Main memory Management, File
Management, I/O System management, Secondary Storage Management
2.4 Use of Operating System tools: User Management, Security policy, Device
management, Performance monitor, Task scheduler
CO:
Use of OS tools to perform various functions.

References:
1. Operating System Concepts: Silberschatz, Abraham, Galvin, Peter B., Gagne,
Greg: 9780470128725: Amazon.com: Books.
2. Operating Systems: Internals and Design Principles” by William Stallings
3. Operating Systems: A Concept-Based Approach” by D M Dhamdhere

AVK 1
Operating System (22516) CM 5I Unit No. 2

2.1 Different services of Operating-System


An operating system provides an environment for the execution of programs. It provides
certain services to programs and to the users of those programs. The specific services
provided, of course, differ from one Operating system to another. These operating-system
services are provided for the convenience of the programmer, to make the programming
task easier.
Operating system services provides functions that are helpful for user as well as they
ensure the efficient operation of the system itself.
For User:
User interface. Almost all operating systems have a user interface (UI). This interface
can take several forms. One is a command-line interface (CLI), which uses text
commands and a method for entering them. Another is a batch interface, in which
commands and directives to control those commands are entered into files, and those
files are executed. Most commonly, a graphical user interface (GUI) is used. Here, the
interface is a window system with a pointing device to direct I/O, choose from menus,
and make selections and a keyboard to enter text. Some systems provide two or all three
of these variations.

Program execution. The system must be able to load a program into memory and to run
that program. The program must be able to end its 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. For efficiency and protection, users usually cannot control I/O devices directly.
Therefore, the operating system must provide a means to do I/O.

File-system manipulation. Programs need to read and write files and directories. They
also need to create and delete them by name, search for a given file, and list file
information. Some programs include permissions management to allow or deny access to
files or directories based on file ownership.
File system manipulation: - Programs may need to read and write data from and to the
files and directories. Operating system manages the secondary storage. User gives a
command for reading or writing to a file. Operating system makes it easier for user
programs to accomplish their task such as opening a file, saving a file and deleting a file

AVK 2
Operating System (22516) CM 5I Unit No. 2

from the storage disk. It also provides services for file permission management to allow
or deny access to files or directories based on file ownership

Communications Many time, one process needs to exchange information with another
process. Such communication may occur between processes that are executing on the
same computer or different computer systems tied together by a computer network.
Communications may be implemented via shared memory or message passing, in which
packets of information are moved between processes by the operating system.

Error detection. The operating system needs to be constantly aware of possible errors.
Errors may occur in the CPU and memory hardware (such as a memory error or a power
failure), in I/O devices and in the user program. For each type of error, the operating
system should take the appropriate action to ensure correct and consistent computing.
Debugging facilities can enhance the user's and programmer's abilities to use the system
efficiently.
For System view:
• Resource allocation. When there are multiple users or multiple jobs running at the
same time, resources must be allocated to each of them. Many different types of
resources are managed by the operating system. For instance, in determining how
best to use the CPU, operating systems have CPU-scheduling routines. There may
also be routines to allocate printers, modems, USB storage drives, and other
peripheral devices.
• Accounting. We want to keep track of which users use how much and what kinds of
computer resources. This record keeping may be used for accounting or simply for
accumulating usage statistics.
• Protection and security.
Protection involves ensuring that all access to system resources is controlled. Security of
the system from outsiders is also important. Such security starts with requiring each user
to authenticate himself or herself to the system, usually by means of a password, to gain
access to system resources.

AVK 3
Operating System (22516) CM 5I Unit No. 2

2.2 System Calls:


System call provide an interface to the services made available by an operating system.
Systems execute thousands of system calls per second. This system calls are procedures
written using C, C++ and assembly language instructions. Each operating system has its
own name for each system call.
1. Each system call associated with a particular number.
2. System call interface maintains a table indexed according to these numbers.
3. The system call interface invokes intended system call in operating system kernel and
returns status of the system call and any return values.
4. The caller needs to know nothing about how the system call is implemented. Just
needs to obey API(Application Programming Interface) and understand what OS will
do as a result call.
5. Most details of operating system interface hidden from programmers by API. It
ismanaged by run-time support library
Open() System Call : For most file systems, a program initializes access to a file in a
file system using the open system call. This allocates resources associated to the file (the
file descriptor), and returns a handle that the process will use to refer to that file.

AVK 4
Operating System (22516) CM 5I Unit No. 2

Types of System Calls


System calls can be grouped into five major categories: process control, file
manipulation, device manipulation, information maintenance, and
communications.

1. Process Control
o end, abort
o load, execute
o create process, terminate process
° get process attributes, set process attributes
o wait for time
° wait event, signal event
o allocate and free memory
A running program needs to be able to halt its execution either normally (end) or
abnormally (abort). If a system call is made to terminate the currently running program
abnormally, a dump of memory is taken and an error message generated. The dump is
written to disk and may be examined by a debugger, to determine the cause of the error.
Under either normal or ab +normal circumstances, the operating system must transfer
control to the command interpreter. The command interpreter then reads the next
command.
A process or job executing one program may want to load and execute another program.
This feature allows the command interpreter to execute a program as directed by, a user
thus, we have effectively created a mechanism for one program to call another program.
If both programs execute concurrently, we have created a new job or process to be
multiprogrammed. For this purpose, a system call exist like create process or submit
job.

If we create a new job or process, we should be able to control its execution. This
control requires the ability to determine and reset the attributes of a job or process,
including the job's priority, its maximum allowable execution time, and so on. For this
purpose, the system call get process attributes and set process attributes is used. If
..we want to terminate a job or process that we created, use terminate process system
call.

AVK 5
Operating System (22516) CM 5I Unit No. 2

After creating new jobs or processes, we may need to wait for them to finish their
execution. We may want to wait for a certain amount of time, use wait time system call;
If we want to wait for a specific event to occur, use wait event system call. The jobs or
processes should then signal when that event has occurred, use signal event system call.
2. File Management
o create file, delete file
o open, close
o read, write, reposition
° get file attributes, set file attributes
The following system calls are common when dealing with files. We first need system
calls, to create and delete files. System call requires the name of the file and its
attributes. Once the file is created, we need to open it and to use it. We may also read,
write, or reposition i.e. rewrite or skip to the end of the file. Finally, we need to close the
file.
We may need these same sets of operations for directories. In addition, for r files or
directories, we need to be able to determine the various attributes and to reset them if
necessary. File attributes include the file name, a file type, protection codes, accounting
information, and so on. For this function, the system calls are get file attribute and set
file attribute,
3. Device Management
o request device, release device
o read, write, reposition
o get device attributes, set device attributes
° logically attach or detach devices
A process may need several resources to execute—main memory, disk drives, access to
files, and so on. If the resources are available, they can be granted, and control can be
returned to the user process. Otherwise, the process will have to wait until sufficient
resources are available.

The various resources i.e. devices controlled by the operating system. Some of these
devices are physical devices (for example, tapes), or virtual devices (for example, files).
If there are multiple users of the system, the system may first request the device to use.

AVK 6
Operating System (22516) CM 5I Unit No. 2

After we are finished with the device, we release it. Once the device has been requested,
we can read, write, and reposition the device,
4. Information Maintenance:
get time or date, set time or date
get system data, set system data
set process, file, or device attributes
set process, file, or device attributes
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 its processes, and system
calls are used to access this information. Generally, calls are also used to reset the
process information (get process attributes and set process attributes).
5 Communication
° create, delete communication connection
o send, receive messages
o transfer status information
o attach or detach remote devices

There are two common models of interprocess communication: the message-passing


model and the shared-memory model.

In the message-passing model, the communicating processes exchange messages with


one another to transfer information. Messages can be exchanged between the processes
either directly or indirectly through a common mailbox. Before communication can take
place, a connection must be established. Each computer in a network has a host name by
which it is commonly known. A host also has a network identifier, such as an IP address.
Similarly, each process has a process name, and this name is translated into an identifier
by which the operating system can refer to the process. The get host id and get
processID system calls do this translation. These identifiers are then passed to the
specific open connection and close connection system calls. The recipient process must

AVK 7
Operating System (22516) CM 5I Unit No. 2

give its permission for communication with an accept connection system call. Most
processes that will be receiving connections execute a wait for connection system call.
Messages are exchanges between sources and receiving machines by using read message
and write message system calls. The close connection call terminates the
communication.

In the shared-memory model, processes use shared memory create and shared memory
attach system calls to create and gain access to regions of memory owned by other
processes. They can then exchange information by reading and writing data in the shared
areas. The form of the data and the location are determined by the processes and are not
under the operating system's control. The processes are also responsible for ensuring that
they are not writing to the same location simultaneously.
Message passing is useful when smaller amounts of data need to be exchanged because
conflicts needs be avoided. It is easy to implement than shared memory for
intercomputer communication. Shared memory allows maximum speed and convenience
of communication.
Components of operating system: The following are the system components.
1. Process Management
2. Main memory Management
3. File Management
4. I/O System management
5. Secondary Storage Management
Process Management: Process is current activity shown by a program counter. A
process can be a Program in execution. A process needs certain resources like CPU time,
memory, files and I/O devices to do its task. These resources are given to the process
when it is created or allocated to it when it is running. Process generally included a
process stack. The process is executed sequentially. The CPU executes instruction one
at a time. The operating system is responsible for the following activities in concern with
process management:
∑ Creating and deleting both user and system process
∑ Suspending and resuming processes
∑ Providing mechanism for process synchronization

AVK 8
Operating System (22516) CM 5I Unit No. 2

∑ Providing mechanisms for process communication


∑ Providing mechanisms for deadlock handling
Main memory Management: Main memory is a collection of quickly accessible data
shared by the CPU and I/O devices. The central processor reads instructions and data
from main memory during the fetch cycle. To improve both the utilization of the CPU
and the speed of the computer’s response to its users, we must keep several programs in
memory. Many different memory management schemes are available.
The operating system is responsible for the following activities:
∑ Keeping track of which parts of memory are currently being used and by
whom.
∑ Deciding which process are to be loaded into memory when memory space
becomes available.
∑ Allocating and defalcating memory space as need ed.
File Management: It is one of the most visible components of operating system.
Computers can store information on several different types of physical media, such as
magnetic tape, magnetic disk, optical disk etc. Each of these media has its own
characteristics and physical organization. Each media is controlled by a device such as a
disk drive and tape drive. They also has unique characteristics. These properties include
access speed, capacity, data transfer rate, and access method i.e. sequential or random.
For efficient and convenient use of computer system, the operating system provides a
uniform logical view of information storage. The operating system maps files onto
physical media and access these files via the storage devices.
A file is a collection of related information defined by its creator. Generally, file
represent programs and data, Data files may be alphabetic, numeric or alphanumeric. The
operating system implements the abstract concept of file by managing mass storage
media. Files are normally organized into directories for easy use.
The operating system is responsible for the following activities:
∑ Creating and deleting files
∑ Creating and deleting directories
∑ Supporting primitives for manipulating files and directories
∑ Mapping files onto secondary storage

AVK 9
Operating System (22516) CM 5I Unit No. 2

∑ Backing up files on movable storage media


I/O management: Operating system hides the peculiarities (odd behavior) of specific
hardware devices from the user. 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 consist of
∑ A memory management component that includes buffering, caching and spooling
∑ A general device driver interface
∑ Drivers for specific hardware device
I/O System: 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 use 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 o laser.
A device driver is a specific type of computer software that is developed to allow
interaction with hardware devices. Typically this continues an interface for
communicating with the I/O device, through the specific computer bus or communication
subsystem that the hardware is connected with. The device driver is a specialized
hardware dependent computer program that enables another program,
typically an operating system to interact transparently with a hardware device, and
usually provides the required interrupt handling necessary for the time dependent
hardware interfacing.
Providing interfaces to other system components.
∑ Managing devices
∑ Transferring data
∑ Detecting I/O completion
(spooling refers to a process of transferring data by placing it into a temporary working
area where another program may access it for processing by later time.)
Only the device drivers knows the peculiarities of the specific device to which it is
assigned.
Secondary storage management: The main purpose of computer system is to execute
programs. During execution, these programs with data, must be in main memory, but
these programs and data must backup on secondary storage from main memory. Because
main memory is too small to store all data and programs and also data that it holds are
AVK 10
Operating System (22516) CM 5I Unit No. 2

lost when power is lost. Most modern computers use disks, as a on-line storage media.
Hence proper management of disk storage is of central importance to a computer system.
The operating system is responsible for the following activities, in concern with
secondary storage management:
∑ Free space management
∑ Storage allocation
∑ Storage De - allocation
∑ Disk Scheduling
2.4 Use of Operating System tools
Following are the operating tools:
User Management
Security policy
Device Management
Performance Monitor
Task Scheduler
Linux Based :
A) User management:
User accounts provide interactive access to the system for users and groups of
users. And usually have limited access to critical system files and directories.
The following commands are available on majority of Unix systems to create and
manage user accounts:
useradd, userdel, usermod, passwds. These are mostly used by the
administrators.
/etc/passwd − Keeps the user account and password information. This file holds
the majority of information about accounts on the Unix system.
ß /etc/passwd – User account information.
ß /etc/shadow – Secure account information.
ß /etc/group – Group account information.
ß /etc/gshadow – Secure group account information.

Create an account:
Useradd: Adds accounts to the system.
Syntax: useradd -d homedir -g groupname -m -s shell -u userid accountname

AVK 11
Operating System (22516) CM 5I Unit No. 2

The following table lists out the parameters –

-d homedir
1
Specifies home directory for the account

-g groupname
2
Specifies a group account for this account

-m
3
Creates the home directory if it doesn't exist

-s shell
4
Specifies the default shell for this account

-u userid
5
You can specify a user id for this account

accountname
6
Actual account name to be created
7
-c
Adds comment to the user account

If you do not specify any parameter, then the system makes use of the default values.
The useradd command modifies the /etc/passwd, /etc/shadow, and /etc/group files and
creates a home directory.
Delete an Account
Userdel: To delete a user account userdel command is used.
There is only one argument or option available for the command .r, for removing the
account's home directory and mail file
Syntax: userdel -r <userName>
Modify an Account
Usermod: The command usermod is used to modify the properties of
an existing user. It uses the same arguments as the useradd command, plus the -l
argument, which allows you to change the account name.

AVK 12
Operating System (22516) CM 5I Unit No. 2

For example, to change the account name mcmohd to mcmohd20 and to change home
directory accordingly, you will need to issue the following command −
$ usermod -d /home/mcmohd20 -m -l mcmohd mcmohd20

Using passwd command


Passwd: A user can set the password with the command passwd. Old password has to be
typed twice before entering the new one.
Once an account is created you can set its password using the passwd command as
follows −
Syntax: passwd <userName>
$ passwd mcmohd20
Changing password for user mcmohd20.
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.

B) 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.
Example: ls –l /dev
Above example gives the list of device file from kernel.
Udev is a device manager in Linux, supplies a dynamic device directory containing only
the nodes for devices which are connected to the system. It creates or removes the device
node files in the /dev directory.
C) Performance Monitor:
It is very tough job for every system or network administrator to monitor and debug
Linux System Performance problems every day. The commands discussed below are
some of the most fundamental commands when it comes to system analysis and
debugging Linux server issues such as:
1) vmstat: Virtual memory statistics

AVK 13
Operating System (22516) CM 5I Unit No. 2

Linux VmStat command used to display statistics of virtual memory, kernerl


threads, disks, system processes, I/O blocks, interrupts, CPU activity and much
more.
$ vmstat
2)top: Linux Process Monitoring
top command display Linux processes. It provides a dynamic real-time view of a running
system i.e. actual process activity. By default, it displays the most CPU-intensive tasks
running on the server and updates the list every five seconds.
$ top
3) free: Show Linux server memory usage free command shows the total amount of free
and used physical and swap memory in the system, as well as the buffers used by the
kernel.
# free
4) iostat: Input/output Statistics - IoStat is simple tool that will collect and show
system input and output storage device statistics. This tool is often used to trace storage
device performance issues including devices, local disks, remote disks such as NFS.
# iostat
5) netstat :Network Statistics- Netstat is a command line tool for
monitoring incoming and outgoing network packets statistics as well as interface
statistics. It is very useful tool for every system administrator to monitor network
performance and troubleshoot network related problems.
netstat command displays network connections, routing tables, interface statistics,
masquerade connections, and multicast memberships.
# netstat -a | more

Windows Based System:s


Operating system is the mode in the computer that turns the machine to a user enabled
service. A brief knowhow of the OS tools makes the user easy and comfortable while
using it. Plus, he would know that he is not taking some wrong step and he would have
knowledge of what is going to happen next. Here are some of the overview that how the
operating systems actually work;

AVK 14
Operating System (22516) CM 5I Unit No. 2

Computer management option can be found within the control panel of any computer
system. One may go to the control panel from the start menu. Within the control panel
there is Administrative tool. One of the administrative tools is computer management. On
the computer management window, one may find there are three panes. The left pane will
show some functions, and when one chooses a function from the left pane, the details of
the pane will be available at the pane at the centre, where as the right section will show
the series of action that can be taken. There is Task Scheduler within the system tools,
and even the windows event viewer can be also accessed from the computer management
list. One can also start defragmentation of the disk and disk spaces from here. And in the
performance sector, one can see how the system is performing and that can be observed
for a long period also.

User Management
Users and groups
One can easily go to the Users and groups pane from the tools. He or she has to go to the
control panel and there one they may find the tab, 'user accounts'. There is a User account
can be created and the profile picture or password can be managed easily. One can even
have numerous user accounts enabled to operate at different mode in the computer. Even
one can be given an access to the computer by making the guest account enabled in a
password protected computer. One user cannot see or access the files or settings of
another user until he or she is set as administrator. One administrator alone can have the

AVK 15
Operating System (22516) CM 5I Unit No. 2

access to view or manage all other user's details. There is yet another option in Users and
groups to function at the same time. The option is the group profile, where there will be a
group id and a group password, which can be accessed by the entire group.
Security policy
This is a feature for large corporate sector and is in the ultimate version of the Windows
Operating System. This feature will not be seen in the home computers. One can find the
local security under the Administrative tools, which one may get access from the control
panel. This option allows the administrator to provide access or deny access to some
users to some drive or software on those drives. Thus the changes in those software or
drives will not be possible for them, whom the access to change or configure it is given
by the administrator. By this end user policy, one administrator can allow or disallow any
user on those computers to get an access over few websites or not. By these the users can
also be restricted to surf freely at their workplace as most of the irrelevant website;
basically the irrelevant websites to the job will not be opened from there.
Device management
When an external hardware is connected to the computer, then the device will be shown
at the Device manager tray or administrative window. The hardware may be of various
types, like the printers, the USB ported devices like pen drive, a Tablet or a mobile, a
Mouse and a Keyboard or even a camera. Most of the time the computer detects the
driver of the device and installation of the driver is done instantly and automatically.
However, there are many devices which are to be installed separately, like the modems or
a networking device. And sometimes the device is to be added manually, from the add
device option in the device manager tool. Once the device is shown at the device manager
window, then the device can be configured or even troubleshooting of the device is also
applicable. One can go to the device manager pane from the tools directly or even can go
there via the control panel. At the category view in the control panel, one can find three
options to go to the Device manager window. The options are 'view devices and printers',
'add a device' and 'adjust commonly used mobility setting’'.
Performance monitor
It is the option to actually monitor how the CPU is performing. One can go there from the
control panel or another easy way to reach there is by pressing sticky keys on the key
boards. One can press Ctrl, Alt and Del at the same time, to find the option of Start Task

AVK 16
Operating System (22516) CM 5I Unit No. 2

Manager. User can go to the fourth tab under performance and there they can find two
graphs. One is showing the CPU Usage and the other showing Memory. One may find
that all the data are changing there randomly, which implicit the fact that those are the
live records of the usage and memory. One may find there in the small window a button
called Resource Monitor. By clicking there, a new larger window will open where there
will be four continuously running meters. The meters are of the CPU, Memory, Network
and Disk. Thus all the records are placed in front one's eye and thus making the
performance monitoring easy.

Task scheduler
Windows can perform a task at a scheduled time and scheduled date. Not only one time
does it work, but windows can do a particular task scheduled every day at a particular
time or at particular interval. One can find the task scheduler by going to the tools. From
tools, one has to go to the control panel. From control panel, he or she has to go to
administrative tools to find the task scheduler. In windows 7, windows vista or windows
8, one may find the task scheduler in an updated version. Thus it makes the windows user
equipped with the best scheduler and that also without the support of any other software.

AVK 17

You might also like