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

Osy Unit 2

The document discusses system calls and provides examples. It begins by defining system calls as routines that provide an interface to operating system services. It then gives an example of a simple file copying program to illustrate how various system calls would be used, such as calls to open files, read/write files, close files, and display messages. The document notes that even simple programs make heavy use of system calls, with systems executing thousands per second. It concludes by mentioning some common application programming interfaces (APIs) that abstract system calls for programmers.

Uploaded by

Tarun Jadhav
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)
55 views

Osy Unit 2

The document discusses system calls and provides examples. It begins by defining system calls as routines that provide an interface to operating system services. It then gives an example of a simple file copying program to illustrate how various system calls would be used, such as calls to open files, read/write files, close files, and display messages. The document notes that even simple programs make heavy use of system calls, with systems executing thousands per second. It concludes by mentioning some common application programming interfaces (APIs) that abstract system calls for programmers.

Uploaded by

Tarun Jadhav
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/ 16

Operating System: Unit Two

Unit-II Services and Components of Operating System [10 Marks]


Introduction of system call:
System calls provide an interface to the services made available by an operating system. These calls
are generally available as routines written in C and C++, although certain low-level tasks may have to be
written using assembly-language instructions.
Here is an example to illustrate how system calls are used: writing a simple program to read data from
one file and copy them to another file. The first input that the program will need is the names of the two files:
the input file and the output file. These names can be specified in many ways, depending on the operating-
system design. One approach is for the program to ask the user for the names. In an interactive system, this
approach will require a sequence of system calls, first to write a prompting message on the screen and then to
read from the keyboard the characters that define the two files. On mouse-based and icon-based systems, a
menu of file names is usually displayed in a window. The user can then use the mouse to select the source
name, and a window can be opened for the destination name to be specified. This sequence requires many I/O
system calls.

Once the two file names have been obtained, the program must open the input file and create the
output file. Each of these operations requires another system call. Possible error conditions for each operation
can require additional system calls. When the program tries to open the input file, for example, it may find that
there is no file of that name or that the file is protected against access. In these cases, the program should print
a message on the console (another sequence of system calls) and then terminate abnormally (another system
call).
If the input file exists, then we must create a new output file.We may find thatthere is already an
output file with the same name. This situation may causethe program to abort (a system call), or we may delete
the existing file (anothersystem call) and create a new one (yet another system call). Another option,in an
interactive system, is to ask the user (via a sequence of system calls tooutput the prompting message and to
read the response from the terminal)whether to replace the existing file or to abort the program.When both files
are set up, we enter a loop that reads from the input file(a system call) and writes to the output file (another
system call). Each readand write must return status information regarding various possible errorconditions. On
input, the program may find that the end of the file has beenreached or that there was a hardware failure in the
read (such as a parity error).The write operation may encounter various errors; depending on the outputdevice
(for example, no more disk space).
Finally, after the entire file is copied, the program may close both files(another system call), write a
message to the console or window (more systemcalls), and finally terminate normally (the final system call).
This system-call sequence is shown in Figure.As you can see, even simple programs may make heavy use of

Mrs. Meenakshi P. Patil Page 1


Operating System: Unit Two
theoperating system. Frequently, systems execute thousands of system callsper second. Most programmers
never see this level of detail, however.Typically, application developers design programs according to an
applicationprogramming interface (API). The API specifies a set of functions that areavailable to an
application programmer, including the parameters that arepassed to each function and the return values the
programmer can expect.
Three of the most common APIs available to application programmers aretheWindows API
forWindows systems, the POSIX API for POSIX-based systems(which include virtually all versions of UNIX,
Linux, andMac OSX), and the JavaAPI for programs that run on the Java virtual machine.

Q1. State any four types of system call provided by an operating system.
Ans: System calls related to Process Control: End, Abort Load, Execute, Create process,
Terminate process, Ready process, Dispatch process, Suspend, Resume, Get Process attribute,
set attribute, Wait for time, Wait event, signal event.
System calls Related to File Management: Create file, delete file Open file , Close file Create
directory Read, Write, Reposition Get file attribute , set file attribute, Create a link, Change the
working directory.
System calls Related to Device Management: Request a device, Release a device Read, Write,
Reposition, Get device attribute, Set device attribute
System calls Related to Information Maintenance: 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.
System calls Related to Communication: create,delete communication connection send,
receive messages, transfer status information, attach or detach remote devices

Q2. Write use of following system calls.


1) fork( )
2) exec( )
3) abort( )
4) end( )
Ans:
1. fork( ) This system call is used to create a new process.
2. exec( ) This system call is used to replace the process’s memory space with a new program. It
loads a binary file into memory and starts its execution.
3. abort( ) This system call is used to halt process execution abnormally.
4. end( ) This system call is used to halt process execution normally.

Q3. What is system call? With the help of diagram explain open ( ) system call.
Ans: System Calls: System calls are programming interface to the services provided by the
operating system
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 and understand what OS will do as a result call.
5. Most details of operating system interface hidden from programmers by API. It is managed by
run-time support library.

Mrs. Meenakshi P. Patil Page 2


Operating System: Unit Two

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.

Q4. List types of system call and explain the system call – “Information Maintenance”.
Ans: Types of System calls are as follows:
1. Process or Job control
2. File Management
3. Device Management
4. Information Maintenance
5. Communications
Information Maintenance:
The operating system keeps information about all its processes and provides system calls to
access this information. Some system calls exist purely for transferring information between the
user program and the operating system. 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.
System calls Related to Information Maintenance:
 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.

Q5. Explain execution of system call with diagram


Ans: System call is an interface between a running program and operating system.It allows user
to access services provided by operating system. This system callsare procedures written using
C, C++ and assembly language instructions. Eachoperating 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 thesenumbers.
Mrs. Meenakshi P. Patil Page 3
Operating System: Unit Two

3. The system call interface invokes intended system call in operatingsystem kernel and returns
status of the system call and any returnvalues.
4. The caller needs to know nothing about how the system call isimplemented. Just needs to obey
API and understand what OS will doas a result call.
5. Most details of operating system interface hidden from programmersby API. It is managed by
run-time support library.

Open ( ) system call for most file systems, a program initializes access to a filein a file system
using the open system call. This allocates resources associatedto the file (the file descriptor), and
returns a handle that the process will use torefer to that file.

Q6. What is system call? Enlist any four system calls related with process management.
Ans: System call is an interface between a running program and operating system. It allows
userto access services provided by operating system. This system calls are procedures
writtenusing C, C++ and assembly language instructions. Each operating system has its own
namefor each system call. Each system call is associated with a number that identifies itself.
System calls related with process management:
 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.

Q7. What is system call?


System call is an interface between a running program and operating system. It allows user
toaccess services provided by operating system. This system calls are procedures written using
C,C++ and assembly language instructions. Each operating system has its own name for
eachsystem call. Each system call is associated with a number that identifies itself.

Mrs. Meenakshi P. Patil Page 4


Operating System: Unit Two

Q8. Explain any four file related system calls.


Ans: System calls Related to File management:
 Create file: This system call is used to create a new file in any application.
 Delete file: This system call is used to delete a specific file from the given directory.
 Open file: This system call is used to open an existing file.
 Close file: This system call is used to close an already opened file.
 Read file: This system call is used to read a file which is already opened. By using this
system call anyinformation which is desired can be read from the file.
 Write file: This system call is used to write some data to a file.
 Reposition file: It means to change the position of a file pointer within the file. If there
are many numbersof pages in a file then we can move forward or backward to any
position within that file.
 Get file attribute: A file has certain attributes like file_name, file_type, file_size, date of
creation, modification, access permission etc. By using this system call we can check any
of the attributes of aparticular file.
 Set file attribute: With the help of this system call, any of the attributes which can be
modified orchanged can be “SET”.

Q9. List any four services provided by OS and explain any two of them. OR
Explain any six services of Operating System. Draw diagram of services of OS
Ans.
1. User interface
2. Program execution
3. I/O operations
4. File-system manipulation
5. Communications
6. Error detection
7. Resource allocation
8. Accounting
9. Protection and security

OS services provided to the user:-


1. User Interface: - All operating systems have a user interface that allows users
toCommunicate with the system.
Three types of user interfaces are available:-
a. Command line interface (CLI): - It uses text commands and a method for enteringthem. For
example working on DOS prompt.
b. Batch interface: - Commands and directives to control that commands, are enteredinto a file
and the file is executed. For example, Combining set of C programmingstatements into a file to
perform a specific task and executing that file in TURBOC.
c. Graphical user interface (GUI): - This interface is a window system with a pointingdevice to
direct I/O, select from menus and make selections and keyboard to enterthe text. For example,
Windows system provides icons for selecting an application.Double clicking on that icon will
open that application.
Some system provides to or all three of these variations.

Mrs. Meenakshi P. Patil Page 5


Operating System: Unit Two

2. Program execution: - The operating system provides an environment where the usercan
conveniently run programs. To run a program, the program is loaded into the mainmemory and
then CPU is assigned to that process for its execution. Operating systemperforms this function
for the convenience of the user. It also performs other importanttasks like allocation and de-
allocation of memory, CPU scheduling etc. It alsoprovides service to end process execution
either normally or abnormally by indicatingerror.

3. I/O operations: - When a program is running, it may require input/output resourcessuch as a


file or devices such as printer. For specific devices, special functions may berequired such as
recording to a CD drive. For efficiency and protection users usuallycannot control I/O devices
directly. So the operating system provides a service to doI/O.

4. File system manipulation: - Programs may need to read and write data from and tothe files
and directories. Operating system manages the secondary storage. User givesa command for
reading or writing to a file. Operating system makes it easier for userprograms to accomplish
their task such as opening a file, saving a file and deleting afile from the storage disk. It also
provides services for file permission management toallow or deny access to files or directories
based on file ownership.

5. Communication: - In the system, one process may need to exchange information withanother
process. Such communication may occur between processes that are executingon different
computer systems tied together by a computer network. Communicationcan be implemented via
shared memory or through message passing, in which packetsof information are moved between
processes by the operating system.

6. Error detection: -The operating system needs to be constantly aware of possibleerrors.


Errors can occur in:
a) CPU and memory hardware such as a memory error or power failure
b) I/O devices such as parity error on tape, a connection failure on a network or lackof paper in
the printer.
c) The user program such as an arithmetic overflow, an attempt to access an illegalmemory
location or a too-great use of CPU time.
For each type of error, the operating system should take the appropriate action toensure correct
and consistent computing. Debugging facilities can greatly enhance theuser’s and programmer’s
abilities to use the system efficiently.

7. Resource allocation: - When there are multiple users or multiple processes running at the
same time, resources must be allocated to each of them. Operating system manages resource
allocation to the processes. These resources are CPU, main memory, file storage and I/O devices.
For maximizing use of CPU, operating system does CPU scheduling. Operating system contains
routines to allocate printers, modems, USB storage drives and other peripheral devices.
8. Accounting: - Operating system keeps track of usages of various computer resourcesallocated
to users. This accounting is used for reconfiguration of system to improvecomputing services.

9. Protection & security:-Owners of information stored in a multiuser or networkedcomputer


system want to control use of that information. When several separateprocesses execute
Mrs. Meenakshi P. Patil Page 6
Operating System: Unit Two

concurrently, one process should not interfere with the otherprocesses or operating system itself.
Protection provides controlled access tosystem resources. Security is provided by user
authentication such as password foraccessing information.

Diagram of services of OS

Q10. Describe activities of I/O system and secondary storage management.


Ans.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 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. 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.
Activities:
 Providing interfaces to other system components.
 Managing devices
 Transferring data
 Detecting I/O completion

Mrs. Meenakshi P. Patil Page 7


Operating System: Unit Two

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 modern
computer systems use disks as the principal on-line storage medium for programs and data. 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.
Activities:
 Free space management
 Storage allocation
 Storage de-allocation
 Disk scheduling.

To read a piece of data that is stored at the end of the file, one has to read all of the data that
comes before it-you cannot jump directly to the desired data. This is similar to the way cassette
tape players work. If one wants to listen to the last song on a cassette tape, he has to either fast-
forward over all of the songs that come before it or listen to them. There is no way to jump
directly to a specific song.

Q11. Explain following two services of operating systems.


(i) File system manipulation
(ii) Resource Allocation

Ans:
File system manipulation: While working on the computer, generally a user performs various
types of operations on files like creating a file, opening a file, saving a file, deleting a file, search
for a file with file name from the storage disk, etc. Programs need to read a file or write a files
and directories. The operating system gives the permission to program for performing operations
on file. Maintain details of files or directories with their respective details. Some programs
include permissions management that allow or deny access to files or directories based on file
ownership.

Resource allocation: When multiple users or multiple jobs are running at the same time, it is the
responsibility of an operating system to allocate the required resources to each process.
Operating system manages many different types of resources such as CPU, main memory, tape
drive or secondary storage etc. For this purpose, various types of algorithms are implemented
such as process scheduling, CPU scheduling, disk scheduling etc. There are some routines that
allocate printers, modems, USB storage drives and other peripheral devices.

Q12. Explain major activities of memory management component of an operating system.


Ans. 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

Mrs. Meenakshi P. Patil Page 8


Operating System: Unit Two

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.
For a program to be executed, it must be mapped to absolute addresses and loaded into memory.
As the program executes, it accesses program instructions and data from memory by generating
these absolute addresses.
To improve both the utilization of the CPU and the speed of the computer’s response to its users,
operating system keeps several programs in memory. To handle memory with multiple programs
memory management is necessary.
Activities of memory management.
1) Keeping track of which part of memory are currently being used and by whom.
2) Deciding which processes and data to move into and out of memory.
3) Allocating & Deallocating space as needed.

Q13. Explain different activities of I/O system management components of OS


Ans.I/O System: Input / Output device management provides an environment forthe better
interaction between system and the I / O devices such as printers,scanners, and tape drives etc.
To interact with I/O devices in an effective manner,the operating system uses some special
programs known as device driver. Thedevice drivers take the data that operating system has
defined as a file andthen translate them into streams of bits or a series of laser. A device driver is
aspecific type of computer software that is developed to allow interaction withhardware devices.
Typically this continues an interface for communicating withthe I/O device, through the specific
computer bus or communicationsubsystem that the hardware is connected with. The device
driver is aspecialized hardware dependent computer program that enables anotherprogram,
typically an operating system to interact transparently with ahardware device, and usually
provides the required interrupt handlingnecessary for the time dependent hardware interfacing.
Activities:
 Providing interfaces to other system components.
 Managing devices
 Transferring data
 Detecting I/O completion

Q14. Explain main memory Management components of OS with its activities


Ans.
 Main-Memory is a large array of words or bytes.
 Each word or byte has its own address.
 Main memory provides storage that can be access directly by the CPU.
 That is to say for a program to be executed, it must in the mainmemory.

The major activities of an operating in regard to memory-management are:


 Keep track of which part of memory is currently being used and bywhom.
 Decide which processes are loaded into memory when memory spacebecomes available.
 Allocate memory space as needed deallocate memory space as needed

Mrs. Meenakshi P. Patil Page 9


Operating System: Unit Two

Q15. Enlist system components. Describe any two in detail.


Ans. List of System Components:
1. Process management
2. Main memory management
3. File management
4. I/O system management
5. Secondary storage management

1. Process Management
The operating system manages many kinds of activities ranging from user programs tosystem
programs like printer spooler, name servers, file server etc. Each of these activitiesis
encapsulated in a process. A process includes the complete execution context (code,data, PC,
registers, OS resources in use etc.). The basic unit of software that the operatingsystem deals
with in scheduling the work done by the processor is either a process or athread, depending on
the operating system. It’s tempting to think of a process as anapplication, but that gives an
incomplete picture of how processes relate to the operating system and hardware. The
application you see (word processor or spreadsheet or game) is,indeed, a process, but that
application may cause several other processes to begin, for taskslike communications with other
devices or other computers. There are also numerousprocesses that run without giving you direct
evidence that they ever exist. A process, then,is software that performs some action and can be
controlled by a user, by other applicationsor by the operating system. It is processes, rather than
applications, that the operatingsystem controls and schedules for execution by the CPU. In a
single-tasking system, theschedule is straightforward. The operating system allows the
application to begin running,suspending the execution only long enough to deal with interrupts
and user input.
The five major activities of an operating system in regard to process management are
1. Creation and deletion of user and system processes.
2. Suspension and resumption of processes.
3. A mechanism for process synchronization.
4. A mechanism for process communication.
5. A mechanism for deadlock handling.

2. Main-Memory Management
Services provided under Memory Management are directed to keeping track of memoryand
allocating/de allocating it to various processes. The OS keeps a list of free memorylocations.
Before a program is loaded in the memory from the disk, this MM consults thefree list, allocates
the memory to the process, depending upon the program size andupdates the list of free memory.
Primary-Memory or Main-Memory is a large array ofwords or bytes. Each word or byte has its
own address. Main-memory provides storagethat can be access directly by the CPU. That is to
say for a program to be executed, it mustin the main memory.
The major activities of an operating in regard to memory-management are:
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.

Mrs. Meenakshi P. Patil Page 10


Operating System: Unit Two

3. File Management
A file is a collected of related information defined by its creator. Computer can store fileson the
disk (secondary storage), which provide long term storage. Some examples ofstorage media are
magnetic tape, magnetic disk and optical disk. Each of these media hasits own properties like
speed, capacity, and data transfer rate and access methods. A filesystem normally organized into
directories to ease their use. These directories may containfiles and other directions.
The five main major activities of an operating system in regard to file managementare:
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 interactionbetween
system and the I / O devices. To interact with I/O devices in an effective manner,the operating
system uses some special programs known as device driver. The devicedrivers take the data that
operating system has defined as a file and then translate them intostreams of bits or a series of
laser pulses. The device driver is a specialized hardwaredependent computer program that
enables another program, typically an operating systemto interact transparently with a hardware
device, and usually provides the required interrupthandling necessary for the time dependent
hardware interfacing.
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

5. Secondary-Storage Management
Systems have several levels of storage, including primary storage, secondary storage andcache
storage. Instructions and data must be placed in primary storage or cache to bereferenced by a
running program. Because main memory is too small to accommodate alldata and programs, and
its data are lost when power is lost, the computer system mustprovide secondary storage to back
up main memory. Secondary storage consists of tapes,disks, and other media designed to hold
information that will eventually be accessed inprimary storage (primary, secondary, cache) is
ordinarily divided into bytes or wordsconsisting of a fixed number of bytes. Each location in
storage has an address; the set of alladdresses available to a program is called an address space.
The three major activities of an operating system in regard to secondary storage
management are:
1. Managing the free space available on the secondary-storage device
2. Allocation of storage space when new files have to be written.
3. Scheduling the requests for memory access.

Mrs. Meenakshi P. Patil Page 11


Operating System: Unit Two

Q16. Explain secondary Storage Management


Ans.
 Systems have several levels of storage, including primary storage, secondary storage and
cachestorage.
 Instructions and data must be placed in primary storage or cache to be referenced by a
runningprogram. Because main memory is too small to accommodate all data and
programs, and its data are lost when power is lost, the computer system must provide
secondary storage to back up mainmemory.
 Secondary storage consists of tapes, disks, and other media designed to hold information
that willeventually be accessed in primary storage (primary, secondary, cache) is
ordinarily divided intobytes 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 anaddress space.
Activities of an operating system in regard to secondary storage management are:
 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.

Q17. Explain how parameter passing is done while implementing system calls.
Ans:Three general methods are used to pass parameters to the operating system.
The simplest approach is to pass the parameters in registers. In some cases, however, there may be more
parameters than registers. In these cases, the parameters are generally stored in a block, or table, in memory,
and the address of the block is passed as a parameter in a register (as shown in the Figure). This is the approach
taken by Linux and Solaris. Parameters also can be placed, or pushed, onto the stack by the program and
popped off the stack by the operating system. Some operating systems prefer the block or stack method
because those approaches do not limit the number or length of parameters being passed.

Mrs. Meenakshi P. Patil Page 12


Operating System: Unit Two

Q18. Describe Operating System tools. OR What are the system tools used in Linux?
Explain. OR Write a note on use of operating system tools.
Ans: Operating system tools are special system programs that are used to manage the overall
functions of an operating system.
These tools are used for following purposes:
Memory management, processor management, device management, file management, security,
control over system performance, job accounting, error detecting aids, coordination between
users & other software.
Some of the tools are discussed below:
1. 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. User management includes
everything from creating a user to deleting a user from system.
There are 3 types of accounts present in Unix operating system.
1. Root: This account belongs to system administrator. This is also called as superuser.
Superuser has permission to run any command.
2. System Accounts: This account is required for system related components. For example,
email&sshd accounts.
3. User Accounts: These accounts belong to users & group of users. General users have
these accounts & these users have limited access to the system files & directories.
Following are four user administration files:
 /etc/passwd : This file holds information about user account & password.
 /etc/shadow: This file keeps encrypted password of corresponding account.
 /etc/group: his file holds group information for each user account.
 /etc/gshadow: It contains secure group account information.

Following commands are used to create & manage user, group accout:
 Useradd: To add user account to the system.
 Usermod: To modify accounts attributes.
 Userdel: To delete user account from the system.
 groupadd: To add groups to the system.
 groupmod: To modify group attributes.
 groupdel:To remove groups from the system.

2. Security Policy:
OS security policy helps in protecting systems from various threats to the systems like malware,
spyware, ransom ware, viruses, worms, backdoor intrusions, & many more. Security policies
provide all possible preventatives measures & techniques to keep operating system safe. It also
protects OS from activities like data theft, unwanted modifications to data, deletion of data etc.

Mrs. Meenakshi P. Patil Page 13


Operating System: Unit Two

There are wide operations performed by OS security policies. Some of the major areas are listed
below:
 System updating or patching system regularly.
 Software installation or updation of various antiviruses.
 Firewall installation & management of upcoming & outgoing traffic on networks.
 Provide security to user account.
 Deciding what kind of data, users & hardware is vital in the system.
Although there are already a lot of good security features built into Linux-based system, one very
important potential weakness can exist when local access granted i.e. file permission based
issues resulting from a user not assigning the correct permissions to files & directories. So based
upon the need for proper permissions, it is categorized as below:
1. Permission Groups:
Each file & directory has three user based permission groups:
i) owner ⁄user: The owner ⁄user permissions apply only to the file or directory, they will
not impact the actions of the other users.
ii) group: The group permissions are apply on the group that has been assigned to the
file or directory, they will not affect the actions of other users.
iii) all users: The all users permissions apply to all other users on the system, this is the
permission group that you need to watch the most.
2. Permission Types:
Each file or directory has three basic permission types:
i) read: The read permission refers to a user’s capability to read the contents of the file.
ii) write: The write permission refers to a user’s capability to write or modify the file or
directory.
iii) execute: The execute permission affects to a user’s capability to execute a file or
view the contents of a directory.
3. Viewing the permissions:
You can view the permissions in your favorite GUI File Manager or by reviewing the
output of the “ls –l” command while in the terminal & while working in the directory
which contains the file or folder.
The permission in the command line is displayed as _rwxrwxrwx 1 owner:group

4. Modifying the Permissions:


When in the command line, the permissions are edited by using the command chmod.
You can assign the permissions explicitly or by using a binary reference as described
below:
Chmod [options] mode [,mode] file1[fie2…]

Mrs. Meenakshi P. Patil Page 14


Operating System: Unit Two

Numerical Permissions
# Permissions Binary rwx Octal rwx
7 Read, write & execute 111 7
6 Read & write 110 6
5 Read & execute 101 5
4 Read only 100 4
3 Write & execute 011 3
2 Write only 010 2
1 Execute only 001 1
0 None 000 0

3. Device Management:

Device management is the process of managing the implementation, operation & 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 (/) file system 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. With udev, the /dev directory reflects the current state of the
kernel. Every kernel device has one corresponding device file. If a device is disconnected from
the system, the device node is removed.

4. Performance Monitor:
It is really very tough job for every system or network administrator to monitor & debug Linux
system performance problems every day. There are some command line monitoring tools that
might be useful for every Linux system administrator. These commands are available under all
flavors of Linux & can be useful to monitor & find the actual causes of performance problem.
top command:
 Linux top command is a performance monitoring program which is used frequently by
many system administrators to monitor Linux performance & it is available under many
Linux like operating systems.
 The top command used to display all the running & active real time processes in ordered
list & updates it regularly. It display CPU usage, memory usage, swap memory, cache
size, buffer size, process PID, user commands & many more. It also shows high memory
& CPU utilization of running processes.
 The top command is much useful for system administrator to monitor & take correct
action when required.
 Syntax of top command
$root: - top

Mrs. Meenakshi P. Patil Page 15


Operating System: Unit Two

vmstat command:
 Linux vmstat command used to display statistics of virtual memory, kernel threads, disks,
system processes, I⁄ O blocks, interrupts, CPU activity & much more. By default vmstat
command is not available under Linux system; you need to install a package called
sysstat that includes vmstat program.
 Syntax of vmstat command
$root: - vmstat [options] [delay [count]]

5. Task Scheduler:
 Task scheduler can be called CPU scheduler. Throughout the lifetime process it migrates
or travels to the various scheduling queues. An OS should select processes for scheduling
purposes from these queues in some manner or style. The selection procedure is done by
schedulers.
 In batch system there can be many processes which can be executed immediately. In
batch systems if processes are more than they are spooled to the mass storage devices like
disks in which they are kept for the later execution.
 The scheduler which picks up jobs from this spool & loads into main memory for
execution is called as long term scheduler or job scheduler.
 There is another scheduler which selects the jobs or processes which are ready to execute
from this spool & allocates the CPU to one of them is called short term scheduler or CPU
scheduler.

Mrs. Meenakshi P. Patil Page 16

You might also like