1 & Gramin College of Engineering(GRACE) Vishnupuri ,Nanded. Syllabus Total Marks:10 M 2.1Different Services of Operating System. 2.2System Calls- Concept and its types 2.3OS Components: – Process Management, Main Memory Management, File Management, I/O System management, Secondary storage management. 2.4Use of operating system tools: user management, security policy, device management, performance monitor, task scheduler. GSPM’s Gramin Polytechnic Vishnupuri , Nanded. & Gramin College of Engineering(GRACE) Vishnupuri ,Nanded. 2.1 Different Services of Operating System Following are the major services provided by operating system for efficient execution of users application and to make convenience. 1. User Interface 2. Program Execution 3. I/O Operation 4. File System Manipulation 5. Communications 6. Error Detection 7. Resource Allocation 8. Accounting 9. Protection & Security
GSPM’s Gramin Polytechnic Vishnupuri , Nanded.
& Gramin College of Engineering(GRACE) Vishnupuri ,Nanded. 3 2.1.1User Interface • User interface is a medium through which user actually interacts with the computer system via operating system. Almost all operating system have a user interface(UI). • User interfaces are categorized into three types as follows: a) CLI: Command Line Interface, provides an environment where user can write their commands in text format on command prompts. b) Batch Interface: It allows a command environment which gets execute one by one or sequentially. • User creates a batch file which contains multiple executable commands in a sequence. This batch file is executed to execute the set of commands included in it.
GSPM’s Gramin Polytechnic Vishnupuri , Nanded.
& Gramin College of Engineering(GRACE) Vishnupuri ,Nanded. 4 Contd…
c) GUI: Graphical User Interface. Most of the operating
systems provide graphical interfaces which have tools like pointing devices which directs the input/output operations with the help of graphical control like menu.
GSPM’s Gramin Polytechnic Vishnupuri , Nanded.
& Gramin College of Engineering(GRACE) Vishnupuri ,Nanded. 5 2. 1.2 Program Execution • The purpose of computer systems is allow the user to execute program. • So OS provide an environment where the user can conveniently run programs. • The user does not have to worry about the memory allocation or multitasking. • Memory allocation and de-allocation, processor allocation and scheduling, multitasking etc functions are performed by OS. • The operating system has all rights of resource management. User program does not given these rights.
GSPM’s Gramin Polytechnic Vishnupuri , Nanded. 6
& Gramin College of Engineering(GRACE) Vishnupuri ,Nanded. 2.1.3 I/O Operation • Each program requires an input and produce output. This involves the us of I/O device or files. • User can run their programs conveniently because they are not aware about the I/O system of OS. • For better efficiency and protection, the users are not allowed to directly interact with I/O devices. • So operating system here becomes the bridge between I/O devices and user. • OS makes I/O devices available to user in a user friendly manner whenever required by users.
GSPM’s Gramin Polytechnic Vishnupuri , Nanded.
& Gramin College of Engineering(GRACE) Vishnupuri ,Nanded. 7 2.1.4 File System Manipulation – The output of a program may need to be written into new files or can be given as input to other files. – User gives a command for reading or writing to a file and see his task accomplished. Thus operating systems make it easier for user programs to accomplish their task. – OS even handled the issues related to the different permissions like read, write, execute and even access deny depending on the ownership of the file. – It also involves creating, deleting or even searching of the files by its name. It is done by OS.
GSPM’s Gramin Polytechnic Vishnupuri , Nanded.
& Gramin College of Engineering(GRACE) Vishnupuri ,Nanded. 8 2.1.5 Communications
• Communications– exchange of information between
processes executing either on the same computer or on different systems tied together by a network. Implemented via shared memory or message passing. • The user program may be developed as per the specifics of the hardware through which the massage transits and provides the service interface to the OS.
GSPM’s Gramin Polytechnic Vishnupuri , Nanded.
& Gramin College of Engineering(GRACE) Vishnupuri ,Nanded. 9 2.1.6 Error detection • Error detection – ensure correct computing by detecting errors in the CPU and memory hardware, in I/O devices, or in user programs. • To avoid such a situation the OS constantly monitors the system for detecting the errors. • These tasks are to critical to be handed over to the user programs. A user program may interfere with the normal operation of the OS if they are allowed to control errors.
GSPM’s Gramin Polytechnic Vishnupuri , Nanded.
& Gramin College of Engineering(GRACE) Vishnupuri ,Nanded. 10 2.1.7 Resource allocation • allocating resources to multiple users or multiple jobs running at the same time. • When multiple users or multiple jobs running concurrently, resources must be allocated to each of them. • Many types of resources such as CPU cycles, main memory, and file storage etc may have special allocation code, others (such as I/O devices) may have general request and release code.
GSPM’s Gramin Polytechnic Vishnupuri , Nanded.
& Gramin College of Engineering(GRACE) Vishnupuri ,Nanded. 11 2.1.8 Accounting
– keep track of and record which users use how much
and what kinds of computer resources for account billing or for accumulating usage statistics. • It is even useful for the researchers to find out the usage and the requirements to reconfigure the system.
GSPM’s Gramin Polytechnic Vishnupuri , Nanded.
& Gramin College of Engineering(GRACE) Vishnupuri ,Nanded. 12 2.1.9 Protection and Security Protection-Ensuring that all access to system resources is controlled. Security-of the system from unwanted users requires user authentication . The defending of external I/O devices from invalid access is important.
GSPM’s Gramin Polytechnic Vishnupuri , Nanded.
& Gramin College of Engineering(GRACE) Vishnupuri ,Nanded. 13 2.2 System Calls • System calls provide the interface between a running program and the operating system. • System calls are mediator between OS and process. • System programs provide basic functioning to users so that they do not need to write their own environment for program development E.g. editor, compilers etc. and program execution e. g. shells. In some some sense, they are bundles of useful system calls. – Generally available as assembly-language instructions. – Languages defined to replace assembly language for systems programming allow system calls to be made directly (e.g., C, C++) GSPM’s Gramin Polytechnic Vishnupuri , Nanded. & Gramin College of Engineering(GRACE) Vishnupuri ,Nanded. 14 Types of System Calls 1. Process control. 2. File management 3. Device management. 4. Information maintenance. 5. Communications.
GSPM’s Gramin Polytechnic Vishnupuri , Nanded.
& Gramin College of Engineering(GRACE) Vishnupuri ,Nanded. 15 2.2.1 Process control • System call related to process control:- End, Abort. Load, Execute. Create process, terminate process. Get process attribute, set process attribute. wait event , signal event. Wait for time Change the priority of a process. Allocate and free memory. GSPM’s Gramin Polytechnic Vishnupuri , Nanded. & Gramin College of Engineering(GRACE) Vishnupuri ,Nanded. 16 2.2.2 File management • System call related to file manipulation:- Create a file , delete a file. Open a file , Close a file. Create a directory. Get file attributes, set file attributes. Read, Write, Reposition. Create a link. Change the working directory.
GSPM’s Gramin Polytechnic Vishnupuri , Nanded.
& Gramin College of Engineering(GRACE) Vishnupuri ,Nanded. 17 2.2.3 Device Management • It use for managing devices. Request device, release device. Read, write, reposition. Get device attribute, set device attributes. Logically attach or detach devices
GSPM’s Gramin Polytechnic Vishnupuri , Nanded.
& Gramin College of Engineering(GRACE) Vishnupuri ,Nanded. 18 2.2.4 Information maintenance • To do 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.
GSPM’s Gramin Polytechnic Vishnupuri , Nanded.
& Gramin College of Engineering(GRACE) Vishnupuri ,Nanded. 19 2.2.5 Communications • For communicating among calls Create, delete communication connection. Send, receive messages. Transfer status information. Attach or detach remote devices.
GSPM’s Gramin Polytechnic Vishnupuri , Nanded.
& Gramin College of Engineering(GRACE) Vishnupuri ,Nanded. 20 2.3 OS Components • Process management • Main memory management • File management • I/O system management • Secondary storage management • Networking • Protection system • Command interpreter
GSPM’s Gramin Polytechnic Vishnupuri , Nanded.
& Gramin College of Engineering(GRACE) Vishnupuri ,Nanded. 21 2.3.1 Process management • The task executed by the CPU. • A program or application under execution is called as process. • The process management activities involve: 1. Control the execution of user applications 2. Provide control access to shared resources like file, memory, I/O and CPU 3. Resume process execution or cancel it. 4. Scheduling of a process. 5. Synchronization, interposes communication and deadlock handling for process.
GSPM’s Gramin Polytechnic Vishnupuri , Nanded.
& Gramin College of Engineering(GRACE) Vishnupuri ,Nanded. 22 2.3.2 Main memory management • There are two types of memories in computer system. Primary memory which includes RAM, ROM etc. • To execute the program, user needs to keep the program in main memory. • It is volatile. New processes are required to be loaded in main memory. • Activities handled by OS 1. Allocation of memory to the processes. 2. Free the memory from process after completion of execution. 3. Keep track of memory usage by the process.
GSPM’s Gramin Polytechnic Vishnupuri , Nanded.
& Gramin College of Engineering(GRACE) Vishnupuri ,Nanded. 23 2.3.3 File management • The file management activities of OS consists of: 1. Creation and deletion of files and directories 2. Provide access to files and allocation of storage space for files. 3. Maintain back up of files. 4. File security. 5. Providing the primitives for manipulating files and directories.
GSPM’s Gramin Polytechnic Vishnupuri , Nanded.
& Gramin College of Engineering(GRACE) Vishnupuri ,Nanded. 24 2.3.4 I/O system management • As we know that I/O is one of the main functions of an OS and is used to control the entire computers I/O devices.SSS • As we know that it includes storage devices (disks, tapes), transmission devices (network cards, modems), and human interface devices(screen, keyboard, mouse). • Device driver interface. • Drivers for specific devices.
GSPM’s Gramin Polytechnic Vishnupuri , Nanded.
& Gramin College of Engineering(GRACE) Vishnupuri ,Nanded. 25 2.3.5 Secondary storage management • Primary optical storage devices are: CDROM, DVDROM, CD R, CDRW, photo C. now a days it is the part of hard disk, it can be partitioned, and each partition can be used as separate drive. • storage capacity of hard disk can be gigabyte or terabyte.
GSPM’s Gramin Polytechnic Vishnupuri , Nanded.
& Gramin College of Engineering(GRACE) Vishnupuri ,Nanded. 26 2.3.6 Networking • Networking is a technology used to connect multiple computers in the network. • The processors communicate with one another through communication lines called network. • OS takes care for data sharing, data sending, data receiving, routing data etc.
GSPM’s Gramin Polytechnic Vishnupuri , Nanded.
& Gramin College of Engineering(GRACE) Vishnupuri ,Nanded. 27 2.3.7 Protection system • If computer system has multiple users and if it is allowing the concurrent execution of multiple processes, then the various processes must be protected from each other’s activities. • Protection is a mechanism for controlling the access of programs, processes or users to the resources defined by the computer system or machine.
GSPM’s Gramin Polytechnic Vishnupuri , Nanded.
& Gramin College of Engineering(GRACE) Vishnupuri ,Nanded. 28 2.3.8 Command interpreter • It is an interface between OS and the user. The user gives commands which are executed by OS. • The main function of a command interpreter is to get and execute the user specified command.
GSPM’s Gramin Polytechnic Vishnupuri , Nanded.
& Gramin College of Engineering(GRACE) Vishnupuri ,Nanded. 29 Use of OS Tools 1. User Management 2. Security policy 3. Device Management 4. Performance Monitor 5. Task scheduler
GSPM’s Gramin Polytechnic Vishnupuri , Nanded.
& Gramin College of Engineering(GRACE) Vishnupuri ,Nanded. 30 1.User Management 1. Root: this account belongs to system administrator. This is called as super user. It has permission to run any command. 2. System Accounts: this accounts is related components. for example: email 3. User accounts: these accounts belong to users and group of users. These users have limited access to system files and directories.
GSPM’s Gramin Polytechnic Vishnupuri , Nanded.
& Gramin College of Engineering(GRACE) Vishnupuri ,Nanded. 31 Contd.. • Following are four user administration files 1. /etc/passwd: this file holds information about user accounts and password. 2. /etc/shadow: this files keeps encrypted password of corresponding accounts. 3. /etc/group: this file holds group information for each user account. 4. /etc/gshadow: it contains secure group account information.
GSPM’s Gramin Polytechnic Vishnupuri , Nanded.
& Gramin College of Engineering(GRACE) Vishnupuri ,Nanded. 32 Contd.. • Following commands are used to create and manage user, group accounts: 1. useradd: to add user accounts to the system 2. usermod: to modify accounts attributes 3. userdel: to delete user account from the system 4. groupadd: to add groups to the system. 5. groupmod: to modify group attributes. 6. groupdel: to remove groups from the system. GSPM’s Gramin Polytechnic Vishnupuri , Nanded. & Gramin College of Engineering(GRACE) Vishnupuri ,Nanded. 33 2. Security policy • Although there are already a lot of good security features built into linux based systems, one very important potential vulnerability can exist when local access is granted. • An OS security policy is one that contain information of processes ensuring that the OS maintains a certain level of integrity, confidentially and availability.
GSPM’s Gramin Polytechnic Vishnupuri , Nanded.
& Gramin College of Engineering(GRACE) Vishnupuri ,Nanded. 34 Basic file permissions 1. Permission Groups Each file and directory has three user based permission groups: • Owner: the owner permissions apply only the owner of the file or directory, they will not impact the actions of other users. • Group: the group permissions apply only the group that has been assigned to the file or directory, they will not effect the actions of other users. • All users: the all users permissions apply to all other users on the system, this is the permission group that you want to watch the most. GSPM’s Gramin Polytechnic Vishnupuri , Nanded. & Gramin College of Engineering(GRACE) Vishnupuri ,Nanded. 35 2. permission types Each file or directory has three basic permission types: 1. Read: the read permission refers to a users capability to read the contents of the file. 2. Write: the write permissions refers to a users capability to write or modify a file or directory. 3. execute: the execute permission affects a users capability to execute a file or view the contents of a directory. GSPM’s Gramin Polytechnic Vishnupuri , Nanded. & Gramin College of Engineering(GRACE) Vishnupuri ,Nanded. 36 3. Viewing the permissions • You can view the permissions by checking the file or directory permission in your favorite GUI file manager or by reviewing the output of the \”|s - |”\ command while in the terminal and while working in the directory which contains the file or folder.
GSPM’s Gramin Polytechnic Vishnupuri , Nanded.
& Gramin College of Engineering(GRACE) Vishnupuri ,Nanded. 37 4. modifying the permissions
When in the command line, the permissions are
edited by using the command chmod.
GSPM’s Gramin Polytechnic Vishnupuri , Nanded.
& Gramin College of Engineering(GRACE) Vishnupuri ,Nanded. 38 User authentication Several protection methods are developed by keeping in mind that, the system knows the recognition of each user. - The user authentication is the method to identify the user while logging into the system. - Authentication enables organizations to keep their networks secure by permitting only authenticated users or processes to gain access to their protected resources. - User authentication types 1. Password 2. Physical identification 3. countmeasures GSPM’s Gramin Polytechnic Vishnupuri , Nanded. & Gramin College of Engineering(GRACE) Vishnupuri ,Nanded. 39 Contd… 1. Passwords: username and password is simplest and most commonly used authentication. The simplest implementation just maintains a central list of login – name and password pairs. 2. Physical identification: physical object such as plastic card with magnetic strip on it can be used for authorization of users. So combination of cards and password is used in this method. 3. Countermeasures: a user should be allowed to login only from specific terminal and fixed time slot of particular days should be given to each user. in this simple approach, one special login name with an easy password is used. GSPM’s Gramin Polytechnic Vishnupuri , Nanded. & Gramin College of Engineering(GRACE) Vishnupuri ,Nanded. 40 Administrator role for security • it is the responsibility of administrator to set access to some of the systems services. Some of the users need to be protected from accessing some services. 1. Password aging: administrator in the system with /etc/shadow file can enforce the users to change the password after some predetermined time. Command used for updating the fields with appropriate options is passwd. 2. Shell Restriction: to control the users activities, administrator set up the user account with a special restricted shell. GSPM’s Gramin Polytechnic Vishnupuri , Nanded. & Gramin College of Engineering(GRACE) Vishnupuri ,Nanded. 41 Contd… 3. Device management 1. Device drivers: Linux treats each device as file. Like file, it open the device, write data to it and read data from it. -after using the device, OS then close it. -device drivers are responsible to treating every device as a file. -it is a program that controls particular device.
GSPM’s Gramin Polytechnic Vishnupuri , Nanded.
& Gramin College of Engineering(GRACE) Vishnupuri ,Nanded. 42 Contd… 2. Device files Application access the device by treating it as a file. -These files are device files and present in /dev directory. -The ls command is used to see list of files present in /dev directory. The /dev directory contains files for all possible devices.
GSPM’s Gramin Polytechnic Vishnupuri , Nanded.
& Gramin College of Engineering(GRACE) Vishnupuri ,Nanded. 43 Contd… Block device: the first letter b is listing of device file indicates that it is a block device. Character device: the first letter cin listing of device which accepts or send data one byte at a time. Network device: these device do not have files. Ethernet card is named as eth0 for first card, eth1 for second card and so on.
GSPM’s Gramin Polytechnic Vishnupuri , Nanded.
& Gramin College of Engineering(GRACE) Vishnupuri ,Nanded. 44 Contd… 3.partition • To check the partition set up on hard disk fdisk command is used. ex. sudo fdisk –l Using mount command to mount file system it is used to check what file systems are at this time mounted on the local Linux system. for ex: mount CD-ROM and Floppy Disk CD-ROM which is in the standard ISO 9960 format can be mounted by placing it in your CD-ROM drive.
GSPM’s Gramin Polytechnic Vishnupuri , Nanded.
& Gramin College of Engineering(GRACE) Vishnupuri ,Nanded. 45 Contd… 3.partition 4.Checking disk space. the space available in file system can be displayed by using df command. option –h produce the output in more readable form.
GSPM’s Gramin Polytechnic Vishnupuri , Nanded.
& Gramin College of Engineering(GRACE) Vishnupuri ,Nanded. 46 Contd… 4. Performance monitor • TOP command: it is used for monitoring the performance and used often by many system administrators to monitor linux performance. -it is used to displays 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, users, commands and much more. - Usage of top command: top
GSPM’s Gramin Polytechnic Vishnupuri , Nanded.
& Gramin College of Engineering(GRACE) Vishnupuri ,Nanded. 47 Contd… • Vmstat: linux vmstat command used to display statistics of virtual memory, kernel threads, disks, system processes, I/O blocks, interrupts, CPU activity and much more. syntax: vmstat [options] [delay[count]] for ex: vmstat 2 6
GSPM’s Gramin Polytechnic Vishnupuri , Nanded.
& Gramin College of Engineering(GRACE) Vishnupuri ,Nanded. 48 Contd… 5.Task Schedular • The sysctl interface for examining and changing kernel parameters at runtime introduces important variables by means of which you can change the default behaviour of the task schedular. • To read a value from a kernel variable, enter. • Sysctl variable
GSPM’s Gramin Polytechnic Vishnupuri , Nanded.
& Gramin College of Engineering(GRACE) Vishnupuri ,Nanded. 49 GSPM’s Gramin Polytechnic Vishnupuri , Nanded. & Gramin College of Engineering(GRACE) Vishnupuri ,Nanded. 50