3.1. INTRODUCTION
An application program cannot access input/output devices or execute program
instructions itself. The op...
3-2 OPERATING SYSTEM
It hosts the several applications that run on a computer and handles the operations of
computer hardw...
OPERATING SYSTEM 3-3
6. Scheduling jobs. The operating system determines the order in which the jobs are to
be processed. ...
3-4 OPERATING SYSTEM
permit hundreds or even thousands of concurrent users. For example, In Linux it is
possible for two u...
OPERATING SYSTEM 3-5
6. Embedded systems. The operating system designed for being used in embedded
computer systems are kn...
3-6 OPERATING SYSTEM
3.4.1. What is a file system ?
Everything you install, save, edit or create on your computer comprise...
OPERATING SYSTEM 3-7
3.4.3. File Attributes
Each file is stored in a directory, and uses a directory entry that describes ...
3-8 OPERATING SYSTEM
5. Delete file. This can be used to delete a user specified file from the specified
folder.
6. Merge ...
OPERATING SYSTEM 3-9
(a) Ready. This is when the process is ready to be run on the processor.
(b) Running. This is when th...
3-10 OPERATING SYSTEM
(a) Process state. The state may be new, ready, running, and waiting, halted and so on.
(b) CPU regi...
OPERATING SYSTEM 3-11
processes. At some later time these processes can be reloaded into memory continue
from where it was...
3-12 OPERATING SYSTEM
Memory management is concerned with allocation of physical memory of
finite capacity to requesting p...
OPERATING SYSTEM 3-13
To implement paging, we need to keep track of all free frames. To run a program of size
n pages, we ...
3-14 OPERATING SYSTEM
Programisdividedintodifferentlogicalsegmentseachsegmentisallocatednon-contiguous
space in memory. Th...
OPERATING SYSTEM 3-15
(viii) The task of managing and organizing file is called file managements.
(ix) A running program i...
3-16 OPERATING SYSTEM
6. In multiprocessing, multiple programs are executed on
(a) Different processors at same time
(b) M...
Upcoming SlideShare
Loading in...5
×

Operating System

498

Published on

An operating system is a system software that is responsible for the
management of various activities of the computer and sharing of computer resources.
Operating system is a collection of programs which makes interface between hardware, software and user.

Published in: Education, Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
498
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
28
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Operating System"

  1. 1. 3.1. INTRODUCTION An application program cannot access input/output devices or execute program instructions itself. The operating system acts as a platform on which various application programs are executed. The user requests the application program to perform a particular task and the application program refers the request of user to operating system. An operating system is a system software that is responsible for the management of various activities of the computer and sharing of computer resources. Operating system is a collection of programs which makes interface between hardware, software and user. LEARNING OBJECTIVES At the end of this chapter you will be able to understand : Definition of Operating System Functions of Operating System Types of Operating System File System Scheduling Process Concepts Memory Management L L
  2. 2. 3-2 OPERATING SYSTEM It hosts the several applications that run on a computer and handles the operations of computer hardware. The operating system is responsible for managing hardware resources. Fig. 3.1 below shows the actual position of an operating system in a computer system. Fig. 3.1 User Interface with the Operating System. OS isolates user from complex internal operations. It acts as a middle-ware application interface between user and hardware. 3.2. FUNCTIONS OF OPERATING SYSTEM Operating system manages most of the operations of the computer and performs basic function such as: 1. User interface. Operating system provides the facilities of the user interface. The user interface includes the windows, menus and method of interaction between when and the computer. Apart of the graphical user interfaces (GUIs), all operations are of the computer performed by in stead of commands. 2. Running programs. Operating system provides the facilities to run any program. The program which sends the request to the operating system and giving the results back to the program. 3. Managing files. The data and programs are stored permanently on the disk for future use. Application software such as word-processing, spreadsheet, database management system etc. may have hundreds of files. The operating system maintains and manages these files. 4. Memory management. Computer memory plays very important role for data processing. The data and programs are loaded from disk into in by RAM. The operating system and allocates the memory areas and manages these properly. 5. I/O system management. Operating system take care of input and output devices to be used in an efficient way.
  3. 3. OPERATING SYSTEM 3-3 6. Scheduling jobs. The operating system determines the order in which the jobs are to be processed. Sometimes, the operating system processes jobs on a first come first serve basis. But in some situations, one user may have higher priority than the other users. In this case, the operating system has to adjust the scheduling of the jobs. 7. Task management. Operating system works as a task manager. A computer can perform many tasks at a time. For example, in word processing it accepts input data, stores data on the disk and prints out a document simultaneously. Some operating systems can handle more than one program at the same time. 8. Controlling network. Some Operating systems are specially developed, for networking, called the network operating systems or NOSs.Anetwork operating system organizes and co-ordinates multiple users and makes it possible to access and share resources on network. 9. Security. Operating systems provide password protection to keep unauthorized users out of the system. They also provide backup and recovery function when a system failure. 3.3. TYPE OF OPERATING SYSTEM Operating systems create a link between users and the applications from the core of computer systems. It separates the programs and the hardware and simplifies resource management. Let us look at the different types of operating systems. 1. Batch processing operating systems. In batch processing operating system, the program, data and system commands submitted in the form of a batch. Batch operating system usually allows a little or no interaction between user and an executing program. It has a greater ability for resource utilization than simple several processing. Programs that do not require interaction and programs with long execution time may be served by a batch operating system. E.g. of such programs include payroll, forecasting, statistical analysis etc. Advantages (a) The processing time on machine is increased. (b) CPU utilization is improved. Disadvantages (a) Non-interactive environment. (b) Greater turn around time as there was much delay between jobs because of non-interactive environment. (c) CPU idle time is larger. (d) Uni program. 2. Multi-user and single-user operating systems. Multi user operating system allows two or more users to run programs at the same time. Some operating systems
  4. 4. 3-4 OPERATING SYSTEM permit hundreds or even thousands of concurrent users. For example, In Linux it is possible for two users to login at a time and this capability of the OS makes it a multi- user operating system. A server would be another example of a multi-user operating system that allows multiple simultaneous connections. A single user operating system only allows one user on the system. DOS is the best example of single user operating system. 3. Multi-tasking and single-tasking operating systems. When a single program is allowed to run at a time is called single-tasking operating system. The Palm OS for Palm handheld computers and DOS are the examples of single-task operating system. When operating system allows the execution of multiple tasks at one time is called multi- tasking operating system. Examples of multi tasking operating system are Windows XP, Linux, UNIX, window 7.etc. Advantages (a) Increased throughput. (b) Lowered response time. (c) Increased CPU utilization. (d) User interaction is allows between execution of program. Disadvantages (a) Ideally degree of multiprogramming should results in higher resource utilization, but in some cases high degree of multiprogramming may increase waiting time for processes and result in performance degradation starvation possible. (b) Deadlock can occur. 4. Real-time operating systems. It is a multitasking operating system that aims executing real-time applications. The main object of real-time operating systems is their quick and predictable response to events. They either have an event-driven or a time- sharing design. An event-driven system switches between tasks based of their priorities while time-sharing operating systems which tasks based on clock interrupts. Example of real- time operating system is MTOS, Lynx, and RTX etc. Advantages (a) Users are provided an interactive environment at a reasonable cost. (b) Degree of multiprogramming and resource utilization is increased. (c) Short response time. 5. Distributed operating systems. An operating system that manages a group of independent computers and makes them appear to be a single computer is known as a distributed operating system. Linux and UNIX are the examples of distributed OS.
  5. 5. OPERATING SYSTEM 3-5 6. Embedded systems. The operating system designed for being used in embedded computer systems are known as embedded operating systems. They are designed to operate on small electronics device like PDAs. Windows CE, FreeBSD and Minix 3 are some examples of embedded operating systems. 3.4. FILE MANAGEMENT A collection of data or information is called file. It has a name called the filename. The information stored in a computer must be in a file. There are many different types of files: data files, text files, program files, directory files, and so on. Different types of files store different types of information. For example, program files store programs, whereas text files store text. The task of managing and organizing file is called file managements. The task of file management is generally done by the operating system. Operating system perform following memory management task: 1. Creating new files. 2. Locating the files in computer memory. 3. Sharing files between different users. 4. Organizes the files in different directories. The Fig. 3.2 shows the hierarchy of file store in an system. Fig. 3.2 Hierarchy of file store The system that an operating system or program uses to organize and keep track of files. For example, a hierarchical file system is one that uses directories to organize files into a tree structure. L
  6. 6. 3-6 OPERATING SYSTEM 3.4.1. What is a file system ? Everything you install, save, edit or create on your computer comprises the trillions of bits of data. A file system stores, organizes and allows to access files on a daily basis for computer users. Hard drives, CD-ROMs, DVD-ROMs and servers are all types of file systems that allow you access to data. File system is the structures in computer used to stores and organizes data. All file systems store information into some sort of directory for easy access. Some systems create very detailed structures where others keep files in organized disarray. It depends on the type of file system software you are running, navigating the nodes of information can be easy or difficult for the average computer user. The average computer user relies on their operating system to take care of the file system for them, and in most cases, this is all that is necessary for the computer user. More advanced user may find the organization of their data to benefit from a different type of file system all together. Most file systems can create, move and delete files and directories similar to how you would delete a whole folder in Windows XP or Windows 98. You can simply drag and drop the folder from one place to another. In MS-DOS, you use a sequence of commands to eliminate a folder from the system. Other UNIX-based file system structures allow you further abilities to modify data without diving into the advanced realm of computing. You can also limit who has access to what functions, such as creating or editing files, via file system software within the confines of your operating system. 3.4.2. Types of file system File systems can be classified into three different types: Disk, network and special purpose. 1. Disk files systems. These are designed to store information on a hard drive disk. FAT, NTFS and UDF are all types of disk file systems. 2. Network files systems. These file systems act as a client for file access protocols on a server. FTP, WebDAV and NFS are types of network file systems. 3. Special purpose file. These systems are the miscellaneous systems that do not fit into the disk or network file system categories. Special purpose systems are generally used in Unix-based systems. Flat file systems are one of the most general ways to store data. Information is stored on the same level instead of creating sub-levels of data. There are sub-categories of file systems as well. Database file systems, for example, identify files by their type, author or other meta data. Transactional file systems access of files by individuals in the hopes of executing all changes at the same time banks and financial institutions employ this type of file structure in their computer systems to ensure the seamless transfer of money between two accounts and other functions that require autonomy. L
  7. 7. OPERATING SYSTEM 3-7 3.4.3. File Attributes Each file is stored in a directory, and uses a directory entry that describes its characteristics such as its name and size. The directory entry also contains a pointer to where the file is stored on disk. One of the characteristics stored for each file is a set of file attributes that give the operating system and application software more information about the file and how it is intended to be used. A file can have more than one attribute attached to it, although only certain combinations really make any sense. 1. Read-Only. Most software, when seeing a file marked read-only, will refuse to delete or modify it. This is pretty straight-forward. For example, DOS will say “Access denied” if you try to delete a read-only file. 2. Hidden. This one is pretty self-explanatory as well if the file is marked hidden then under normal circumstances it is hidden from view. DOS will not display the file when you type “DIR” unless a special flag is used. 3. System. This flag is used to tag important files that are used by the system and should not be altered or removed from the disk. In essence, this is like a “more serious” read- only flag and is for the most part treated in this manner. 4. Volume label. Every disk volume can be assigned an identifying label, either when it is formatted, or later through various tools such as the DOS command “LABEL”. The volume label is stored in the root directory as a file entry with the label attribute set. 5. Directory. This is the bit that differentiates between entries that describe files and those that describe subdirectories within the current directory. In theory you can convert a file to a directory by changing this bit. Of course in practice, trying to do this would result in a mess—the entry for a directory has to be in a specific format. 6. Archive. This is a special bit that is used as a “communications link” between software applications that modify files, and those that are used for backup. 3.4.4. File operation The File Operation used to perform different types of operations on files and directories such as create, move, delete, and also to set the attributes for files and folders. The different types of operations which can be performed by the file operation are as following: 1. Copy file. This operation is used to copy a file from one location to another location. You will need to configure both the source and destination when using this operation of the file. 2. Move file. This operation moves a file from one location to another. 3. Rename file. This can be used to rename a file available within a specified location. 4. Create directory. This can be used to create a folder. You will need to specify the source location where the folder needs to be created.
  8. 8. 3-8 OPERATING SYSTEM 5. Delete file. This can be used to delete a user specified file from the specified folder. 6. Merge files. This operation is used to append one file to another. 7. Set attributes. This operation is used to set attributes to files and folders. Different types of attributes which can be set are hidden, archive, read only and system. 8. Trunked. Earse text and write other text. 3.5. PROCESS Aprocess is more than the program code. It also includes the current activity, as represented by the value of the program counter and also includes the process stack containing temporary data, and data section containing global variables. A process can simply be defined as a program in execution it can be defined as a program currently making use of the processor at any one time. A running program is called process. 3.5.1. Process state As a process executes, it changes state. The state of a process is defined in part by the current activity of that process. Aprocess can be on any of the following states as shown in Fig. 3.3. Fig. 3.3. Process State. L L
  9. 9. OPERATING SYSTEM 3-9 (a) Ready. This is when the process is ready to be run on the processor. (b) Running. This is when the process is currently making use of the processor. (c) Blocked. This is when the process is waiting for an input such as user response or data from another process. A process may be in the blocked state if it needs to access a resource. (d) Suspend. This is when a process is swapped out of a memory by memory management system in order to free memory for other process. (e) Waiting. This is when a process is swapped out of memory after incurring an O/I wait. (f) Terminate. This is when a process has finished its run. 3.5.2. Process Control Block When a process is created the operating system creates a corresponding process control block and when the process is terminated its process control block is released. The operating system groups all information that it needs about a particular process into a data structure called a process control block. A process control block contained many pieces of information associated with specified process as shown in the Fig. 3.4. Fig. 3.4. Process Control Block. L
  10. 10. 3-10 OPERATING SYSTEM (a) Process state. The state may be new, ready, running, and waiting, halted and so on. (b) CPU registers. Registers include accumulators, index registers, stack, pointer, and general-purpose registers plus any condition-code information. (c) Memory-management information. It includes such information such as value of the base and limit registers, the page tables, or segment tables depending on the memory system used by the operating system. (d) Program counter. It indicates that address of next instruction to be executed for this process. (e) Accounting information. It includes the CPU time and real time used, time limit, account numbers, job or process numbers and so on. (f) I/O status information. It includes the list of I/O devices allocated to this to process. (g) CPU scheduling information. It includes a priority of a process, pointers to scheduling queues and any other scheduling information. 3.5.3. Process scheduling—Good job mixture Schedulingisafundamentaloperatingsystemfunction.Theobjectiveofmultiprogramming is to have some process running all the times, to maximize CPU utilization. The objective of time sharing system is to switch the CPU among processes so frequently that users can interact with each program while it is running. Scheduling Queues. As processes enter the system, they are put into a job queue. This queue consists of all processes in the system. The processes that are residing in main memory and are ready and waiting to execute are kept on a list called the ready queue. A ready-queue header will contain pointers to the first and last PCBs in the list. The list of processes waiting for a particular I/O device is called a device queue. Each device has its own device queue. 3.5.4. Schedulers job mixture A scheduler is a program of an OS that selects the next job to be admitted for execution. The main objective of scheduling is to increase CPU utilization and higher throughput. Schedulers can be divided into three types : 1. Long term scheduler. 2. Medium term scheduler. 3. Short term scheduler. 1. Long term scheduler. Some times it is called job scheduler. This determines which job shall be admitted for immediate processing. The long-term scheduler select processes from job pool and loads them into main memory. 2. Medium term scheduler. Medium term useful when most of the processes require some I/O operations in that case it may become suspended for I/O operations. It is beneficial to remove this process from main memory to hard disk to make room for other
  11. 11. OPERATING SYSTEM 3-11 processes. At some later time these processes can be reloaded into memory continue from where it was left earlier. 3. Short term scheduler. Short-term scheduler (CPU scheduler) selects processes from among the processes that are ready to execute, and allocates the CPU to one of them. Its main objective is to maximize system performance. 3.5.5. Scheduling algorithm The scheduling algorithm may be: 1. First Come First Served (FCFS). This is the simplest scheduling algorithm. With this scheme, the process that requests the CPU first is allocated the CPU first. When a job is submitted in FCFS scheduling it enters the ready queue. The oldest job in the ready queue is always selected to dispatch. A FCFS results in poor performance. As a consequence of non-preemptive there is a low rate of component utilization and system throughput. 2. Shortest Job First Scheduling Algorithm (SJFS). It associates with each process the length of the next CPU burst time. When CPU is available it is assigned to the process that has the next smallest CPU burst time. If two processes have the same length then FCFS is used to break the tie. 3. Round Robin Scheduling (RRS). In round robin scheduling basically CPU time is divided into time slice. RRS utilizes the system resources in an equitable manner small processes may be executed in a single time slice giving good response time whereas long process may require several time slices. It is also one of the best-known scheduling disciplines for achieving good distributed response time. 3.5.6. Process synchronization In a multiple processor system many processes can run in parallel since separate processors could be allocated for them. Processes must be able to inform one another that may have completed a certain action. This is necessary to satisfy the requirements for communication system normally. That information must not be over written before the old information has been used and no attempt should be made to remove information before it has been made available for i.e. in process synchronization the terminal manager might test the variable character count against some suitable limit using some sequence. 3.6. MEMORY MANAGEMENT Processes need physical memory in order to execute. The operating system manages and allocates memory to processes from physical and virtual memory. Physical memory management enables the operating system to safely share physical memory among processes. This allows us to multiprogramming the processor, to time-share the system and to prevent one process from using another memory.
  12. 12. 3-12 OPERATING SYSTEM Memory management is concerned with allocation of physical memory of finite capacity to requesting process. Memory management techniques must meet the following requirements: (a) Processes may require more memory than available physical memory. (b) You may need to load processes to different locations each time they execute. (c) You may need to swap all or part of a process to secondary storage during execution (and then reload it at a different memory location, as above). (d) Memory protection between processes is required. 3.6.1. Memory Management Scheme 1. Swapping. It is the simplest memory management scheme. In system where partitions are not used and all the available memory is allocated to one user. Swapping is the process of transferring programs from the main memory to the disk storage and back from disk to main memory. Program swapping can be used one specific program is loaded into memory executes for a particular amount of time and then it is swapped out to the disk storage then another program is allocated in the available memory. In timesharing system when a time quantum of a process expires it is swapped out from main memory and another process is swapped in from the disk into the main memory space that has been freed from the first program. In priority based scheduling a lower priority job is rolled back on the arrival of a higher priority job. In this case lower priority job is swapped out and higher priority job is swapped into the memory. These swapping process sometimes know as rollin as rollout. 2. Paging. Paging is a scheme of memory management which provides a solution to the problem of external fragmentation. It does not resolve the problem of internal fragmentation completely but internal fragmentation can be reduced by choosing an appropriate page size in the scheme. Paging is a memory management technique in which a process is split into a number of fixed equal size partitions and allocated non contiguous memory spaces. In this scheme, physical memory is broken into fixed size blocks called frames. Logical memory is also divided into pages, where each page is of some fixed sized as frame. When a process is to be executed its pages are loaded into available frames at not- contiguous location. L L L
  13. 13. OPERATING SYSTEM 3-13 To implement paging, we need to keep track of all free frames. To run a program of size n pages, we need to find n free frames and load the program into them. There is a problem with internal fragmentation if a process size is not an exact number of frames. Only part of one frame is lost to this fragmentation, however, and if we make the frame size quite small, this isn't a significant problem. With paging, the logical address generated by the CPU is divided into a page number p and a page offset d. The page number is used as an index into a page table which contains the base address of each page in physical memory and the page offset is combined with the base address to define the physical memory address that is sent to the memory unit as shown in Fig. 3.5. Fig. 3.5 Page Table. A page table is maintained which contains the base address of each page in physical memory. CPU generated address is divided in 2 parts : (A) Page number. (B) Page offset. This is known as logical address. Right hand bit of logical address give the offset number and left hand bits provide the page number. This page number works as index in the page table and corresponding base address of that page is determinate. This base address is combined with the page offset to obtain physical memory address. 3. Segmentation. Segmentation is a memory management technique when the users view is map onto physical memory in this scheme. A segment is a logical unit, such as: the main program, procedures, functions, methods, objects, local variables, global variables, common blocks, the stack, the symbol table and arrays. L
  14. 14. 3-14 OPERATING SYSTEM Programisdividedintodifferentlogicalsegmentseachsegmentisallocatednon-contiguous space in memory. These segments may be of variable name. Every segment has a name and length. User views a main program as a collection of different components such as a set subroutines, processor function etc. Segmentation support two users view of memory. In segmentation, you have a logical address consisting of a segment number and an offset and a segment table that maps two-dimensional physical addresses as shown in the Fig. 3.6. Each table entry has a base that contains the starting physical address where segments reside in memory and the limit that specifies the length of the segment. Fig. 3.6. Segmentation Table. With each entry in the segment table, a validation bit (one that indicates whether or not it was an illegal statement) and read/write/execute privileges are associated with the entry. Since segments can vary in length, memory allocation is a dynamic storage-allocation problem, which can lead to external fragmentation. POINTS TO REMEMBER (i) Operatint system acts as an mediator between user and hardware. (ii) Operating system provides platefom to other application softwares. (iii) Operating system provides the facilities to run any program. (iv) Operating system take care of input and output devices. (v) Operating systems provide password protection to keep. (vi) Multi user operating system allows two or more users to run programs at the same time. (vii) A single user operating system only allows one user on the system.
  15. 15. OPERATING SYSTEM 3-15 (viii) The task of managing and organizing file is called file managements. (ix) A running program is called process. (x) Memory management is concerned with allocation of physical memory of finite capacity to requesting process. KEY TERMS ❍ Operating system ❍ Hardware, software, user ❍ Batch processing ❍ Multi tasking and single tasking ❍ File management ❍ Disk files, network file, special file ❍ File attributes ❍ Read only, hidden, system, volume ❍ File operation ❍ Cut, copy, move, create, delete file ❍ Process state ❍ Ready, running, blocked, suspend, waiting MULTIPLE CHOICE QUESTIONS 1. An operating system is a software component of a computer system that is (a) Responsible for the management of various activities of the computer (b) The sharing of computer resources (c) Both (a) and (b) (d) None of above 2. Operating system manages all the operations of the computer and performs basic tasks (a) Accepts input from input devices (b) Sends output to output devices (c) Manages the application programs in memory (d) Manages the files on the storage devices (e) All of above 3. A distributed system is a (a) Collection of processors (b) Collection of data (c) Collection of information (d) None of above 4. The main major activities of an operating system in regard to file management are (a) The creation and deletion of files (b) The creation and deletion of directions (c) The mapping of files onto secondary storage (d) (a) and (b) (e) All of above 5. The examples of personal computer operating system are: (a) DOS (b) Mac OS (c) Windows (d) All of above (e) (a) and (c)
  16. 16. 3-16 OPERATING SYSTEM 6. In multiprocessing, multiple programs are executed on (a) Different processors at same time (b) Multiple site (c) Multiple editor (d) None of above 7. Spooling is a technique in which an operating system uses (a) Buffers to place data before transferring it (b) Input and output device for connection (c) More then one user (d) Multitasking concept 8. Compiler is a computer program that (a) Convert high level language to machine language (b) Machine to assembly (c) Assembly to high level language (d) All of above 9. Loader is the part of an operating system that is responsible for (a) Linking the content of program (b) Loading programs, that is, starting up programs by reading the contents of executable (c) Executing the program contents (d) All of above 10. TheAssembly language consists instruction statements which are used to define the program operations (a) Op-code mnemonics (b) Data sections (c) Assembly directives (d) All of above (e) (a) and (c) ANSWERS 1. (c) 2. (e) 3. (a) 4. (e) 5. (d) 6. (a) 7. (a) 8. (a) 9. (b) 10. (d) UNSOLVED QUESTIONS 1. What is operating system ? Explain the function of operating system. 2. Draw the block diagram of operating system. 3. Explain different types of operating system. 4. What is file system ? Explain difference file system. 5. What is process ? Explain the state of a process. 6. Explain PCB with the help of diagram. 7. What do you mean by memory management ? 8. Explain the difference between paging and segmentation. ❍ ❍ ❍

×