Page 2 :
MNS, , 10/4/2021, , Teaching & Examination Scheme, , 2
Page 3 :
MNS, , • CO-01: Install Operating System & Configure it., • CO-02: Use operating System tools to perform various functions., • CO-03: Execute process commands for performing process, management operations., • CO-04: Apply scheduling algorithm to calculate turnaround time &, average waiting time., • CO-05: Calculate efficiency of different memory management, techniques., • CO-06: Apply file management techniques., , 10/4/2021, , Course Outcomes, , 3
Page 4 :
Course Content, , • Chapter No 02, Marks ( ), • Services & Components of Operating System, , • OS Components•, •, •, •, •, , Process Management,, Main Memory Management,, File Management,, I/O System Management,, Secondary Management., , MNS, , • Concept, • Types of system calls, , 10/4/2021, , • Different Services of Operating System, • System Calls-, , • Use of Operating System Tools•, •, •, •, •, , User Management,, Security Policy,, Device Management,, Performance Monitor,, Task Scheduler, , 4
Page 5 :
Learning Objectives:, •, •, •, •, , MNS, , • UO- 01:- Start, stop & restart the given services in Linux., • UO-02:- Explain use of the given system call of specified OS., • UO-03:- Explain process the OS follows in managing the given, resource., • UO-04:- Explain use of the given operating system tool., , 10/4/2021, , Unit outcomes, , To Understand different Services of Operating System., To Learn concepts of system calls., To study different Components of Operating Systems., To learn Use of Operating System Tools., 5
Page 6 :
MNS, , • An Operating system provides an environment for the execution, of programs., • It provides certain services to programs & to the users of those, programs., • The specific services provided, of course, differ from one, Operating System to another, but we can identify common, classes., • These operating system services are provided for the convenience, of the programmer, to make the programming task easier., , 10/4/2021, , 2.0 Introduction, , 6
Page 7 :
2.1 Overview of Services in OS, User & other system programs, Batch, , Command Line, 10/4/2021, , GUI, , User Interface, , MNS, , System Calls, , Program, Execution, , I/O, Operation, , File, Systems, , Communi, cation, , Resource, allocation, , Accounting, , Protection, &, Security, , Error, Detection, Operating System, Hardware, , Fig. A view of OS Services, , 7
Page 8 :
Cont…, • Questions:, , (Summer 18), , 4M, , • Operating System Services, • Program Execution:, • The purpose of computer system is to allow the users to execute, programs in an efficient manner., • The Operating System provides an environment where the user can, conveniently run these programs., • The user does not have to worry about the memory allocation or deallocation or any other thing because these things are taken care of by, the OS., • The OS must be able to load the program into memory & to execute it., • The program must be able to terminate its execution, either normally or, abnormally., , MNS, , • File system manipulation, • Resource allocation, , 10/4/2021, , • Explain any six services of operating services. Draw diagram of, services of OS. (Winter 19) 6M, • Explain following two services of operating system, , 8
Page 9 :
Cont…, , MNS, , • Each program requires an input & after processing the input, submitted by user it produces output., • This involves the use of use of I/O devices., • The input may be either from a file on the disk or from some other, input devices., • The output may be written to some file on the disk or sent to some, output devices such as printer, plotter., • User programs cannot execute I/O operations directly, the operating, system must provide some means to perform I/O., , 10/4/2021, , • I/O Operations:, , • File System Manipulation:, • While working on the computer, generally a user is required to, manipulate various types of files like as opening a file, saving a file &, deleting a file from the storage disk., • Program needs to read a file or write a file., • The OS gives the permission to the program for operation on file., • Maintain details of files or directories with their respective details., • This is an important task that is also performed by the operating system., , 9
Page 10 :
Cont…, , • Error Detection:, , MNS, , • Operating System performs the communication among various types of, process in the form of shared memory., • In multitasking environment, the processes need to communicate with, each other & to exchange their information., • These processes are created under a hierarchical structure where the, main process is known as parent process & the sub processes are known, as child process., , 10/4/2021, , • Communication:, , •, •, •, •, , Error can occur anytime & anywhere., Error may occur in CPU, in I/O devices or in the memory hardware., Operating system deals with hardware deals with hardware problems., To avoid hardware problems the operating system constantly monitors, the system for detecting the errors & fixing these errors(if found)., • The main function of operating system is to detect the errors like bad, sectors on hard disk, memory overflow & errors related to I/O devices., • After detecting OS takes an appropriate action for consistent computing., , 10
Page 11 :
Cont…, , • Accounting:, • Operating system keeps an account of all the resources accessed by each, process or user., • In multitasking, accounting enhances the system performance with the, allocation of resources to each process ensuring the satisfaction to each, process., , MNS, , • In the multitasking environment, when multiple jobs are running at a, time, it is the responsibility of an operating system to allocate the, required resources(like as CPU, main memory, tape drive or secondary, storage etc.) to each process for its better utilization., • For this purpose various types of algorithms are implemented such as, process scheduling, CPU scheduling, disk scheduling etc., , 10/4/2021, , • Resource Allocation:, , • Protection:, • If a computer system has multiple multiple users & allows the concurrent, executions of multiple processes, then the various processes must be, protected from one another‟s activities., • Protection refers to mechanism or a way to control the access of, programs, processes or users to the resources defined by a computer, system., , 11
Page 12 :
Cont…, , MNS, , • Providing a User Interface(UI) to interact with users is essential for, an operating system, • This interface can be in one of the several forms. One is Command, Line Interface(CLI) in which users interact with OS by typing, commands., • Another is batch interface, in which several commands & directives, to control those commands are collected into files which are then, executed., • Graphical User Interface (GUI), in which users interacts with the, system with a pointing device, such as a mouse., , 10/4/2021, , • User Interface:, , 12
Page 13 :
Start, Stop & Restart services in Linux, , • systemctl list-unit-files --type service –all, , MNS, , • In order to manage the services, you first need to know what services, are available on your system., • You can use the systemd command to list all the services on your, Linux system:, , 10/4/2021, , • List all services, , 13
Page 14 :
Cont…, • Combine it with the grep command and you can display just the, running services:, • sudo systemctl | grep running, , • systemctl start <service-name>, , • Stop a service, • To stop a systemd service, you can use the stop option of systemctl, command:, , MNS, , • To start a service in Linux, you just need to use its name like this:, , 10/4/2021, , • Start a service, , • systemctl stop <service-name>, , • Restart a service, • To restart a service in Linux with systemd, you can use:, • systemctl restart <service-name>, , • Check the status of a service, • You can confirm that you have successfully executed a certain action, by printing the service status:, • systemctl status <service-name>, , 14
Page 15 :
2.2 System Calls, • Questions:, , MNS, , • Concept:, , 10/4/2021, , • What is system call? Explain its categories., • Explain different types of system calls., • Give some examples of system calls with explanation., , 15
Page 17 :
2.3 Operating System Components, • We can create a system as large and complex as an operating system, only by partitioning it into smaller parts., • Each part is a well-defined portion of the system, with defined inputs,, outputs and functions., , •, •, •, •, •, , Creating & Deleting both user & system processes., Suspending & resuming processes., Providing mechanisms for process communication., Providing mechanisms for process synchronization., Providing mechanisms for deadlock handling., , MNS, , • A process is a program in execution., • A time shared user program such as compiler is a process. A word, processing program being run by an ideal machine is a process. Sending, printout to printer is also a process., • Now we consider a process to be a job or a time shared program. A, process needs certain resources like CPU time, memory I/O devices and, file to accomplish its task. These resources are provided when process is, created or allocated while it is running., • The execution of a process must be sequential. The CPU executes, instructions one after another until the process completes., • The OS is responsible for the following activities w.r.t. process, management:, , 10/4/2021, , • Process Management:, , 17
Page 18 :
Cont…, , MNS, , • The main memory is central to the operation of a modern computer, system., • Main memory is a large array of words or bytes, ranging in size, from hundreds of thousands to billions., • Each word or bytes has its own address. Main memory is act as an, interface between CPU and I/O devices and access data easily The, CPU process data from disk, those data first transferred to main, memory by CPU generated I/O calls., • Equivalently instructions must be in memory for the CPU to execute, them. When a program to be executed, it must be mapped to absolute, addresses and loaded in memory., • As the program executes, it accesses program instructions and data, from memory by generating these absolute addresses When, program is executed these memory space is reuse for the next, program., • To improve the CPU utilization and speed of computers, we must, keep several programs into memory., , 10/4/2021, , • Main Memory Management:, , 18
Page 19 :
Cont…, , MNS, , • Keeping track of which parts of memory are currently being used, and by whom., • Deciding which processes are to be loaded into memory when, memory space becomes available., • Allocating and de-allocating memory spaced as needed., , 10/4/2021, , • The operating system is responsible for the following, activities w.r.t memory management:, , 19
Page 20 :
Cont…, , MNS, , • Another important component of all the operating systems is file, management, which deals with the management and organization of, various files in the system., • Computers can store information on several different types of physical, media like magnetic tape, magnetic disk and optical disk., • Each of these media has its own characteristics and physical organization., • Each medium is controlled by device and this device also has unique, characteristics., • These properties include access speed, capacity, and data transfer rate and, access method., • A file is a collection of related information defined by its creator., Commonly file represents program (source and object) and data., • Data file may be numeric, alphabetic or alphanumeric., • A file consists of a sequence of bits, bytes, lines or records whose meanings, are defined by its creators., • Files are normally organized into directories to easy their use., , 10/4/2021, , • File Management :, , 20
Page 21 :
Cont…, Creating and deleting files., Creating and deleting directories., Supporting primitives for manipulating files and directories., Mapping files on to secondary storage., Backing up files on storage media., , MNS, , •, •, •, •, •, , 10/4/2021, , • The operating system is responsible for the following, activities w.r.t file management:, , 21
Page 22 :
Cont…, , • A memory management component that includes buffering, caching, and spooling., • A general device driver interface., • Drivers for specific hardware devices., , MNS, , • The purpose of operating system is to hide the particular hardware, devices from the user., • Example, in UNIX the peculiarities of I/O devices are hidden from, the bulk of the operating system itself by the I/O subsystem., • The I/O subsystem consists of, , 10/4/2021, , • I/O System Management:, , • Only the device driver knows the peculiarities of the specific device, to which it is assigned., , 22
Page 23 :
Cont…, , • 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., , MNS, , • The main purpose of operating system is to execute programs., • These programs with data must be in a main memory of in a primary, storage during execution., • Main memory is too small to accommodate all data and programs, and, its data are lost when is lost, so that the computer system must provide, Secondary storage to backup., • Secondary storage consists of tapes, disks & other media designed to, hold information that eventually be accessed in primary storage, (primary, secondary, cache) is ordinarily divided into bytes or words, consisting of a fixed number of bytes,., • Each location in storage has an address: the of all addresses available, to a program is called an address space., • Most programs including compilers, assemblers, editors and formatters, are stored on a disk ,until loaded into memory and then use the disk as, both the source and destination of their processing., • The operating system is responsible for the following activities w.r.t., disk management., , 10/4/2021, , • Secondary Storage Management:, , 23
Page 24 :
2.4 Use of Operating System Tools, • Just like Windows XP, Windows 7, Windows 8, Mac OS X, Linux, is an Operating System is s/w that manages all of the hardware, resources associated with the desktop computer or laptop., , MNS, , • As the administrator, it is your job to create & manage the accounts, for all required users(real & pseudo)., • To facilitate this, Linux comes with several tools for user, management., • User management can be done in three ways on a Linux system., , 10/4/2021, , • User Management:, , • Graphical tools are easy & suitable for new users, as it makes sure you‟ll, not run into any trouble., • Command line tools includes commands like useradd, userdel,, passwd,etc., • To edit the local configuration files directly using vi., , • root:, • The root user is the superuser & have all the powers for creating a user,, deleting a user and can even login with the other user‟s account., • The root user always has userid 0., , 24
Page 25 :
Cont…, , • passwd command:, •, •, •, •, •, •, •, , The passwd command is used set up password for users., Syntax:- passwd user_name, Example: passwd vijay, (current) UNIX password: 123 45, Enter new UNIX password: abc@123, Retype new UNIX password: abc@123, passwd: password updated successfully, , MNS, , • To add new users in Linux system we can use useradd command., • The useradd command creates a new user account using the value, specified on the command line & the default value from the system., • Syntax:- useradd login_name, • Example:- useradd xyz, , 10/4/2021, , • Useradd: Creating New User, , 25
Page 27 :
Cont…, • Security Policy:, • Keep System Updated:, , • Use Secure SSH:, • TELNET & rlogin protocols uses plain text, not encrypted format which is, the security breaches., • SSH is a secure protocol that use encryption technology during, communication with server., • Never login directly as root unless necessary. Use “sudo” to execute, commands., , MNS, , • $yum updates, • $yum check-update, , 10/4/2021, , • Always keep updated with latest releases patches, security fixes & kernel, when its available., , • $vi /etc/ssh/sshd_config, • $PermitRootLogin No, , • Deactivate Networking Ports:, • With the help of „netstat‟ networking command you can view all open ports, & associated programs., • Use „chkconfig‟ command to disable all unwanted network services from the, system., • $netstat –tulpn, , 27
Page 28 :
Cont…, , • Lock & Unlock Features:, • They are very useful, instead of removing an account from the system,, you can lock it for an week or a month., • To lock a specific user, you can use the following command., , • If you are not using a IPv6 protocol, then you should disable it because, most of the applications or policies not required IPv6 protocol &, currently it doesn‟t required on the server., • #vi /etc/sysconfig/network, • NETWORKING_IPV6=no, • IPV6INT=no, , MNS, , • Turn off IPv6:, , 10/4/2021, , • passwd -1 accountname, , • Enables Iptables(Firewall):, • It is highly recommended to enable Linux firewall to secure unauthorized, access of your servers., • Apply rules in Iptabes to filters incoming, outgoing & forwarding, packets., , 28
Page 29 :
Cont…, • Use Strong Password Policy:, , • If you partition your disks then you‟ll be separating OS files from user, files, temp files & program., , • Use SFTP not FTP:, , MNS, , • Try Disk Partitions for better web host security:, , 10/4/2021, , • Password are always a security problem because humans are. People, often cannot be bothered to come up with lot of different passwords, so, they use same ones in different places or combinations that are easy to, remember., , • File Transfer Protocol(FTP) is not safe anymore, even if you can encrypt, your connection., • SFTP is FTP over SSH(also called secure FTP) it encrypts all the data,, credentials and files included., , • Install Antivirus/Antimalware Software:, • It is true that there are free anti-malware programs out, but as you expect, you get what you pay for., , • Backup Regularly:, , 29
Page 30 :
Cont…, , MNS, , • 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(/) filesystem because these device files must, be available to the OS during the boot process., • The device nodes in the “/dev” directory provide access to the, corresponding kernel devices., • Every kernel device has one corresponding device file. If a device is, disconnected from the system, the device node is removed., , 10/4/2021, , • Device Management:, , 30
Page 31 :
• ACTION=add, • DEVPATH=/devices/pic0000.00/0000:00:1d.2/usb3/3-1/31:1.0/input/input10, • SUBSYSTEM=1181, • NAME=“Logitech USB-PS/2 Optical Mouse”, , MNS, , • The first character in the permission, “b” or “c” represents whether the, device is block or character oriented., • Udev is the character manager for the Linux 2.6 kernel that, creates/removes device nodes in the “/dev” directory dynamically., • It is the successor of devfs & hotplug. It runs in userspace & the user can, change device names using udev rules., • Udevadm monitor –env shows the complete event environment:, , 10/4/2021, , Cont…, , • Goals of Udev:, • Run in user space., • Create persistent device names, take the device naming out of kernel, space & implement rule based device naming., • Create a dynamic /dev with device nodes for devices present in the system, & allocate major/minor numbers dynamically., • Provide a user space API to access the device information in the system., , 31
Page 32 :
Cont…, , • Linux top command is a performance monitoring program which is used, frequently by many system administrators to monitor system, performance & it is available under many Linux/Unix like OS., • 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, proces PID, User, commands, etc., • $ top, , MNS, , • It is really tough job for every System or Network administrator to, monitor & debug Linux system performance every day., • There are different commands which are used to monitor the system, performance., • top Command:, , 10/4/2021, , • Performance Management:, , 32
Page 33 :
Cont…, • vmstat:, , • The first two columns shows processes:, • The r column is the process waiting for running & b column is any processes in, uninterruptible sleep., , MNS, , • $ vmstat, , 10/4/2021, , • It is used to display stastics of virtual memory, kernel threads, disks,, system process, I/O blocks interrupts, CPU activity & much more., • By default “vmstat” command is not avaliable under Linux system you, need to install a package called “sysstat” that includes a vmstat program., , • The next four columns shows memory:, • Virtual, free, buffer & cache memory. The third heading labeled swap, shows, the amount of memory swapped to and from the disk., • Fourth heading is I/O & details blocks received & sent to block devices., , 33
Page 34 :
Cont…, • Some other commands are used to check the system performance, monitoring are:, • Netstat:-, , • Linux Processing monitoring., , • IOstat:, • Input / Output Statistics., , MNS, , • Htop:-, , 10/4/2021, , • Network Statistics., , • IPTraf:• Realtime IP Lan monitoring., , • Acct:• Monitor user activity., , • Iftop:• Network bandwidth monitoring., , • Monitoris:• System & Network Monitoring., , 34
Page 35 :
Cont…, , MNS, , • The cron daemon on Linux runs tasks in the background at specific, times; its like the task scheduler on Windows., • Add tasks to your system‟s crontab files using the appropriate syntax, & cron will automatically run them for you., • First open a terminal window from your Linux desktop‟s, applications menu. You can click the Dash icon, type Terminal &, press Enter to open one if you‟re using Ubuntu., • Use the “crontab –e” coomand to open your user account‟s crontab, file., , 10/4/2021, , • Task Scheduler:, , • $ crontab -e, , 35