Operating System lab report 05
Operating System lab report 05
Lab Report NO # 05
Course Title: Operating System Lab
Course Code: CSE 310 Section: D28
Student Details
Name ID
2. OBJECTIVES
3. PROCEDURE
Algorithm:
First, I create the make directory using this command(mkdir) in linux terminal.
And then Enter the directory and create a file using (nano) command. Give the permission using
(chmod) for execution. And for the Output use (gcc -o) command.
Source C code:
#include <stdio.h>
#define max 25
void main() {
int frag[max], b[max], f[max], i, j, nb, nf, temp;
int bf[max], ff[max];
We can see here, file no and their size and block no and block size and fragment.
Inside the nano text Editor:
In discussion, this problem addresses the implementation of the first fit contiguous memory
allocation algorithm in C, which is used in operating systems for managing memory. The
algorithm involves allocating each file to the first available block of memory that is large
enough to accommodate it. This approach ensures simplicity and efficiency in memory
allocation by sequentially searching for the first suitable block, minimizing the search time.
The program also calculates and displays the resulting fragmentation, providing insight
into memory utilization and wasted space. The implementation involves initializing data
structures, taking user inputs for block and file sizes, performing the allocation, and finally
presenting the allocation results in a clear format.