Labels

C program for C-SCAN disk scheduling algorithm

                  Circular SCAN (C-SCAN) scheduling is a variant of SCAN designed to provide a more uniform wait time. Like SCAN, C-SCAN moves the head from one end of the disk to the other, servicing requests along the way. When the head reaches the other end, however, it immediately returns to the beginning of the disk without servicing any requests on the return trip (Figure 10.7). The C-SCAN scheduling algorithm essentially treats the cylinders as a circular list that wraps around from the final cylinder to the first one.Read more>>

C program for SCAN disk scheduling algorithm

                        In the SCAN algorithm, the disk arm starts at one end of the disk and moves toward the other end,servicing requests as it reaches each cylinder,until it gets to the other end of the disk. At the other end, the direction of head movement is reversed, and servicing continues. The head continuously scans back and forth across the disk. The SCAN algorithm is sometimes called the elevator algorithm, since the disk arm behaves just like an elevator in a building, first servicing all the requests going up and then reversing to service requests the other way. Read more>>

C program for FCFS disk scheduling algorithm

                          The simplest form of disk scheduling is, of course, the first-come, first-served (FCFS) algorithm. This algorithm is intrinsically fair, but it generally does not provide the fastest service. Consider, for example, a disk queue with requests for I/O to blocks on cylinders 98, 183, 37, 122, 14, 124, 65, 67. If the disk head is initially at cylinder 53, it will first move from 53 to 98, then to 183, 37, 122, 14, 124, 65, and finally to 67, for a total head movement of 640 cylinders.
Read more>> 

C program for worst fit memory management algorithm

                          Allocate the largest hole. Again, we must search the entire list, unless it is sorted by size. This strategy produces the largest left over hole, which may be more useful than the smaller leftover hole from a best-fit approach.Read more>>

C program for best fit memory management algorithm

                             Allocate the smallest hole that is big enough. We must search the entire list, unless the list is ordered by size. This strategy produces the smallest left over hole.Read more>>

C program for first fit memory management algorithm

                        Allocate the first hole that is big enough.Searching can start either at the beginning of the set of holes or at the location where the previous first-fit search ended.We can stop searching as soon as we find a free hole that is large enough.Read more>>

C program for LFU page replacement algorithm

                       The least frequently used(LFU) page-replacement algorithm requires that the page with the smallest count be replaced. The reason for this selection is that an actively used page should have a large reference count. A problem arises, however, when a page is used heavily during the initial phase of a process but then is never used again. Since it was used heavily, it has a large count and remains in memory even though it is no longer needed. One solution is to shift the counts right by1bit at regular intervals,forming an exponentially decaying average usage count.Read more>>