Advanced Operating Systems Project

 

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper

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

{

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper

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.

    -1720* *event *Egypt *EX *Hebrews go down to Egypt *
    -1750* *event *Thera *CLAS 42*Earthquake at Thera(ends Minoan peace) *
    -1290* *event *Egypt *BA *Hebrew Exodus: Egypt under Ramses II *
    -1250* *event *Israel *EX *Hebrews enter Promised Land *
    -1184* *event *Troy *CLAS 42*Fall of Troy (Mycenae: King Agamemnon) *
    -1175* *event *Israel *EX *Philistines settle in Canaan *
    -922 * *event *Israel *ENGL 62*Israel/Judah split (10 + 2) *
    -950 * *event *E Hemisphere *BA *Arabs sail to China (take Typhus god) *
    -776 * *event *Greece *CLAS 42*1st Olympics *
    -753 * *event *Rome *CLAS 42*Rome founded (an Etruscan colony) *
    -750 * *work *Greece *CLAS 42*Iliad, Odessey, Homer *
    -725 * *work *Greece *CLAS 42*Theogony, Hesiod (730-720) *
    -701 * *event *Israel *CLAS 42*Assyrians take 10 tribes of Israel *
    -598 * *event *Jerusalem *CLAS 42*Nebacchanezar sacks Jerusalem (1st deportation) *
    -587 * *event *Jerusalem *ENGL 62*Temple of Jerusalem destroyed *
    -540 * *event *Israel *ENGL 62*Hebrews return to rebuild under Persian rule *
    -480 * *event *Greece *ENGL 62*Athens defeats Persia/Xerxes at Salamis (at sea) *
    -479 * *event *Greece *ENGL 62*Sparta defeats Persia/Xerxes (on land) *
    -475 * *work *Greece *CLAS 42*Oresteia, Aeschylus *
    -467 * *event *Greece *CLAS 42*Seven against Thebes produced in Athens (Aeschylus) *
    -463 * *work *Greece *CLAS 42*Prometheus, Aeschylus (470 or 456) *
    -442 * *event *Greece *CLAS 42*Antigone produced (Sophocles) *
    -431 * *event *Greece *CLAS 42*start of Peloponnesian War *
    -428 * *event *Greece *CLAS 42*Hippolytus play produced (Euripides) *
    -409 * *work *Greece *CLAS 42*Cyclops, Euripides *
    -405 * *event *Greece *CLAS 42*Bacchae produced(Euripides:posthumous) *
    -146 * *event *Carthage *CM *Carthage destroyed by Romans *
    -118 * *event *Narbonne *CM *Narbonne:1st Roman city outside Italy *
    -30 * *work *Rome *CLAS 42*Aeneid, Virgil *
    8 * *event *Tomi *CM *Ovid bannished to Tomi (Art of Love) *
    35 * *event *Jerusalem *GZ *St. Stephen stoned *
    43 * *event *England *MS *Romans invade Britain *
    64 * *event *Rome *MS *9 day fire, blamed on Christians *
    64 * *event *Rome *MS *St Peter crucified (upside down), Nero *
    65 * *event *Rome *GZ *St Paul beheaded under Nero *
    67 * *work *E Hemishere *ENGL 62*Mark written *
    68 * *event *Qumran *ENGL 62*Qumran Monastery destroyed by Romans *
    70 * *event *Jerusalem *CM *temple destroyed by Romans *
    73 * *event *Masada *CM *Masada falls to Romans *
    79 * *event *Italy *CM *Vesuvius buries Pompeii & Herculaneum *
    80 * *work *Rome *MS *Colosseum completed *
    81 * *work *Rome *MS *Arch of Titus,Spoils of Jerusalem *
    90 * *work *E Hemishere *ENGL 62*John written *
    108 * *person *Ephysus *MS *John dies *
    106 * *event *Romania *CM *Romans conquer Dacia *
    113 * *work *Rome *MS *Column of Trajan *
    115 * *event *Mesopotamia *CM *Romans conquer Mesopotamia *
    121 * *work *Scotland *CM *Hadrian’s Wall started *
    150 * *work *Fayyum *EK *Fayyum mummy portraits *
    173 * *work *Rome *MS *Equestrian statue of Marcus Aurelius *
    180 * *event *Scotland *MS *Romans pull back to Hadrian’s Wall *
    193 * *work *Rome *MS *Column of Marcus Aurelius *
    202 * *event *Rome *MS *1st time permissible to be Christian *
    203 * *work *Rome *CM *Baths of Caracalla *
    231 * *work *Dura-Europus * *1st Christian House Church: plan *
    238 * *event *Europe *MS *Goths cross the Danube *
    250 * *event *Rome *CM *strong Christian persecution (emperor Decius) *
    256 * *event *Dura-Europus *MS *city destroyed by Persians *
    258 * *event *Rome *MS *St Lawrence martyred *
    259 * *event *France *CM *Gaul breaks away *
    260 * *event *Rome *MS *Christianity a ‘permitted’ religion, under Gallienus *
    270 * *event *Rome *CM *Aurelius becomes emperor *
    274 * *event *France *CM *Gaul reconquered by Aurelius *
    275 * *event *France *CM *towns in Gaul ordered to build walls *
    280 * *event *France *MS *Goths invade Gaul *
    285 * *event *Europe *CM *Maximian made co-emperor *
    286 * *event *Britain *CM *Britain breaks away *
    293 * *event *Europe *CM *2 more co-emperors named: Constantius & Galerius *
    296 * *event *Britain *CM *Britain recovered by Constantius *
    300 * *work *Rome *CM *Catacomb: SS Peter & Marcellinus *
    303 * *event *Europe *CM *Jupiter sacrifice required(Diocletian) *
    305 * *event *Europe *CM *Diocletian & Maximian quit leaving Constantius & Galerius *
    306 * *event *York *CM *Constantius dies, son Constantine crowned *
    312 * *event *Rome *CM *Battle of Milvian Bridge (Chi-Rho) (defeat of Maxentius) *
    313 * *event *Italy *MS *Edict of Milan (toleration of Christianity) *
    314 * *event *Arles *CM *Conference of Arles, 1st Christian counsel *
    320 * *work *Rome *CM *St John Lateran cathed (1st basilica church, no transcept) *
    321 * *event *Europe *CM *Constantine declares Sunday is Sabbath *
    324 * *event *Europe *CM *Capital moved to Constantinople *
    325 * *event *Nicaea *CM *Council of Nicaea, Asia Minor, set basic dogmas *
    330 * *event *Constantinople *GZ *Dedication of Constantinople *
    336 * *event *Alexandria *MS *death of Arius *
    337 * *event *Europe *MS *death of Constantine:empire divided 3 ways (3 sons) *
    350 * *event *Europe *MS *Huns invade Europe *
    351 * *event *Europe *GZ *empire united under the 1 remaining son of Constantine *
    354 * *event *Rome *GZ *Constantina (Sta Constanza) dies *
    362 * *event *Constantinople *GZ *persecution renewed & paganism restored (Julian the Apostate) *
    363 * *event *Europe *CM *end of Constantinian dynasty *
    364 * *event *Europe *CM *Valens (brother:Valentinian)takes East *
    367 * *event *Scotland *CM *Scot revolt (suppressed) *
    372 * *event *Russia *CM *Huns defeat Ostragoths on steppe *
    375 * *event *Europe *CM *Huns cross Dniester, defeat Visigoths who flee into Roman territory *
    377 * *event *Adrianople *GZ *Visigoths defeat and kill East emperor Valens *
    378 * *event *Constantinople *GZ *pagan temples closed (Theosius the Great) *
    380 * *event *Europe *GZ *Christianity becomes an official religion *
    381 * *event *Milan *CM *Milan becomes ‘de facto’ West capital *
    382 * *event *Balkans *CM *Theodosius restores order in Balkans *
    386 * *work *Rome *CM *St Paul’s Outside Walls built *
    388 * *work *Spain *CM *Missorium(plate) of Theodosius,silver, (w/nephew:Valentinian) *
    391 * *event *Europe *MS *Theodosius bans paganism (Judaism permitted) *
    394 * *event *Europe *MS *empire united for last time (under Theodosius) *
    395 * *event *Europe *CM *empire divided, (sons of Theodosius) West: Honorius, East: Arcadius *
    398 * *event *Greece *CM *Last (293rd) Olympic Games (Theodosius bans in 399) *
    400 * *work *Jerusalem *MS *Diptych: Ascension, 3 Marys at Tomb, ivory,Church of Holy Sepulchre *
    402 * *event *Ravenna *GZ *Honorius moves West capital to Ravenna *
    406 * *event *France *GZ *Vandals and others cross Rhine, ravage Gaul *
    408 * *event *Italy *GZ *Alaric the Visigoth invades Italy *
    409 * *event *Spain *CM *Vandals move from Gaul to Spain *
    410 * *event *Rome *GZ *Visigoths under Alaric sack Rome (spare churches–Arian) *
    415 * *work *Constantinople *CM *1st Hagia Sophia begun *
    417 * *event *Spain *CM *Visigoths conquer Spain, settle in Aquitane *
    425 * *event *Arles *GZ *Arles made capital of remaining Roman Gaul *
    429 * *event *E Hemisphere *ART 153*Vandals cross from Spain to Africa (they number 80,000) *
    431 * *event *Ephesus *MS *Council of Ephesus, Mary:Mother of God &reject Nestorian dual nature *
    438 * *event *Europe *GZ *Theodosius II recodifies Roman laws *
    439 * *event *Carthage *CM *Vandals capture Carthage *
    450 * *event *Milan *MS *Attila the Hun destroys Milan *
    451 * *event *France *MS *Huns turned back from Gaul by combined Roman-Gothic army *
    452 * *event *Rome *GZ *Attila the Hun hits/spares Rome *
    454 * *event *Europe *GZ *Battle of Nedao:German Hun tributaries revolt,disintegrating Hun empire *
    455 * *event *Rome *MS *Rome destroyed again, by Vandals (churches spared–Arian) *
    469 * *event *Spain *MS *Visigoths begin conquest of Spain *
    475 * *event *Britain *GZ *Anglo-Saxons begin to settle in England *
    476 * *event *Europe *LG *end of Roman Empire *
    482 * *event *Rome *LG *Pope Simplicius excomms. E Church ! *
    493 * *event *Ravenna *CM *Theodoric(Goth) founds kingdom:Ravenna *
    490 * *work *Ravenna *MS *St. Apollinare Nuovo built, Theodoric (for St. Martin) *
    497 * *event *Ravenna *CM *Theodoric: vice-regent,Byzantine West *
    486 * *event *France *CM *Clovis conquers Northwest Gaul *
    496 * *event *Europe *CM *Clovis accepts Christianity (baptized) *
    500 * *work *Europe *EK *Cotton Genesis, parchment *
    505 * *event *Europe *EK *Clovis conquers Alemanni of upper Rhine *
    507 * *event *France *CM *Clovis defeats Visigoths at Vougle’ & drives them from France *
    511 * *event *Europe *CM *on death of Clovis, his 4 sons divide the kingdom *
    525 * *work *Europe *CM *Diptych:Archangel Michael(right),ivory *
    526 * *work *Ravenna *GZ *Mausoleum of Theodoric *
    528 * *event *Europe *MS *Justinian begins new codification of Roman law *
    532 * *event *Constantinople *MS *Monophysite rebellion, destroyed half of city !, under Justinian *
    533 * *event *Europe *MS *Justinian starts reconquest of West *
    534 * *event *France *CM *Franks conquer Burgundy *
    537 * *event *Europe *CM *Franks conquer Provence & E Switzerland *
    540 * *event *Italy *CM *Ostragoths retake most of Italy from Roman forces *
    550 * *work *Europe *MS *fibulae, gilt, bronze *
    553 * *event *Europe *ART 153*Ostragoths dissolved (Arian) *
    568 * *event *Ravenna *MS *Lombards start rule, accept Christianity*
    596 * *event *England *MS *St Augustine to England,1st Archbishop of Canterbury *
    622 * *event *Arabia *LG *Moslem era begins *
    632 * *event *Jerusalem *LG *Moslem conquest of Jerusalem *
    640 * *event *Egypt *GZ *Moslem conquest of Egypt *
    650 * *event *Jerusalem *ART 153*Church of Holy Sepulchre destroyed*
    -3000*-2185*era *Egypt *ART 5 *Old Kingdom of Egypt *
    -2000*-1200*era *World *BA *Bronze Age *
    -1020*-1000*king *Hebron *ENGL 62*Saul,king of Hebrews *
    -1000*-961 *king *Israel *ENGL 62*David, king of Hebrews *
    -961 *-922 *king *Israel *ENGL 62*Solomon,king of Hebrews *
    -1200*-587 *era *E Hemisphere *BA *Iron Age *
    -800 *-700 *era *E Hemisphere *CLAS 42*Geometric *
    -700 *-500 *era *Europe *CLAS 42*Archaic *
    -525 *-456 *person *Greece *CLAS 42*Aeschylus *
    -496 *-406 *person *Greece *CLAS 42*Sophocles *
    -485 *-406 *person *Greece *CLAS 42*Euripides *
    -420 *-413 *work *Greece *CLAS 42*Electra, Sophocles *
    -500 *-323 *era *Europe *CLAS 42*Classical *
    -300 *-323 *person *Greece *CLAS 42*Alexander the Great *
    -221 *-210 *work *China *CM *Great Wall built *
    -70 *-19 *person *Europe *CLAS 42*Vergil *
    -43 *-17 * *person * *Publius *
    -31 *-14 *era *Europe * *Age of Augustus, Golden Age of Rediscovbery *
    -4 *29 *person *Israel *ENGL 62*Christ *
    14 *37 *emperor *Rome *CM *Tiberius (stepson of Augustus) *
    54 *68 *emperor *Rome *MS *Nero *
    393 *430 *bishop *Europe *MS *St Augustine, Bishop of Hippo (West) *
    413 *426 *work *Europe *CM *’City of God’, written by St Augustine *
    422 *432 *work *Rome *CM *Sta. Sabina built *
    433 *453 *king *Europe *MS *Attila, King of Huns (forced E empire to cede land & pay tribute *
    432 *461 *period *Ireland *MS *St Patrick in Ireland *
    489 *493 *period *Italy *CM *Theodoric the Ostragoth conquers Italy *
    471 *526 *king *Europe *MS *Theodoric, King of Ostragoths (Arian) *
    481 *511 *king *Europe *CM *Clovis, King of Francs, founder of Merovingian dynasty *
    570 *632 *person *Arabia *MS *Muhammad, prophet of Islam *

    Calculate your order
    Pages (275 words)
    Standard price: $0.00
    Client Reviews
    4.9
    Sitejabber
    4.6
    Trustpilot
    4.8
    Our Guarantees
    100% Confidentiality
    Information about customers is confidential and never disclosed to third parties.
    Original Writing
    We complete all papers from scratch. You can get a plagiarism report.
    Timely Delivery
    No missed deadlines – 97% of assignments are completed in time.
    Money Back
    If you're confident that a writer didn't follow your order details, ask for a refund.

    Calculate the price of your order

    You will get a personal manager and a discount.
    We'll send you the first draft for approval by at
    Total price:
    $0.00
    Power up Your Academic Success with the
    Team of Professionals. We’ve Got Your Back.
    Power up Your Study Success with Experts We’ve Got Your Back.

    Order your essay today and save 30% with the discount code ESSAYHELP