In this project, you will implement a simple simulated ﬁle system. This project will let you get familiarwithimportantdatastructuresinaﬁlesystem,includingi)volumecontrolblock,ii)thedirectory structure,iii)openﬁletables(system-wideandper-process),andiv)FileControlBlock(FCB).Youwill also learn how basic ﬁle operations, such as open(), interact with these data structures. Before we describe the tasks of this project, we make the following assumptions. The simulated ﬁle system is implemented on main memory. More speciﬁcally, a slot of main memory of 1M is used to simulate a disk. We assume that a data block is of 2K. Therefore, the disk has 512 blocks. In this project, we assume the disk is a data disk, i.e., no OS installed. So the ﬁrst data block is used as the volume control block. We assume that the volume control block contains the following items:
number of blocks size of block a free-block count a bit-map of free blocks Table 1: Volume control block
Weassumethattheﬁleallocation(i.e.,datablockallocation)iscontiguousallocation. Forsimplicity, our ﬁle system uses a ﬂat directory structure to manage ﬁles. In other words, the directory contains no subdirectories. With the assumption of contiguous allocations, the content of the directory of our ﬁle system can be organized as a table as follows:
ﬁle name start block number ﬁle size ﬁle1 0 2 ﬁle3 6 3 . . . . . . . . . Table 2: Flat directory structure.
To be consistent with the contiguous allocation, the FCB contains the following items:
ﬁle size pointer to the ﬁrst data block Table 3: File control block (FCB).
A system-wide open ﬁle table is a set of FCBs of open ﬁles. An example of a system-wide open ﬁle table is shown in Table 4. Given a speciﬁc process, its per-process open ﬁle table contains a set of ﬁle handles of ﬁles opened by the process. For example, assume that a process has open ﬁles: f1 and f4, its per-process table will be the one shown in Table 5.
ﬁle name FCB f1 FCB1 f3 FCB3 f4 FCB4 Table 4: System-wide open ﬁle table.
ﬁle name handle f1 0 f4 2 Table 5: Per-process open ﬁle table. 1 PartI:Basicﬁleoperations You will need to implement the following ﬁle operations: • create(). create a ﬁle with a speciﬁed size. The size is in terms of the number of blocks. • open(). open a ﬁle, and update system-wide and per-process open ﬁle tables. • close(). close a ﬁle, and update system-wide and per-process open ﬁle tables. • read(). read a ﬁle to a local variable. • write(). Write speciﬁed content to selected free blocks. CS445Ggraduate students should implement two additional ﬁle/directory operations: • dir(). display all ﬁles in the ﬁle system. • delete(). remove a speciﬁed ﬁle from the directory. 2 PartII:Asimulation Write an application to demonstrate a sequence of ﬁle operations of different threads. A better way of simulation is based on processes rather than threads. (Recall that threads in the same process share the same open ﬁles.) But in this project, we use a thread to simulate a process to simplify your work in case that you use Java language for the implementation. The following is a sample of ﬁle operations, where p1, p2 and p3 are three pthreads. p2 and p3 should be created simultaneously after p1 is completed.
1. p1: create ﬁle1 2. P1: write ﬁle1 3. p1: close ﬁle1 4. p1: create ﬁle2
5. P1: write ﬁle2 6. p1: close ﬁle2 7. p2: open ﬁle1 8. p2: read ﬁle1 and print it in the screen 9. p2: close ﬁle1 10. p3: open ﬁle2 11. p3: read ﬁle2 and print it in the screen 12. p3: close ﬁle2
CS 445G graduate students should further test the correctness of dir() and delete() operations. For example, you can insert a dir() call in front of the above simulation and append a delete() and a dir() at the end of the above simulation. This project is a team project, and each team can have up to 2 students. You can use C/C++ or Java to implement this project. But if you use Java, keep in mind to demonstrate the simulation with multi-threading Java programming.
Onsubmission: Submit your source code and readme to blackboard. The source code should be well-documented, i.e., having good readability. The readme ﬁle should summarize: i) tasks that you completed, and ii) tasks that you did not complete.
16 freelanceria on tarjonnut keskimäärin %project_bid_stats_avg_sub_26% %project_currencyDetails_sign_sub_27% tähän työhön
Hello, we are qualified software engineers and especially doing simulation in C and Java. We know the work involved in it if given an opportunity. will deliver the best in given time frame. Thanks & regards Techies
strong knowledge of data structures and algorithms, extensive C/C++ development experience, ability to contribute to all levels of software development