This is a programming assignment from a unit called Operating Systems programming its mainly like C programming. for writing codes: A virtual machine has been created that can be used to work on the...

1 answer below »
This is a programming assignment from a unit called Operating Systems programming its mainly like C programming. for writing codes: A virtual machine has been created that can be used to work on the Problem Case Studies. It is a Virtual Box Appliance, and can be imported into a Virtual Box installation. It is a stripped down 64-bit Ubuntu Linux 20.04 LTS, that has all the necessary tools and not much else. It is configured to use auto-configured NAT networking and thus should "Just Work!". If necessary, the pre-configured username is "user" and the password for that user is "password" (the worlds most popular password!). This user is capable of administrating the machine, so please don't connect it directly to the Internet as it isn't that secure, however the default network configuration is safe. It safe to use the web-browser on this virtual machine. If the virtual machine is too slow, shut it down and increase the memory allocation in virtual box. The Virtual Box Appliance is available for download here. It is a ~2Gb file, and has an SHA1 check sum of 3c265e4b5a8ef0d9d86f6d1fb226895ed3e7fdfc -- Virtual box version 6 ////don't forget to include comments in the codes /////


Practical Case Study E Operating Systems Programming – 300698 1 Introduction In this workshop you will be implementing a file system simulator, loosely based on historic file systems. The file system will be have the following properties: • it is a single level directory system. • the directory entry has the following format: struct entry { int8_t user; char name[9]; char extension[4]; int16_t blockcount; int16_t block[24]; }; With the name and extension fields being C style strings (Please note that you can usechar andint8_t interchangably). This structure is 64 bytes in size. • The disk size is 170 kbyte. (This is Commodore 8-bit Double Density 5 14 ′′ inch disk.) • The smallest unit of allocation is 256 bytes. • The main directory occupies the first 8 blocks of the disk (blocks 0–7), and its size is fixed, so there there are 32 files in this file system. • No control information about it needs to be stored in the directory (i.e. no . entry). • the only user is user 1 • user −1 is not a valid user, and could be used to mark free directory entries. • alongside the directory you also need a bitmap that is capable of representing all of the blocks available on the disk, this can be a free space bitmap or an allocation bitmap, this is your choice. This structure is not stored on the disk but would be computed by the operating system when the disk was inserted. Your bitmap will need to track the directory blocks, so they are not allocated to another file. You are not supposed to implement the actual storage, only the control structures of the file system. When implementing the free bitmap you must use a bitmap, i.e. it should be an array, but each element of the array should represent several blocks. 1 2 Programming Tasks When your program starts, it will assume that the disk is unformatted, you should provide a menu that implements the following options: Initialise Disk initialise disk control structures, setting the blocks allocated for the bitmap to used, and marking all directory entries as being available. List Files in the Directory List the names, extensions and block counts of all the valid files in the directory. Display the Free Bitmap print the value of each of the bits in the bitmap. This need not be pretty, just a long list of 1’s and 0’s is sufficient Open/Create File scans the directory and if the name provided doesn’t exist then adds that file to the directory. This file will must be used in all subsequent operations until a new file is open/created or it is deleted. Read File list the blocks occupied by the currently open file (not the content of these blocks as you don’t store this information) Write File allocate another block to the currently open file. You should not preallocate blocks for the file, you should allocate the first available block, by scanning the bitmap for the first block that is available. Each write shall add another block to the file until there are no more slots to allocate blocks to, or the disk runs out of blocks. (There are only 24 slots available for each file.) Delete File deallocate all blocks for the current file in the bitmap, and marks as free the directory entry for that file You need to pay close attention to multiple boundary conditions, which exist in this file system, including the total size of the disk, maximum size of a file, maximum number of files etc. 2 3 File: fs.h /* fs.h * Various definitions for OSP Practical Case Study E */ #ifndef FS_H #define FS_H /* Prevent multiple inclusion */ #include /* The bitmap */ extern uint8_t bitmap[85]; /* 170Kb disk with 256b blocks-> 680 bits for bitmap -> 85 bytes */ /* The directory entry */ struct entry { int8_t user; char name[9]; char extension[4]; int16_t blockcount; int16_t block[24]; }; /* The Directory */ extern struct entry directory[32]; /* extern means its defined in another file, prevents multiple definition errors */ int toggle_bit(int block); /* Toggles the value of the bit ’block’, in the external array ’bitmap’. returns the current value of the bit Does NOT validate ’block’!!! */ int block_status(int block); /* Returns the status of ’block’, in the external array bitmap returns 0 if bitmap bit is 0, not 0 if bitmap bit is 1 Does NOT validate block!!! */ #endif 3 4 File: fs.c /* fs.c Some useful functions for OSP Practical Case Study E */ #include"fs.h" uint8_t bitmap[85]; struct entry directory[32]; int toggle_bit(int block) { int elem=block/8; int pos=block%8; int mask=1 /* stdio.h will be found in the system path */ #include"fs.h" /* fs.h will be found in the local path */ int main(int ac, char**av) { printf("Please make me useful\n"); return 0; } 4 6 File: makefile all: caseE caseE: main.o fs.o $(CC) -o $@ $ˆ 5 Introduction Programming Tasks File: fs.h File: fs.c File: main.c File: makefile A virtual machine has been created that can be used to work on the Problem Case Studies.  It is a Virtual Box Appliance, and can be imported into a Virtual Box installation. It is a stripped down 64-bit Ubuntu Linux 20.04 LTS, that has all the necessary tools and not much else. It is configured to use auto-configured NAT networking and thus should "Just Work!". If necessary, the pre-configured username is "user" and the password for that user is "password" (the worlds most popular password!). This user is capable of administrating the machine, so please don't connect it directly to the Internet as it isn't that secure, however the default network configuration is safe. It safe to use the web-browser on this virtual machine. If the virtual machine is too slow, shut it down and increase the memory allocation in virtual box. The Virtual Box Appliance is available for download here. It is a ~2Gb file, and has an SHA1 check sum of 3c265e4b5a8ef0d9d86f6d1fb226895ed3e7fdfc
Answered 9 days AfterMay 23, 2022

Answer To: This is a programming assignment from a unit called Operating Systems programming its mainly like C...

Jahir Abbas answered on May 26 2022
87 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here