First-Fit
The process for entering a process using the first-fit algorithm was to find the first available partition that the memory could fit into. Although this may have been the quickest way to allocate a process to an open partition, it was not the most ideal. The process is written in an open partition regardless of the total amount of memory that was available. This is not the most efficient way to store processes because the algorithm may write into a partition that could have later been occupied by a larger process. However, this algorithm, overall, is better than the worst fit algorithm in the fact that it was able to store more of the assigned processes.Best-Fit
The best fit method was the most efficient algorithm. This is because the algorithm is trying to find the smallest partition that the process can be stored in. Doing so provides the most leftover memory that an additional process can be stored in. However, this may not be the quickest solution as each partition will need to be scanned to determine the best possible final location. Looking at the breakdown below it is easy to see how this algorithm has not only been able to store all the listed processes, but it was also able to leave the most available space remaining.
Worst-Fit
The worst-fit algorithm, unsurprisingly, is the worst algorithm. Not only is it not the quickest, but it is also the least efficient. This algorithm sets out to store a process in the least efficient way possible. For example, it has stored the 21 KB process in the 500 KB partition. The best partition the 22 KB process should have been stored in was the 35 KB partition. This algorithm also prevents larger processes from being stored such as the 489 KB and 302 KB partition as shown below.
Throughout all of the algorithms, it was important to store the initial process and then determine the leftover space and so on. Doing so will show the available free space remaining in the partition as there may be a process that can be stored in that space later. This was especially evident with the first-fit and worst-fit algorithms as there were instances where numerous processes were able to fit into the same partition after they were broken down. What I found interesting was how large the partitions could potentially be in terms of length when even more processes are added in addition to the ones that were assigned. In my opinion I would rather have the best-fit algorithm store my processes because that way I know I would have the most amount of available space even though it is not the quickest option. I cannot think of a single instance where a user would want to use any algorithm other than the best-fit algorithm. Overall, I think that this assignment was a great way to show how processes are stored and what the algorithm is looking for in order to operate correctly.
References:
Silberschatz, A., Galvin, P.B., & Gagne, G. (2014). Operating System Concept Essentials (2nd
ed.). Retrieved from https://redshelf.com/
GeeksforGeeks. (2021, June 28). Thread in operating system. GeeksforGeeks. Retrieved January
10, 2022, from https://www.geeksforgeeks.org/threadinoperatingsystem/
Comments
Post a Comment