Operating system study note, Lecture notes of Operating Systems

All you need to know about operating system

Typology: Lecture notes

2021/2022

Uploaded on 04/02/2022

allison-macauley
allison-macauley 🇳🇬

4

(1)

1 document

1 / 30

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
COM 321
OPERATING SYSTEM II
HND1 COMPUTER SCIENCE
2019/2020 SESSION
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e

Partial preview of the text

Download Operating system study note and more Lecture notes Operating Systems in PDF only on Docsity!

COM 321

OPERATING SYSTEM II

HND1 COMPUTER SCIENCE

2 019/2020 SESSION

Memory management Memory management is the functionality of an operating system which handles or manages primary memory and moves processes back and forth between main memory and disk during execution. Memory management keeps track of each and every memory location, regardless of either it is allocated to some process or it is free. It checks how much memory is to be allocated to processes. It decides which process will get memory at what time. It tracks whenever some memory gets freed or unallocated and correspondingly it updates the status. MEMORY MANAGEMENT ADDRESSES Address Space The process address space is the set of logical addresses that a process references in its code. For example, when 32-bit addressing is in use, addresses can range from 0 to 0x7fffffff; that is, 2^31 possible numbers, for a total theoretical size of 2 gigabytes. The operating system takes care of mapping the logical addresses to physical addresses at the time of memory allocation to the program. There are three types of addresses used in a program before and after memory is allocated Symbolic addresses The addresses used in a source code. The variable names, constants, and instruction labels are the basic elements of the symbolic address space. Relative addresses At the time of compilation, a compiler converts symbolic addresses into relative addresses. Physical addresses The loader generates these addresses at the time when a program is loaded into main memory. Virtual and physical addresses are the same in compile-time and load-time address- binding schemes. Virtual and physical addresses differ in execution-time address- binding scheme. The set of all logical addresses generated by a program is referred to as a logical address space. The set of all physical addresses corresponding to these logical addresses is referred to as a physical address space. The runtime mapping from virtual to physical address is done by the memory management unit (MMU) which is a hardware device. MMU uses the following mechanism to convert virtual address to physical address.  The value in the base register is added to every address generated by a user process, which is treated as offset at the time it is sent to memory. For example, if the base register value is 10000, then an attempt by the user to use address location 100 will be dynamically reallocated to location 10100.  The user program deals with virtual addresses; it never sees the real physical addresses. Static vs Dynamic Loading The choice between Static or Dynamic Loading is to be made at the time of computer program being developed. If you have to load your program statically, then at the time of compilation, the complete programs will be compiled and linked without leaving any external program or module dependency. The linker combines the object program with other necessary object modules into an absolute program, which also includes logical addresses. If you are writing a dynamically loaded program, then your compiler will compile the program and for all the modules which you want to include dynamically, only references will be provided and rest of the work will be done at the time of execution. At the time of loading, with static loading , the absolute program (and data) is loaded into memory in order for execution to start.

Almost invariably, main memory in a computer system is organized as a linear,or one- dimensional, address space, consisting of a sequence of bytes or words. Secondary memory, at its physical level, is similarly organized. While this organization closely mirrors the actual machine hardware, it does not correspond to the way in which programs are typically constructed. Most programs are organized into modules, some of which are unmodifiable (read only, execute only) and some of which contain data that may be modified. If the operating system and computer hardware can effectively deal with user programs and data in the form of modules of some sort, then a number of advantages can be realized: The tool that most readily satisfies these requirements is segmentation Physical Organization Computer memory is organized into at least two levels, referred to as main memory and secondary memory. Main memory provides fast access at relatively high cost. In addition, main memory is volatile; that is, it does not provide permanent storage. Secondary memory is slower and cheaper than main memory and is usually not volatile. Thus secondary memory of large capacity can be provided for long-term storage of programs and data, while a smaller main memory holds programs 1. Modules can be written and compiled independently, with all references from one module to another resolved by the system at run time.

2. With modest additional overhead, different degrees of protection (read only, execute only) can be given to different modules. 3. It is possible to introduce mechanisms by which modules can be shared among processes. The advantage of providing sharing on a module level is that this corresponds to the user’s way of viewing the problem, and hence it is easy for the user to specify the sharing that is desired.and data currently in use. In this two-level scheme, the organization of the flow of information between main and secondary memory is a major system concern. The responsibility for this flow could be assigned to the individual programmer, but this is impractical and undesirable for two reasons: 1. The main memory available for a program plus its data may be insufficient. In that case, the programmer must engage in a practice known as overlaying , in which the program and data are organized in such a way that various modules can be assigned the same region of memory, with a main program responsible for switching the modules in and out as needed. Even with the aid of compiler tools, overlay programming wastes programmer time. 2. In a multiprogramming environment, the programmer does not know at the time of coding how much space will be available or where that space will be. It is clear, then, that the task of moving information between the two levels of memory should be a system responsibility. This task is the essence of memory management. MEMORY MANAGEMENT TECHNIQUES Swapping Swapping is a mechanism in which a process can be swapped temporarily out of main memory (or move) to secondary storage (disk) and make that memory available to other processes. At some later time, the system swaps back the process from the secondary storage to main memory. Though performance is usually affected by swapping process but it helps in running multiple and big processes in parallel and that's the reason Swapping is also known as a technique for memory compaction.

This figure shows the swapping of two processes using a disk as a blocking store This figure shows the swapping of multiple processes using a disk as a blocking store The total time taken by swapping process includes the time it takes to move the entire process to a secondary disk and then to copy the process back to memory, as well as the time the process takes to regain main memory. Let us assume that the user process is of size 2048KB and on a standard hard disk where swapping will take place has a data transfer rate around 1 MB per second. The actual transfer of the 1000K process to or from memory will take 2048KB / 1024KB per second = 2 seconds = 200 milliseconds Now considering in and out time, it will take complete 400 milliseconds plus other overhead where the process competes to regain main memory. Memory Allocation Main memory usually has two partitions −  Low Memory − Operating system resides in this memory.  High Memory − User processes are held in high memory. Operating system uses the following memory allocation mechanism. Single-partition allocation In this type of allocation, relocation-register scheme is used to protect user processes from each other, and from changing operating-system code and data. Relocation register contains value of smallest physical address whereas limit register contains range of logical addresses. Each logical address must be less than the limit register. Multiple-partition allocation In this type of allocation, main memory is divided into a number of fixed-sized partitions where each partition should contain only one process. When a partition is

Segmentation allows the programmer to view memory as consisting of multiple address spaces or segments. Segments may be of unequal, indeed dynamic, size. Memory references consist of a (segment number, offset) form of address. This organization has a number of advantages to the programmer over a non segmented address space:

1. It simplifies the handling of growing data structures. If the programmer does not know ahead of time how large a particular data structure will become, it is necessary to guess unless dynamic segment sizes are allowed. With segmented virtual memory, the data structure can be assigned its own segment, and the OS will expand or shrink the segment as needed. If a segment that needs to be expanded is in main memory and there is insufficient room, the OS may move the segment to a larger area of main memory, if available, or swap it out. In the latter case, the enlarged segment would be swapped back in at the next opportunity. 2. It allows programs to be altered and recompiled independently, without requiring the entire set of programs to be relinked and reloaded. Again, this is accomplished using multiple segments. 3. It lends itself to sharing among processes. A programmer can place a utility program or a useful table of data in a segment that can be referenced by other processes. 4. It lends itself to protection. Because a segment can be constructed to contain a well-defined set of programs or data, the programmer or system administrator can assign access privileges in a convenient fashion. CHARACTERISTICS OF PAGING AND SEGMENTATION 1. All memory references within a process are logical addresses that are dynamically translated into physical addresses at run time. This means that a process may be swapped in and out of main memory such that it occupies different regions of main memory at different times during the course of execution. 2. A process may be broken up into a number of pieces (pages or segments) and these pieces need not be contiguously located in main memory during execution. The combination of dynamic run-time address translation and the use of a page or segment table permits this. Summary of the Characteristics of Paging and Segmentation Simple Paging Virtual Memory Paging Simple Segmentation Virtual Memory Segmentation Main memory partitioned into small fixed size chunks called frames Main memory partitioned into small fixed size chunks called frames Main memory not partitioned Main memory not Partitioned Program broken into pages by the compiler or Program broken into pages by the compiler or memory Program segments specified by the programmer to the Program segments specified by the programmer

memory management system management system compiler (i.e., the decision is made by the programmer) to the compiler (i.e., the decision is made by the programmer) No external Fragmentation No external fragmentation External fragmentation External fragmentation Operating system must maintain a page table for each process showing which frame each page occupies Operating system must maintain a page table for each process showing which frame each page occupies Operating system must maintain a segment table for each process showing the load address and length of each segment Operating system must maintain a segment table for each process showing the load address and length of each segment Operating system must maintain a free frame list Operating system must maintain a free frame list Operating system must maintain a list of free holes in main memory Operating system must maintain a list of free holes in main memory Processor uses page number, offset to calculate absolute address Processor uses page number, offset to calculate absolute address Processor uses segment number, offset to calculate absolute address Processor uses segment number, offset to calculate absolute address All the pages of a process must be in main memory for process to run, unless overlays are Used Not all pages of a process need be in main memory frames for the process to run. Pages may be read in as needed All the segments of a process must be in main memory for process to run, unless overlays are used Not all segments of a process need be in main memory for the process to run. Segments may be read in as needed Reading a page into main memory may require writing a page out to disk Reading a segment into main memory may require writing one or more segments out to disk Operation of Paging and Translation Lookaside Buffer (TLB)

process. counter external fragmentation. Simple Paging Main memory is divided into a number of equal-size frames. Each process is divided into a number of equal-size pages of the same Length as frames. A process is loaded by loading all of its pages into available, not necessarily contiguous, frames. No external fragmentation. A small amount of internal fragmentation Simple Segmenta tion Each process is divided into a number of segments. A process is loaded by loading all of its segments into dynamic partitions that need not be contiguous. No internal Fragmentation; improved memory utilization and reduced overhead Compared to dynamic partitioning. External fragmentation Virtual Memory Paging As with simple paging, except that it is not necessary to load all of the pages of a process. Nonresident pages that are needed are brought in later automatically. No external fragmentation; higher degree of multi programming; large virtual address space. Overhead of complex memory management Virtual Memory Segmenta tion As with simple segmentation, except that it is not necessary to load all of the segments of a process. Nonresident segments that are needed are brought in later automatically. No internal fragmentation, higher degree of multi programming; large virtual address space; protection and sharing support. Overhead of complex memory management Fixed Partitioning In most schemes for memory management, we can assume that the OS occupies some fixed portion of main memory and that the rest of main memory is available for use by multiple processes. The simplest scheme for managing this available memory is to partition it into regions with fixed boundaries. PARTITION SIZES the figure a and b below shows examples of two alternatives for fixed partitioning. One possibility is to make use of equal-size partitions. In this case, any process whose size is less than or equal to the partition size can be loaded into any available partition. If all partitions are full and no process is in the Ready or Running state, the operating system can swap a process out of any of the partitions and load in another process, so that there is some work for the processor. There are two difficulties with the use of equal-size fixed partitions:

  1. A program may be too big to fit into a partition. In this case, the programmer must design the program with the use of overlays so that only a portion of the program need be in main memory at any one time. When a module is needed that is not present, the user’s program must load that module into the program’s partition, overlaying whatever programs or data are there.
  2. Main memory utilization is extremely inefficient. Any program, no matter how small, occupies an entire partition. In our example, there may be a program whose length is less than 2 Mbytes; yet it occupies an 8-Mbyte partition whenever it is swapped in. This phenomenon, in which there is wasted space internal to a partition due to the fact that the block of data loaded is smaller Both of these problems can be lessened, though not solved, by using unequal size partitions (Figure b). In this example, programs as large as 16 Mbytes can be accommodated

without overlays. Partitions smaller than 8 Mbytes allow smaller programs to be accommodated with less internal fragmentation. (a) Equal-size partitions (b) Unequal-size partition Dynamic Partitioning With dynamic partitioning, the partitions are of variable length and number. When a process is brought into main memory, it is allocated exactly as much memory as it requires and no more. An example, using 64 Mbytes of main memory, is shown in Figure 3. Initially, main memory is empty, except for the OS (a). The first three processes are loaded in, starting where the operating system ends and occupying just enough space for each process (b, c, d). This leaves a “hole” at the end of memory that is too small for a fourth process. At some point, none of the processes in memory is ready. The operating system swaps out process 2 (e), which leaves sufficient room to load a new process, process 4 (f). Because process 4 is smaller than process 2, another small hole is created. Later, a point is reached at which none of the processes in main memory is ready, but process 2, in the Ready-Suspend state, is available. Because there is insufficient room in memory for process 2, the operating system swaps process 1 out (g) and swaps process 2 back in (h). As this example shows, this method starts out well, but eventually it leads to a situation in which there are a lot of small holes in memory. As time goes on, memory becomes more and more fragmented, and memory utilization declines. This phenomenon is referred to as external fragmentation , indicating that the memory that is external to all partitions becomes increasingly fragmented. This is in contrast to internal fragmentation, referred to earlier. One technique for overcoming external fragmentation is compaction : From time to time, the OS shifts the processes so that they are contiguous and so that all of the free memory is together in one block. For example, in Figure 3h , compaction to load in an additional process. The difficulty with compaction is that it is a time consuming procedure and wasteful of processor time. Note that compaction implies the need for a dynamic relocation capability. That is, it must be possible to move a program from one region to another in main memory without invalidating the memory references in the program. Operatin g system 8M 8M 8M 8M 8M 8M 8M 8M Operating system 8M 2M 4M 6M 8M 8M 12M 16M Operati ng System 8M 56M Operati ng System Process 1

 Many tables are assigned a fixed amount of address space even though only a small amount of the table is actually used.  The ability to execute a program that is only partially in memory would counter many benefits.  Less number of I/O would be needed to load or swap each user program into memory.  A program would no longer be constrained by the amount of physical memory that is available.  Each user program could take less physical memory, more programs could be run the same time, with a corresponding increase in CPU utilization and throughput. Modern microprocessors intended for general-purpose use, a memory management unit, or MMU, is built into the hardware. The MMU's job is to translate virtual addresses into physical addresses. A basic example is given below – OPERATING SYSTEM SOFTWARE The design of the memory management portion of an OS depends on three fundamental areas of choice:  Whether or not to use virtual memory techniques  The use of paging or segmentation or both  The algorithms employed for various aspects of memory management The choices made in the first two areas depend on the hardware platform available. Operating System Policies for Virtual Memory

1. Fetch Policy  Demand paging  Prepaging 2. Placement Policy  Best fit  First fit  Next fit 3. Replacement Policy Local Basic Algorithms  Optimal  Least recently used (LRU)  First-in-first-out (FIFO)  Clock Page Buffering 4. Resident Set Management

Resident set size  Fixed  Variable Replacement Scope  Global  Local

5. Cleaning Policy  Demand  Precleaning 6. Load Control  Degree of multiprogramming 1.Fetch Policy The fetch policy determines when a page should be brought into main memory. The two common alternatives are (a) Demand paging (b) Prepaging. Demand Paging With demand paging ,a page is brought into main memory only when a reference is made to a location on that page. A demand paging is similar to a paging system with swapping (Fig 4). When we want to execute a process, we swap it into memory. Rather than swapping the entire process into memory. When a process is to be swapped in, the pager guesses which pages will be used before the process is swapped out again Instead of swapping in a whole process; the pager brings only those necessary pages into memory. Thus, it avoids reading into memory pages that will not be used in anyway, decreasing the swap time and the amount of physical memory needed. Fig 4: Transfer of a paged memory to continuous disk space Prepaging With prepaging, pages other than the one demanded by a page fault are brought in. Prepaging exploits the characteristics of most secondary memory devices, such as disks, which have seek times and rotational latency. If the pages of a process are stored contiguously in secondary memory, then it is more efficient to bring in a number of contiguous pages at one time rather than bringing them in one at a time over an extended period. Of course, this policy is ineffective if most of the extra pages that are brought in are not referenced. The prepaging policy could be employed either when a process first starts up, in which case the programmer would somehow have to designate desired pages, or every time a page fault occurs. Prepaging should not be confused with swapping. When a process is swapped out of memory and put in a suspended state, all of its resident pages are

Best-fit chooses the block that is closest in size to the request. : It allocates the smallest hole that is big enough. We must search the entire list, unless the list is kept ordered by size. This strategy-produces the smallest leftover hole. First-fit begins to scan memory from the beginning and chooses the first available block that is large enough. It allocates the first hole that is big enough. Searching can start either at the beginning of the set of holes or where the previous first-fit search ended. We can stop searching as soon as we find a free hole that is large enough. Next-fit begins to scan memory from the location of the last placement, and chooses the next available block that is large enough. Fig6 example memory configuration before and after Allocation of 16-Mbyte Block The figure above shows an example memory configuration after a number of placement and swapping-out operations. The last block that was used was a 22-Mbyte block from which a 14-Mbyte partition was created. Figure 6b shows the difference between the best-, first-, and next-fit placement algorithms in satisfying a 16-Mbyte allocation request. Best-fit will search the entire list of available blocks and make use of the 18-Mbyte block, leaving a 2-Mbyte fragment. First-fit results in a 6-Mbyte fragment, and next-fit results in a 20-Mbyte fragment. Which of these approaches is best will depend on the exact sequence of process swapping that occurs and the size of those processes. However, some general comments can be made. The first-fit algorithm is not only the simplest but usually the best and fastest as well. The next-fit algorithm tends to produce slightly worse results than the first-fit. The next-fit algorithm will more frequently lead to an allocation from a free block at the end of memory. The result is that the largest block of free memory, which usually appears at the end of the memory space, is quickly broken up into small fragments.

Thus, compaction may be required more frequently with next-fit. On the other hand, the first-fit algorithm may litter the front end with small free partitions that need to be searched over on each subsequent first-fit pass. The best-fit algorithm, despite its name, is usually the worst performer. Because this algorithm looks for the smallest block that will satisfy the requirement, it guarantees that the fragment left behind is as small as possible. Although each memory request always wastes the smallest amount of memory, the result is that main memory is quickly littered by blocks too small to satisfy memory allocation requests. Thus, memory compaction must be done more frequently than with the other algorithms.

3. Page Replacement Policy Local Basic Algorithms  Optimal  Least recently used (LRU)  First-in-first-out (FIFO)  Clock Page Buffering Page replacement algorithms are the techniques inwhich an Operating System decides which memory pages to swap out, write to disk when a page of memory needs to be allocated. Paging happens whenever a page fault occurs and a free page cannot be used for allocation purpose accounting to reason that pages are not available or the number of free pages is lower than required pages. When the page that was selected for replacement and was paged out, is referenced again, it has to read in from disk, and this requires for I/O completion. This process determines the quality of the page replacement algorithm: the lesser the time waiting for page-ins, the better is the algorithm. Behavior of Four Page Replacement Algorithms The optimal policy selects for replacement that page for which the time to the next reference is the longest. It can be shown that this policy results in the fewest number of page faults. Clearly, this policy is impossible to implement, because it would require the OS to have perfect knowledge of future events. However, it does serve as a standard against which to judge real-world algorithms. Figure 7 gives an example of the optimal policy. The example assumes a fixed frame allocation (fixed resident set size) for this process of three frames. The execution of the process requires reference to five distinct pages. The page address stream formed by executing the program is 2 3 2 1 5 2 4 5 3 2 5 2 which means that the first page referenced is 2, the second page referenced is 3, and so on. The optimal policy produces three page faults after the frame allocation has been filled. The least recently used (LRU) policy replaces the page in memory that has not been referenced for the longest time. By the principle of locality, this should be the page least likely to be referenced in the near future. And, in fact, the LRU policy does nearly as well as the optimal policy. The problem with this approach is the difficulty in implementation. One approach would be to tag each page with the time of its last reference; this would have to be done at each memory reference, both instruction and data. Even if the hardware would support such a scheme, the overhead would be tremendous. Alternatively, one could maintain a stack of page references, again an expensive prospect. Figure 7 shows an example of the behavior of LRU, using the same page address stream as for the optimal policy example. In this example, there are four page faults. The first-in-first-out (FIFO) policy treats the page frames allocated to a process as a circular buffer, and pages are removed in round-robin style. All that is required is a

PAGE BUFFERING Although LRU and the clock policies are superior to FIFO, they both involve complexity and overhead not suffered with FIFO. In addition, there is the related issue that the cost of replacing a page that has been modified is greater than for one that has not, because the former must be written back out to secondary memory. An interesting strategy that can improve paging performance and allow the use of a simpler page replacement policy is page buffering.

4. Resident Set Management RESIDENT SET SIZE With paged virtual memory, it is not necessary and indeed may not be possible to bring all of the pages of a process into main memory to prepare it for execution. Thus, the OS must decide how many pages to bring in, that is, how much main memory to allocate to a particular process. Several factors come into play:

  • The smaller the amount of memory allocated to a process, the more processes that can reside in main memory at any one time. This increases the probability that the OS will find at least one ready process at any given time and hence reduces the time lost due to swapping.
  • If a relatively small number of pages of a process are in main memory, then, despite the principle of locality, the rate of page faults will be rather high.
  • Beyond a certain size, additional allocation of main memory to a particular process will have no noticeable effect on the page fault rate for that process because of the principle of locality. With these factors in mind, two sorts of policies are to be found in contemporary operating systems. A fixed-allocation policy gives a process a fixed number of frames in main memory within which to execute. That number is decided at initial load time (process creation time) and may be determined based on the type of process (interactive, batch, type of application) or may be based on guidance from the programmer or system manager. With a fixed-allocation policy, whenever a page fault occurs in the execution of a process, one of the pages of that process must be replaced by the needed page. A variable-allocation policy allows the number of page frames allocated to a process to be varied over the lifetime of the process. Ideally, a process that is suffering persistently high levels of page faults, indicating that the principle of locality only holds in a weak form for that process, will be given additional page frames to reduce the page fault rate; whereas a process with an exceptionally low page fault rate, indicating that the process is quite well behaved from a locality point of view, will be given a reduced allocation, with the hope that this will not noticeably increase the page fault rate. The use of a variable-allocation policy relates to the concept of replacement scope, as explained in the next subsection. The variable-allocation policy would appear to be the more powerful one. However, the difficulty with this approach is that it requires the OS to assess the behavior of active processes. This inevitably requires software overhead in the OS and is dependent on hardware mechanisms provided by the processor platform. REPLACEMENT SCOPE The scope of a replacement strategy can be categorized as global or local. Both types of policies are activated by a page fault when there are no free page frames. A local replacement policy chooses only among the resident pages of the process that generated the page fault in selecting a page to replace. A global replacement policy considers all unlocked pages in main memory as candidates for replacement, regardless of which process owns a particular page. While it happens that local policies are easier to analyze, there is no convincing evidence that they perform better than global policies, which are attractive because of their simplicity of implementation and minimal overhead

5. Cleaning Policy A cleaning policy is the opposite of a fetch policy; it is concerned with determining when a modified page should be written out to secondary memory. Two common alternatives are demand cleaning and precleaning. With demand cleaning , a page is written out to secondary memory only when it has been selected for replacement. A precleaning policy writes modified pages before their page frames are needed so that pages can be written out in batches. There is a danger in following either policy to the full. With precleaning, a page is written out but remains in main memory until the page replacement algorithm dictates that it be removed. Precleaning allows the writing of pages in batches, but it makes little sense to write out hundreds or thousands of pages only to find that the majority of them have been modified again before they are replaced. The transfer capacity of secondary memory is limited and should not be wasted with unnecessary cleaning operations. Summary A number of design issues relate to OS support for memory management:

  • Fetch policy: Process pages can be brought in on demand, or a prepaging policy can be used, which clusters the input activity by bringing in a number of pages at once.
  • Placement policy: With a pure segmentation system, an incoming segment must be fit into an available space in memory.
  • Replacement policy: When memory is full, a decision must be made as to which page or pages are to be replaced.
  • Resident set management: The OS must decide how much main memory to allocate to a particular process when that process is swapped in. This can be a static allocation made at process creation time, or it can change dynamically.
  • Cleaning policy: Modified process pages can be written out at the time of replacement, or a precleaning policy can be used, which clusters the output activity by writing out a number of pages at once.
  • Load control: Load control is concerned with determining the number of processes that will be resident in main memory at any given time. I/O Devices Categories of I/O Devices
  1. Human readable
  2. Machine readable
  3. Communication
  4. Human Readable is suitable for communicating with the computer user. Examples are printers, video display terminals, keyboard etc.
  5. Machine Readable is suitable for communicating with electronic equipment. Examples are disk and tape drives, sensors, controllers and actuators.
  6. Communication is suitable for communicating with remote devices. Examples are digital line drivers and modems. Differences between I/O Devices
  7. Data rate : there may be differences of several orders of magnitude between the data transfer rates.
  8. Application: Different devices have different use in the system.
  9. Complexity of Control: A disk is much more complex whereas printer requires simple control interface.
  10. Unit of transfer: Data may be transferred as a stream of bytes or characters or in larger blocks.
  11. Data representation: Different data encoding schemes are used for different devices.