SlideShare a Scribd company logo
1 of 12
There are 4 parts for the project. The question may be long to
read but it's not a heavy work because there are many examples
and explanations for the each parts.*Part 1. The first part of
this project requires that you implement a class that will be
used to simulate a disk drive. The disk drive will have
numberofblocks
many blocks where each block has
blocksize
many bytes. The interface for the class
Sdisk
should include :
Class Sdisk
{
public :
Sdisk(string diskname, int numberofblocks, int blocksize);
int getblock(int blocknumber, string& buffer);
int putblock(int blocknumber, string buffer);
int getnumberofblocks(); // accessor function
int getblocksize(); // accessor function
private :
string diskname; // file name of software-disk
int numberofblocks; // number of blocks on disk
int blocksize; // block size in bytes
};
An explanation of the member functions follows :
Sdisk(diskname, numberofblocks, blocksize) This constructor
incorporates the creation of the disk with the "formatting" of
the device. It accepts the integer values
numberofblocks
,
blocksize
, a string
diskname
and creates a Sdisk (software-disk). The Sdisk is a file of
characters which we will manipulate as a raw hard disk drive.
The function will check if the file
diskname
exists. If the file exists, it is opened and treated as a Sdisk with
numberofblocks
many blocks of size
blocksize
. If the file does not exist, the function will create a file called
diskname
which contains
numberofblocks*blocksize
many characters. This file is logically divided up into
numberofblocks
many blocks where each block has
blocksize
many characters. The text file will have the following structure
:
-figure 0 (what I
attached below)
getblock(blocknumber,buffer) retrieves block
blocknumber
from the disk and stores the data in the string
buffer
. It returns an error code of 1 if successful and 0 otherwise.
putblock(blocknumber,buffer) writes the string
buffer
to block
blocknumber
. It returns an error code of 1 if successful and 0 otherwise.
IMPLEMENTATION GUIDELINES
: It is essential that your software satisfies the specifications.
These will be the only functions (in your system) which
physically access the Sdisk.
NOTE
that you must also write drivers to test and demonstrate your
program.*Part 2. The second part of this project requires that
you implement a simple file system. In particular, you are going
to write the software which which will handle dynamic file
management. This part of the project will require you to
implement the class
Filesys
along with member functions. In the description below, FAT
refers to the
File Allocation Table
and ROOT refers to the
Root Directory
. The interface for the class should include :
Class Filesys: public Sdisk
{
Public :
Filesys(string diskname, int numberofblocks, int blocksize);
int fsclose();
int fssynch();
int newfile(string file);
int rmfile(string file);
int getfirstblock(string file);
int addblock(string file, string block);
int delblock(string file, int blocknumber);
int readblock(string file, int blocknumber, string& buffer);
int writeblock(string file, int blocknumber, string buffer);
int nextblock(string file, int blocknumber);
Private :
int rootsize; // maximum number of entries in ROOT
int fatsize; // number of blocks occupied by FAT
vector filename; // filenames in ROOT
vector firstblock; // firstblocks in ROOT
vector fat; // FAT
};
An explanation of the member functions follows :
Filesys() This constructor reads from the sdisk and either opens
the existing file system on the disk or creates one for an empty
disk. Recall the sdisk is a file of characters which we will
manipulate as a raw hard disk drive. This file is logically
divided up into number_of_blocks many blocks where each
block has block_size many characters. Information is first read
from block 1 to determine if an existing file system is on the
disk. If a filesystem exists, it is opened and made available.
Otherwise, the file system is created.The module creates a file
system on the sdisk by creating an intial FAT and ROOT. A file
system on the disk will have the following segments:
-figure 1 (what I
attached below)
consists of two primary data objects. The directory is a file that
consists of information about files and sub-directories. The root
directory contains a list of file (and directory) names along with
a block number of the first block in the file (or directory). (Of
course, other information about the file such as creation date,
ownership, permissions, etc. may also be maintained.) ROOT
(root directory) for the above example may look something like
-figure 2 (what I attached
below) The FAT is an array of block numbers indexed one
entry for every block. Every file in the file system is made up of
blocks, and the component blocks are maintained as linked lists
within the FAT. FAT[0], the entry for the first block of the
FAT, is used as a pointer to the first free (unused) block in the
file system. Consider the following FAT for a file system with
16 blocks.
-figure 3 (what I attached
below)
In the example above, the FAT has 3 files. The free list of
blocks begins at entry 0 and consists of blocks 6, 8, 13, 14, 15.
Block 0 on the disk contains the root directory and is used in
the FAT for the free list. Block 1 and Block 2 on the disk
contains the FAT. File 1 contains blocks 3, 4 and 5; File 2
contains blocks 7 and 9; File 3 contains blocks 10, 11, and 12.
Note that a "0" denotes the end-of-file or "last block".
PROBLEM : What should the value of
FAT_size
be in terms of blocks if a file system is to be created on the
disk? Assume that we use a decimal numbering system where
every digit requires one byte of information and is in the set
[0..9].
Both FAT and ROOT are stored in memory AND on the disk.
Any changes made to either structure in memory must also be
immediately written to the disk.
fssynch This module writes FAT and ROOT to the sdisk. It
should be used every time FAT and ROOT are modified.
fsclose This module writes FAT and ROOT to the sdisk (closing
the sdisk).
newfile(file) This function adds an entry for the string
file
in ROOT with an initial first block of 0 (empty). It returns
error codes of 1 if successful and 0 otherwise (no room or file
already exists).
rmfile(file) This function removes the entry
file
from ROOT if the file is empty (first block is 0). It returns
error codes of 1 if successful and 0 otherwise (not empty or file
does not exist).
getfirstblock(file) This function returns the block number of the
first block in file. It returns the error code of 0 if the file does
not exist.
addblock(file,buffer) This function adds a block of data stored
in the string
buffer
to the end of file F and returns the block number. It returns
error code 0 if the file does not exist, and returns -1 if there are
no available blocks (file system is full!).
delblock(file,blocknumber) The function removes block
numbered blocknumber from file and returns an error code of 1
if successful and 0 otherwise.
readblock(file,blocknumber,buffer) gets block numbered
blocknumber from file and stores the data in the string buffer. It
returns an error code of 1 if successful and 0 otherwise.
writeblock(file,blocknumber,buffer) writes the buffer to the
block numbered blocknumber in file. It returns an appropriate
error code.
nextblock(file,blocknumber) returns the number of the block
that follows blocknumber in file. It will return 0 if blocknumber
is the last block and -1 if some other error has occurred (such as
file is not in the root directory, or blocknumber is not a block in
file.)
IMPLEMENTATION GUIDELINES
: It is essential that your software satisfies the specifications.
These will be the only functions (in your system) which
physically access the sdisk.
*Part 3. The third part of this project requires that you
implement a simple shell that uses your file system. This part of
the project will require you to implement the class
Shell
along with member functions. The interface for the class should
include :
class Shell: public Filesys
{
Public :
Shell(string filename, int blocksize, int numberofblocks);
int dir();// lists all files
int add(string file);// add a new file using input from the
keyboard
int del(string file);// deletes the file
int type(string file);//lists the contents of file
int copy(string file1, string file2);//copies file1 to file2
};
An explanation of the member functions follows :
Shell(string filename, int blocksize, int numberofblocks): This
will create a shell object using the Filesys on the file filename.
int dir(): This will list all the files in the root directory.
int add(string file): add a new file using input from the
keyboard
int del(string file): deletes the file
int type(string file): lists the contents of file
int copy(string file1, string file2): copies file1 to file2
IMPLEMENTATION GUIDELINES
:See the figure 4 (what I attached below) for the
ls
function of Filesys.See the figure 5 (what I attached below) for
dir
function of Shell. See the figure 6 (what I attached below) for
main
program of Shell.*Part 4. In this part of the project, you are
going to create a database system with a single table which uses
the file system from Project II. The input file will consist of
records associated with Art History. The data file you will use
as input consists of records with the following format: The data
(180 records) is in date.txt file (what I attached below)
Date : 5 bytes
End : 5 bytes
Type : 8 bytes
Place : 15 bytes
Reference : 7 bytes
Description : variable
In the data file, an asterisk is also used to delimit each field and
the last character of each record is an asterisk. The width of any
record is never greater than 120 bytes. Therefore you can block
the data accordingly. This part of the project will require you to
implement the following class:
Class Table : Public Filesys
{
Public :
Table(string diskname,int blocksize,int numberofblocks, string
flatfile, string indexfile);
int Build_Table(string input_file);
int Search(string value);
Private :
string flatfile;
string indexfile;
int IndexSearch(string value);
};
The member functions are specified as follows :
Table(diskname,blocksize,numberofblocks,flatfile,indexfile)
This constructor creates the table object. It creates the new
(empty) files
flatfile
and
indexfile
in the file system on the Sdisk using
diskname
.
Build_Table(input_file) This module will read records from the
input file (the raw data file described above), add the records to
the flatfile and create index records consisting of the date and
block number, and then add the index records to the index file.
(Note that index records will have 10 bytes .. 5 bytes for the
date and 5 bytes for the block number.)
Search(value) This module accepts a key value, and searches the
index file with a call to
IndexSearch
for the record where the date matches the specified value.
IndexSearch
returns the blocknumber of the block in the flat file where the
target record is located. This block should then be read and the
record displayed.
IndexSearch(value) This module accepts a key value, and
searches the index file
indexfile
for the record where the date matches the specified value.
IndexSearch then returns the block number key of the index
record where the match occurs.
See the figure 7 (what I attached below) for the
main
program of Shell which includes a search command.

More Related Content

Similar to There are 4 parts for the project. The question may be long to read .docx

Internal representation of files ppt
Internal representation of files pptInternal representation of files ppt
Internal representation of files pptAbhaysinh Surve
 
Lab6FolderF1GraphicPic.pdfPicture of OS Lab.docx
Lab6FolderF1GraphicPic.pdfPicture of OS  Lab.docxLab6FolderF1GraphicPic.pdfPicture of OS  Lab.docx
Lab6FolderF1GraphicPic.pdfPicture of OS Lab.docxsmile790243
 
Programming Embedded linux
Programming Embedded linuxProgramming Embedded linux
Programming Embedded linuxLiran Ben Haim
 
File management
File managementFile management
File managementMohd Arif
 
TLPI Chapter 14 File Systems
TLPI Chapter 14 File SystemsTLPI Chapter 14 File Systems
TLPI Chapter 14 File SystemsShu-Yu Fu
 
Filesystemimplementationpre final-160919095849
Filesystemimplementationpre final-160919095849Filesystemimplementationpre final-160919095849
Filesystemimplementationpre final-160919095849marangburu42
 
INput output stream in ccP Full Detail.pptx
INput output stream in ccP Full Detail.pptxINput output stream in ccP Full Detail.pptx
INput output stream in ccP Full Detail.pptxAssadLeo1
 
Win98 System File Details
Win98 System File DetailsWin98 System File Details
Win98 System File DetailsSais Abdelkrim
 
File System and File allocation tables
File System and File allocation tablesFile System and File allocation tables
File System and File allocation tablesshashikant pabari
 

Similar to There are 4 parts for the project. The question may be long to read .docx (20)

Internal representation of files ppt
Internal representation of files pptInternal representation of files ppt
Internal representation of files ppt
 
File and fat 2
File and fat 2File and fat 2
File and fat 2
 
History
HistoryHistory
History
 
Lab6FolderF1GraphicPic.pdfPicture of OS Lab.docx
Lab6FolderF1GraphicPic.pdfPicture of OS  Lab.docxLab6FolderF1GraphicPic.pdfPicture of OS  Lab.docx
Lab6FolderF1GraphicPic.pdfPicture of OS Lab.docx
 
File and fat
File and fatFile and fat
File and fat
 
Programming Embedded linux
Programming Embedded linuxProgramming Embedded linux
Programming Embedded linux
 
My History
My HistoryMy History
My History
 
File management
File managementFile management
File management
 
TLPI Chapter 14 File Systems
TLPI Chapter 14 File SystemsTLPI Chapter 14 File Systems
TLPI Chapter 14 File Systems
 
Filesystemimplementationpre final-160919095849
Filesystemimplementationpre final-160919095849Filesystemimplementationpre final-160919095849
Filesystemimplementationpre final-160919095849
 
Edubooktraining
EdubooktrainingEdubooktraining
Edubooktraining
 
Unix Administration 4
Unix Administration 4Unix Administration 4
Unix Administration 4
 
Lab 1 Essay
Lab 1 EssayLab 1 Essay
Lab 1 Essay
 
File system implementation
File system implementationFile system implementation
File system implementation
 
Smiley011
Smiley011Smiley011
Smiley011
 
INput output stream in ccP Full Detail.pptx
INput output stream in ccP Full Detail.pptxINput output stream in ccP Full Detail.pptx
INput output stream in ccP Full Detail.pptx
 
FILES IN C
FILES IN CFILES IN C
FILES IN C
 
DFSNov1.pptx
DFSNov1.pptxDFSNov1.pptx
DFSNov1.pptx
 
Win98 System File Details
Win98 System File DetailsWin98 System File Details
Win98 System File Details
 
File System and File allocation tables
File System and File allocation tablesFile System and File allocation tables
File System and File allocation tables
 

More from susannr

Theory Into Practice Four Social Work Case Studies In this co.docx
Theory Into Practice Four Social Work Case Studies In this co.docxTheory Into Practice Four Social Work Case Studies In this co.docx
Theory Into Practice Four Social Work Case Studies In this co.docxsusannr
 
Theory applied to informatics – Novice to Expertcjni.netjou.docx
Theory applied to informatics – Novice to Expertcjni.netjou.docxTheory applied to informatics – Novice to Expertcjni.netjou.docx
Theory applied to informatics – Novice to Expertcjni.netjou.docxsusannr
 
Theorizing LeadershipTrait Theory- how tall someone is, hair, .docx
Theorizing LeadershipTrait Theory- how tall someone is, hair, .docxTheorizing LeadershipTrait Theory- how tall someone is, hair, .docx
Theorizing LeadershipTrait Theory- how tall someone is, hair, .docxsusannr
 
THEORY & REVIEWTHEORIZING THE DIGITAL OBJECT1Philip Fa.docx
THEORY & REVIEWTHEORIZING THE DIGITAL OBJECT1Philip Fa.docxTHEORY & REVIEWTHEORIZING THE DIGITAL OBJECT1Philip Fa.docx
THEORY & REVIEWTHEORIZING THE DIGITAL OBJECT1Philip Fa.docxsusannr
 
Theory Analysis Assignment this assignment is another interview…but.docx
Theory Analysis Assignment this assignment is another interview…but.docxTheory Analysis Assignment this assignment is another interview…but.docx
Theory Analysis Assignment this assignment is another interview…but.docxsusannr
 
Theory and the White-Collar OffenderOur previous week’s disc.docx
Theory and the White-Collar OffenderOur previous week’s disc.docxTheory and the White-Collar OffenderOur previous week’s disc.docx
Theory and the White-Collar OffenderOur previous week’s disc.docxsusannr
 
Theory & Research in Social Education, 44 565–607, 2016Copy.docx
Theory & Research in Social Education, 44 565–607, 2016Copy.docxTheory & Research in Social Education, 44 565–607, 2016Copy.docx
Theory & Research in Social Education, 44 565–607, 2016Copy.docxsusannr
 
THEO 650 Book Review Grading RubricCriteriaLevels of Achieveme.docx
THEO 650 Book Review Grading RubricCriteriaLevels of Achieveme.docxTHEO 650 Book Review Grading RubricCriteriaLevels of Achieveme.docx
THEO 650 Book Review Grading RubricCriteriaLevels of Achieveme.docxsusannr
 
Theories of Poverty DiscussionTheories explain phenomena and pre.docx
Theories of Poverty DiscussionTheories explain phenomena and pre.docxTheories of Poverty DiscussionTheories explain phenomena and pre.docx
Theories of Poverty DiscussionTheories explain phenomena and pre.docxsusannr
 
Theories help frame more than presenting problems—they also frame so.docx
Theories help frame more than presenting problems—they also frame so.docxTheories help frame more than presenting problems—they also frame so.docx
Theories help frame more than presenting problems—they also frame so.docxsusannr
 
Theories of LeadershipInstructionsWrite a 4–5 page paper.docx
Theories of LeadershipInstructionsWrite a 4–5 page paper.docxTheories of LeadershipInstructionsWrite a 4–5 page paper.docx
Theories of LeadershipInstructionsWrite a 4–5 page paper.docxsusannr
 
Theories in SociologyAssignment OverviewThis writing assignm.docx
Theories in SociologyAssignment OverviewThis writing assignm.docxTheories in SociologyAssignment OverviewThis writing assignm.docx
Theories in SociologyAssignment OverviewThis writing assignm.docxsusannr
 
Theories of LeadershipMany schools of thought have developed t.docx
Theories of LeadershipMany schools of thought have developed t.docxTheories of LeadershipMany schools of thought have developed t.docx
Theories of LeadershipMany schools of thought have developed t.docxsusannr
 
THEORIES OF INTELLECTUAL DEVELOPMENTPiaget’s TheoryWe begin wi.docx
THEORIES OF INTELLECTUAL DEVELOPMENTPiaget’s TheoryWe begin wi.docxTHEORIES OF INTELLECTUAL DEVELOPMENTPiaget’s TheoryWe begin wi.docx
THEORIES OF INTELLECTUAL DEVELOPMENTPiaget’s TheoryWe begin wi.docxsusannr
 
Theories of Maladaptive BehaviorLocate at least two peer-rev.docx
Theories of Maladaptive BehaviorLocate at least two peer-rev.docxTheories of Maladaptive BehaviorLocate at least two peer-rev.docx
Theories of Maladaptive BehaviorLocate at least two peer-rev.docxsusannr
 
Theories help frame more than presenting problems—they also fram.docx
Theories help frame more than presenting problems—they also fram.docxTheories help frame more than presenting problems—they also fram.docx
Theories help frame more than presenting problems—they also fram.docxsusannr
 
THEORETICAL REVIEW Please read through these extensive assignmen.docx
THEORETICAL REVIEW Please read through these extensive assignmen.docxTHEORETICAL REVIEW Please read through these extensive assignmen.docx
THEORETICAL REVIEW Please read through these extensive assignmen.docxsusannr
 
Theoretical Medicine & Bioethics, 35, 31-42. To Treat a Psyc.docx
Theoretical Medicine & Bioethics, 35, 31-42. To Treat a Psyc.docxTheoretical Medicine & Bioethics, 35, 31-42. To Treat a Psyc.docx
Theoretical Medicine & Bioethics, 35, 31-42. To Treat a Psyc.docxsusannr
 
THEORETICAL FRAMEWORK FOR A FAMILY AND PALLIATIVE NURS.docx
THEORETICAL FRAMEWORK FOR A FAMILY AND PALLIATIVE NURS.docxTHEORETICAL FRAMEWORK FOR A FAMILY AND PALLIATIVE NURS.docx
THEORETICAL FRAMEWORK FOR A FAMILY AND PALLIATIVE NURS.docxsusannr
 
Theoretical PerspectivesSince Childrens Literature is written f.docx
Theoretical PerspectivesSince Childrens Literature is written f.docxTheoretical PerspectivesSince Childrens Literature is written f.docx
Theoretical PerspectivesSince Childrens Literature is written f.docxsusannr
 

More from susannr (20)

Theory Into Practice Four Social Work Case Studies In this co.docx
Theory Into Practice Four Social Work Case Studies In this co.docxTheory Into Practice Four Social Work Case Studies In this co.docx
Theory Into Practice Four Social Work Case Studies In this co.docx
 
Theory applied to informatics – Novice to Expertcjni.netjou.docx
Theory applied to informatics – Novice to Expertcjni.netjou.docxTheory applied to informatics – Novice to Expertcjni.netjou.docx
Theory applied to informatics – Novice to Expertcjni.netjou.docx
 
Theorizing LeadershipTrait Theory- how tall someone is, hair, .docx
Theorizing LeadershipTrait Theory- how tall someone is, hair, .docxTheorizing LeadershipTrait Theory- how tall someone is, hair, .docx
Theorizing LeadershipTrait Theory- how tall someone is, hair, .docx
 
THEORY & REVIEWTHEORIZING THE DIGITAL OBJECT1Philip Fa.docx
THEORY & REVIEWTHEORIZING THE DIGITAL OBJECT1Philip Fa.docxTHEORY & REVIEWTHEORIZING THE DIGITAL OBJECT1Philip Fa.docx
THEORY & REVIEWTHEORIZING THE DIGITAL OBJECT1Philip Fa.docx
 
Theory Analysis Assignment this assignment is another interview…but.docx
Theory Analysis Assignment this assignment is another interview…but.docxTheory Analysis Assignment this assignment is another interview…but.docx
Theory Analysis Assignment this assignment is another interview…but.docx
 
Theory and the White-Collar OffenderOur previous week’s disc.docx
Theory and the White-Collar OffenderOur previous week’s disc.docxTheory and the White-Collar OffenderOur previous week’s disc.docx
Theory and the White-Collar OffenderOur previous week’s disc.docx
 
Theory & Research in Social Education, 44 565–607, 2016Copy.docx
Theory & Research in Social Education, 44 565–607, 2016Copy.docxTheory & Research in Social Education, 44 565–607, 2016Copy.docx
Theory & Research in Social Education, 44 565–607, 2016Copy.docx
 
THEO 650 Book Review Grading RubricCriteriaLevels of Achieveme.docx
THEO 650 Book Review Grading RubricCriteriaLevels of Achieveme.docxTHEO 650 Book Review Grading RubricCriteriaLevels of Achieveme.docx
THEO 650 Book Review Grading RubricCriteriaLevels of Achieveme.docx
 
Theories of Poverty DiscussionTheories explain phenomena and pre.docx
Theories of Poverty DiscussionTheories explain phenomena and pre.docxTheories of Poverty DiscussionTheories explain phenomena and pre.docx
Theories of Poverty DiscussionTheories explain phenomena and pre.docx
 
Theories help frame more than presenting problems—they also frame so.docx
Theories help frame more than presenting problems—they also frame so.docxTheories help frame more than presenting problems—they also frame so.docx
Theories help frame more than presenting problems—they also frame so.docx
 
Theories of LeadershipInstructionsWrite a 4–5 page paper.docx
Theories of LeadershipInstructionsWrite a 4–5 page paper.docxTheories of LeadershipInstructionsWrite a 4–5 page paper.docx
Theories of LeadershipInstructionsWrite a 4–5 page paper.docx
 
Theories in SociologyAssignment OverviewThis writing assignm.docx
Theories in SociologyAssignment OverviewThis writing assignm.docxTheories in SociologyAssignment OverviewThis writing assignm.docx
Theories in SociologyAssignment OverviewThis writing assignm.docx
 
Theories of LeadershipMany schools of thought have developed t.docx
Theories of LeadershipMany schools of thought have developed t.docxTheories of LeadershipMany schools of thought have developed t.docx
Theories of LeadershipMany schools of thought have developed t.docx
 
THEORIES OF INTELLECTUAL DEVELOPMENTPiaget’s TheoryWe begin wi.docx
THEORIES OF INTELLECTUAL DEVELOPMENTPiaget’s TheoryWe begin wi.docxTHEORIES OF INTELLECTUAL DEVELOPMENTPiaget’s TheoryWe begin wi.docx
THEORIES OF INTELLECTUAL DEVELOPMENTPiaget’s TheoryWe begin wi.docx
 
Theories of Maladaptive BehaviorLocate at least two peer-rev.docx
Theories of Maladaptive BehaviorLocate at least two peer-rev.docxTheories of Maladaptive BehaviorLocate at least two peer-rev.docx
Theories of Maladaptive BehaviorLocate at least two peer-rev.docx
 
Theories help frame more than presenting problems—they also fram.docx
Theories help frame more than presenting problems—they also fram.docxTheories help frame more than presenting problems—they also fram.docx
Theories help frame more than presenting problems—they also fram.docx
 
THEORETICAL REVIEW Please read through these extensive assignmen.docx
THEORETICAL REVIEW Please read through these extensive assignmen.docxTHEORETICAL REVIEW Please read through these extensive assignmen.docx
THEORETICAL REVIEW Please read through these extensive assignmen.docx
 
Theoretical Medicine & Bioethics, 35, 31-42. To Treat a Psyc.docx
Theoretical Medicine & Bioethics, 35, 31-42. To Treat a Psyc.docxTheoretical Medicine & Bioethics, 35, 31-42. To Treat a Psyc.docx
Theoretical Medicine & Bioethics, 35, 31-42. To Treat a Psyc.docx
 
THEORETICAL FRAMEWORK FOR A FAMILY AND PALLIATIVE NURS.docx
THEORETICAL FRAMEWORK FOR A FAMILY AND PALLIATIVE NURS.docxTHEORETICAL FRAMEWORK FOR A FAMILY AND PALLIATIVE NURS.docx
THEORETICAL FRAMEWORK FOR A FAMILY AND PALLIATIVE NURS.docx
 
Theoretical PerspectivesSince Childrens Literature is written f.docx
Theoretical PerspectivesSince Childrens Literature is written f.docxTheoretical PerspectivesSince Childrens Literature is written f.docx
Theoretical PerspectivesSince Childrens Literature is written f.docx
 

Recently uploaded

The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingTeacherCyreneCayanan
 

Recently uploaded (20)

The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 

There are 4 parts for the project. The question may be long to read .docx

  • 1. There are 4 parts for the project. The question may be long to read but it's not a heavy work because there are many examples and explanations for the each parts.*Part 1. The first part of this project requires that you implement a class that will be used to simulate a disk drive. The disk drive will have numberofblocks many blocks where each block has blocksize many bytes. The interface for the class Sdisk should include : Class Sdisk { public : Sdisk(string diskname, int numberofblocks, int blocksize); int getblock(int blocknumber, string& buffer); int putblock(int blocknumber, string buffer); int getnumberofblocks(); // accessor function int getblocksize(); // accessor function private : string diskname; // file name of software-disk
  • 2. int numberofblocks; // number of blocks on disk int blocksize; // block size in bytes }; An explanation of the member functions follows : Sdisk(diskname, numberofblocks, blocksize) This constructor incorporates the creation of the disk with the "formatting" of the device. It accepts the integer values numberofblocks , blocksize , a string diskname and creates a Sdisk (software-disk). The Sdisk is a file of characters which we will manipulate as a raw hard disk drive. The function will check if the file diskname exists. If the file exists, it is opened and treated as a Sdisk with numberofblocks many blocks of size blocksize . If the file does not exist, the function will create a file called diskname which contains numberofblocks*blocksize many characters. This file is logically divided up into numberofblocks many blocks where each block has blocksize many characters. The text file will have the following structure :
  • 3. -figure 0 (what I attached below) getblock(blocknumber,buffer) retrieves block blocknumber from the disk and stores the data in the string buffer . It returns an error code of 1 if successful and 0 otherwise. putblock(blocknumber,buffer) writes the string buffer to block blocknumber . It returns an error code of 1 if successful and 0 otherwise. IMPLEMENTATION GUIDELINES : It is essential that your software satisfies the specifications. These will be the only functions (in your system) which physically access the Sdisk. NOTE that you must also write drivers to test and demonstrate your program.*Part 2. The second part of this project requires that you implement a simple file system. In particular, you are going to write the software which which will handle dynamic file management. This part of the project will require you to implement the class Filesys along with member functions. In the description below, FAT refers to the File Allocation Table and ROOT refers to the Root Directory
  • 4. . The interface for the class should include : Class Filesys: public Sdisk { Public : Filesys(string diskname, int numberofblocks, int blocksize); int fsclose(); int fssynch(); int newfile(string file); int rmfile(string file); int getfirstblock(string file); int addblock(string file, string block); int delblock(string file, int blocknumber); int readblock(string file, int blocknumber, string& buffer); int writeblock(string file, int blocknumber, string buffer); int nextblock(string file, int blocknumber); Private : int rootsize; // maximum number of entries in ROOT
  • 5. int fatsize; // number of blocks occupied by FAT vector filename; // filenames in ROOT vector firstblock; // firstblocks in ROOT vector fat; // FAT }; An explanation of the member functions follows : Filesys() This constructor reads from the sdisk and either opens the existing file system on the disk or creates one for an empty disk. Recall the sdisk is a file of characters which we will manipulate as a raw hard disk drive. This file is logically divided up into number_of_blocks many blocks where each block has block_size many characters. Information is first read from block 1 to determine if an existing file system is on the disk. If a filesystem exists, it is opened and made available. Otherwise, the file system is created.The module creates a file system on the sdisk by creating an intial FAT and ROOT. A file system on the disk will have the following segments: -figure 1 (what I attached below) consists of two primary data objects. The directory is a file that consists of information about files and sub-directories. The root directory contains a list of file (and directory) names along with a block number of the first block in the file (or directory). (Of course, other information about the file such as creation date, ownership, permissions, etc. may also be maintained.) ROOT (root directory) for the above example may look something like
  • 6. -figure 2 (what I attached below) The FAT is an array of block numbers indexed one entry for every block. Every file in the file system is made up of blocks, and the component blocks are maintained as linked lists within the FAT. FAT[0], the entry for the first block of the FAT, is used as a pointer to the first free (unused) block in the file system. Consider the following FAT for a file system with 16 blocks. -figure 3 (what I attached below) In the example above, the FAT has 3 files. The free list of blocks begins at entry 0 and consists of blocks 6, 8, 13, 14, 15. Block 0 on the disk contains the root directory and is used in the FAT for the free list. Block 1 and Block 2 on the disk contains the FAT. File 1 contains blocks 3, 4 and 5; File 2 contains blocks 7 and 9; File 3 contains blocks 10, 11, and 12. Note that a "0" denotes the end-of-file or "last block". PROBLEM : What should the value of FAT_size be in terms of blocks if a file system is to be created on the disk? Assume that we use a decimal numbering system where every digit requires one byte of information and is in the set [0..9]. Both FAT and ROOT are stored in memory AND on the disk. Any changes made to either structure in memory must also be immediately written to the disk. fssynch This module writes FAT and ROOT to the sdisk. It should be used every time FAT and ROOT are modified.
  • 7. fsclose This module writes FAT and ROOT to the sdisk (closing the sdisk). newfile(file) This function adds an entry for the string file in ROOT with an initial first block of 0 (empty). It returns error codes of 1 if successful and 0 otherwise (no room or file already exists). rmfile(file) This function removes the entry file from ROOT if the file is empty (first block is 0). It returns error codes of 1 if successful and 0 otherwise (not empty or file does not exist). getfirstblock(file) This function returns the block number of the first block in file. It returns the error code of 0 if the file does not exist. addblock(file,buffer) This function adds a block of data stored in the string buffer to the end of file F and returns the block number. It returns error code 0 if the file does not exist, and returns -1 if there are no available blocks (file system is full!). delblock(file,blocknumber) The function removes block numbered blocknumber from file and returns an error code of 1 if successful and 0 otherwise. readblock(file,blocknumber,buffer) gets block numbered blocknumber from file and stores the data in the string buffer. It returns an error code of 1 if successful and 0 otherwise. writeblock(file,blocknumber,buffer) writes the buffer to the block numbered blocknumber in file. It returns an appropriate
  • 8. error code. nextblock(file,blocknumber) returns the number of the block that follows blocknumber in file. It will return 0 if blocknumber is the last block and -1 if some other error has occurred (such as file is not in the root directory, or blocknumber is not a block in file.) IMPLEMENTATION GUIDELINES : It is essential that your software satisfies the specifications. These will be the only functions (in your system) which physically access the sdisk. *Part 3. The third part of this project requires that you implement a simple shell that uses your file system. This part of the project will require you to implement the class Shell along with member functions. The interface for the class should include : class Shell: public Filesys { Public : Shell(string filename, int blocksize, int numberofblocks); int dir();// lists all files int add(string file);// add a new file using input from the keyboard int del(string file);// deletes the file
  • 9. int type(string file);//lists the contents of file int copy(string file1, string file2);//copies file1 to file2 }; An explanation of the member functions follows : Shell(string filename, int blocksize, int numberofblocks): This will create a shell object using the Filesys on the file filename. int dir(): This will list all the files in the root directory. int add(string file): add a new file using input from the keyboard int del(string file): deletes the file int type(string file): lists the contents of file int copy(string file1, string file2): copies file1 to file2 IMPLEMENTATION GUIDELINES :See the figure 4 (what I attached below) for the ls function of Filesys.See the figure 5 (what I attached below) for dir function of Shell. See the figure 6 (what I attached below) for main program of Shell.*Part 4. In this part of the project, you are going to create a database system with a single table which uses the file system from Project II. The input file will consist of records associated with Art History. The data file you will use
  • 10. as input consists of records with the following format: The data (180 records) is in date.txt file (what I attached below) Date : 5 bytes End : 5 bytes Type : 8 bytes Place : 15 bytes Reference : 7 bytes Description : variable In the data file, an asterisk is also used to delimit each field and the last character of each record is an asterisk. The width of any record is never greater than 120 bytes. Therefore you can block the data accordingly. This part of the project will require you to implement the following class: Class Table : Public Filesys { Public : Table(string diskname,int blocksize,int numberofblocks, string flatfile, string indexfile); int Build_Table(string input_file);
  • 11. int Search(string value); Private : string flatfile; string indexfile; int IndexSearch(string value); }; The member functions are specified as follows : Table(diskname,blocksize,numberofblocks,flatfile,indexfile) This constructor creates the table object. It creates the new (empty) files flatfile and indexfile in the file system on the Sdisk using diskname . Build_Table(input_file) This module will read records from the input file (the raw data file described above), add the records to the flatfile and create index records consisting of the date and block number, and then add the index records to the index file. (Note that index records will have 10 bytes .. 5 bytes for the date and 5 bytes for the block number.)
  • 12. Search(value) This module accepts a key value, and searches the index file with a call to IndexSearch for the record where the date matches the specified value. IndexSearch returns the blocknumber of the block in the flat file where the target record is located. This block should then be read and the record displayed. IndexSearch(value) This module accepts a key value, and searches the index file indexfile for the record where the date matches the specified value. IndexSearch then returns the block number key of the index record where the match occurs. See the figure 7 (what I attached below) for the main program of Shell which includes a search command.