Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please write in C++ In this project, you will develop a simple File System. We assume that we have a physical medium with following properties:

Please write in C++

image text in transcribed

image text in transcribed

In this project, you will develop a simple File System. We assume that we have a physical medium with following properties: 20 Sectors, 64KB each Erase operation can be performed either on a single sector or on the whole physical medium (i.e., all 20 sectors). Erase operation sets all bits of the sector(s) to 1. Write operation can be performed only in words and on a word boundary (word is defined as 2 bytes). Write operation can set bits to 0, but cannot set bits to 1, i.e., it is equal to the AND operation between the word on the "physical medium" and the word which should be written. * Addressing is "flat" beginning with the 0 byte of the first sector Program requirements Programming languages: C/C++ only Compilation: Windows OS/ MS Visual Studio Execution: Windows OS Part 1 In first project, following "driver" operations (functions) should be implemented EraseSector (int nSectorNr) EraseAllSectors ( ReadWord (int nAddress) WriteWord (int nAddress, nWord) It is your responsibility to decide whether these functions are void or return value, and which one. The "physical medium" is simulated using a binary file which you should create (e.g., if any of the "driver" functions is called and file is not present) Part 1 Implement following "driver" operations (functions) operating on a simulated memory device: Function EraseAllSectors EraseSector (nSectorNr) Description Sets all bits in all sectors in simulated memory to value 1. If necessary, create the file simulating the medium Sets all bits in the specified sector to 1. Sector numbers are 0-19 If file simulating simulated memory is not present, EraseAllSectors is executed first Reads a WORD (2 bytes) from the specified address. ReadWord (nAddress) nAddress-address of the WORD to be read. Address is the offset from the beginning of the simulated memory (i.e., byte 0 in Sector 0) and not from the particular sector. Address should be on the WORD boundary, i.e., addresses 0, 2, , 2n are valid, addresses 1, 3, ..., 2n-1 are not. If specified address is not WORD aligned or is outside the size of the simulated medium, this operation should fail. Writes a WORD (2 bytes) to the specified address. WriteWord (nAddress, nWord) nAddress- address in which the WORD should be written nWord- WORD to be written in the specified address If specified address is not WORD aligned or is outside the size of the simulated memory, this operation should fail, i.e., no information should be written in the simulated memory If address is valid, the value written in the specified address should be equal to nWord AND ReadWord (nAddress) Whether this function returns value or not and what is the meaning of the returned value is a decision you should make In this project, you will develop a simple File System. We assume that we have a physical medium with following properties: 20 Sectors, 64KB each Erase operation can be performed either on a single sector or on the whole physical medium (i.e., all 20 sectors). Erase operation sets all bits of the sector(s) to 1. Write operation can be performed only in words and on a word boundary (word is defined as 2 bytes). Write operation can set bits to 0, but cannot set bits to 1, i.e., it is equal to the AND operation between the word on the "physical medium" and the word which should be written. * Addressing is "flat" beginning with the 0 byte of the first sector Program requirements Programming languages: C/C++ only Compilation: Windows OS/ MS Visual Studio Execution: Windows OS Part 1 In first project, following "driver" operations (functions) should be implemented EraseSector (int nSectorNr) EraseAllSectors ( ReadWord (int nAddress) WriteWord (int nAddress, nWord) It is your responsibility to decide whether these functions are void or return value, and which one. The "physical medium" is simulated using a binary file which you should create (e.g., if any of the "driver" functions is called and file is not present) Part 1 Implement following "driver" operations (functions) operating on a simulated memory device: Function EraseAllSectors EraseSector (nSectorNr) Description Sets all bits in all sectors in simulated memory to value 1. If necessary, create the file simulating the medium Sets all bits in the specified sector to 1. Sector numbers are 0-19 If file simulating simulated memory is not present, EraseAllSectors is executed first Reads a WORD (2 bytes) from the specified address. ReadWord (nAddress) nAddress-address of the WORD to be read. Address is the offset from the beginning of the simulated memory (i.e., byte 0 in Sector 0) and not from the particular sector. Address should be on the WORD boundary, i.e., addresses 0, 2, , 2n are valid, addresses 1, 3, ..., 2n-1 are not. If specified address is not WORD aligned or is outside the size of the simulated medium, this operation should fail. Writes a WORD (2 bytes) to the specified address. WriteWord (nAddress, nWord) nAddress- address in which the WORD should be written nWord- WORD to be written in the specified address If specified address is not WORD aligned or is outside the size of the simulated memory, this operation should fail, i.e., no information should be written in the simulated memory If address is valid, the value written in the specified address should be equal to nWord AND ReadWord (nAddress) Whether this function returns value or not and what is the meaning of the returned value is a decision you should make

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

What are the various ways the LCM determination can be made?

Answered: 1 week ago