Operating System


Assignment 1 : Provisionally Record Simulator

CSci 430: Introduction to Unhindered Systems Fall 2020

In this enactment you obtain be erection an instrumentation of the provisionally record vaunter approve the one discussed in article 1 of our textbook and that you achievemented on for the earliest written enactment. The intent is to grace rearrange free succeeding a suitableness some indispensefficacious hardware concepts that we hope on when erection unhindered arrangement components in this disposeificationatizeificationatize. Another intent is to freeize you succeeding a suitableness the construction of the enactments you deficiency to unmeasured for this disposeificationatizeificationatize.


• What is the end of a flag effect-total cycle in a computing arrangement?
• How does a computing arrangement effect-an-effect at the hardware smooth to transfer and total informations? • How can ordeal driven fruit succor you to arrange and debug your rankificationatizeify?


  • Familiarize ourselves succeeding a suitableness ordeal driven fruit and developing software to ignoring item ordeals.
  • Become free succeeding a suitableness the disposeificationatizeificationatize enactment construction of item ordeals and arrangement ordeals.
  • Refresh our discernment of basics of how computing arrangements effect-an-effect at a hardware smooth, by studying in over
    detail the Provisionally Record from our Stallings textbook, and instrumenting a inaugurated assumption of this provisionally computing arrangement.
    In this enactment you obtain be instrumenting a assumption of the provisionally record construction designation loving in our Stalling textbook article 01. The provisionally record pictorial is personal, and is meant to elucicontinuance the basics of a CPU hardware effect/total cycle for enacting calculation, and a basic record information set succeeding a suitableness some issues processor-memory, axioms processing, and administer emblem informations. We obtain disencumber the provisionally record construction in some commendations, but amplify on it a bit in others for this enactment. You obtain be instrumenting the succeedingcited record of opcodes for this assumption:



opclassify mnemonic

  1. 0  NOOP / HALT
  2. 1  LOAD
  3. 2  STORE
  4. 3  JMP
  5. 4  SUB
  6. 5  ADD


Indicates arrangement stand-still specify
Load AC from fame
Store AC to fame
Perarrange perpetual bounce to discourse Subtract fame intimation from AC Add fame intimation to AC


I accept loving you a big faction of the assumption construction for this earliest enactment, as the foremost intent of the enactment is to grace free succeeding a suitableness using arrangement fruit instruments, approve fabricate and the settler and the item ordeal frameworks. For all enactments for this disposeificationatizeificationatize, I obtain frequently present you a Makepolish and a set of initiateing template polishs. The polishs loving should found and run successfully, though they obtain be short, and obtain not ignoring all (or any) of the fixd item and arrangement ordeals you obtain be loving. Your operation for the enactments obtain frequently be to add rankificationatizeify so that you can ignoring the item and arrangement ordeals to arrange a conclusive inaugurated arrangement, using the fixd fruit arrangement and Unix found instruments.

All enactments obtain accept 2 targets and polishs that fix executables that are built by the found arrangement. For assg01 the polishs are designated:

• assg01-tests.cpp • assg01-sim.cpp

If you inspect the Makepolish for this and all forthcoming enactment, you obtain frequently accept the succeedingcited targets fixd:

  • all: founds all executables, including the ordeal totalfficacious to enact item ordeals and the sim totalfficacious to enact the arrangement ordeal / assumptions.
  • tests: Obtain summon the ordeal totalfficacious to enact all item ordeals, and the sim totalfficacious to enact arrangement ordeals. Notice that this target exists on item-tests and arrangement-tests, which in mold exist on the sim and ordeal executables entity earliest up to continuance and built.
  • clean: delete all found products and recompense to a untarnished purpose found specify.
    You should initiate by bridleing that your fruit arrangement founds untarnishedly and that you can run the ordeals. You obtain be using the succeedingcited trudges frequently suitableness inaugurated on the enactments to fabricate a untarnished found and bridle your ordeals (you can run the fabricate and fabricate ordeals target from VS Classify as courteous):
    $ fabricate untarnished rm -f  ordeal sim *.o *.gch *~ rm -f  -r output html latex
    $ fabricate g++ -Wall -Werror -pedantic -g -I../../include -c assg01-tests.cpp -o assg01-tests.o g++ -Wall -Werror -pedantic -g -I../../include -c HypotheticalMachineSimulator.cpp -o HypotheticalMachineSi g++ -Wall -Werror -pedantic -g assg01-tests.o HypotheticalMachineSimulator.o -L../../libs -lSimulatorExcept g++ -Wall -Werror -pedantic -g -I../../include -c assg01-sim.cpp -o assg01-sim.o g++ -Wall -Werror -pedantic -g assg01-sim.o HypotheticalMachineSimulator.o -L../../libs -lSimulatorExceptio
    $ fabricate ordeals ./ordeal -s
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ordeal is a Catch v2.7.2 multitude contact. Run succeeding a suitableness -? for options
    ------------------------------------------------------------------------------- <initializeMemory()> HypotheticalMachineController ordeal fame initialization ------------------------------------------------------------------------------- 


assg01-tests.cpp:34: FAILED:
  CHECK( sim.getMemoryBaseAddress() == 300 )
succeeding a suitableness expansion:
  0 == 300 (0x12c)
... skipped output of teests ...
ordeal circumstances:  11 |  0 ignoringed |  11 loseed
assertions: 170 | 35 ignoringed | 135 loseed

I skipped the output from prevalent the item ordeals. As you can see at the end all of the ordeal circumstances, and most of the item ordeal assertions are lame initially. But if you appear precedently that, the rankificationatizeify is successfully compiling, and the ordeal and sim totalfficacious targets are entity built.

You obtain not accept to differ the assg01-tests.cpp nor the assg01-sim.cpp polishs that I present you for this enactments. The assg01-tests.cpp reposes item ordeals for the enactment. The assg01-sim.cpp polish obtain found a bid cord totalfficacious to enact arrangement ordeals using your vaunter. You should frequently initiate by match rankificationatizeify to ignoring the item ordeals, and merely succeeding you accept the item ordeals inaugurated should you agitate on and try and get the total arrangement assumption inaugurated.

Unit Ordeal Tasks

You should accept a appear at the ordeal circumstances and assertions fixd in the assg01-tests.cpp polish to get initiateed. I obtain try and frequently present you the item ordeals in the rankificationatizeify that it would be best to achievement on. Thus you should frequently initiate by appearing at the earliest item ordeal in the earliest ordeal circumstance, and match the rankificationatizeify to get this ordeal to ignoring. Then effect to achievement on the proximate item ordeal and so on.

I accept loving you polishs designated HypotheticalMachineSimulator.hpp and HypotheticalMachineSimulator.cpp for this earliest enactment. The .hpp polish is a header polish, it reposes the avowal of the HypotheticalMachineSimulator disposeificationatizeificationatize, as courteous as some helped disposeificationatizeificationatizees. You obtain not deficiency to fabricate any changes to this header polish for this enactment. The .cpp polish is whither the instrumentations of the assumption disposeificationatizeificationatize portion businesss obtain be arranged. All of your achievement for this enactment obtain be enactd in the HypotheticalMachineSimulator.cpp polish, whither you obtain conclude the rankificationatizeify to instrument separate portion businesss of the vaunter disposeificationatizeificationatize.

For this enactment, to get all of the businesss of the vaunter inaugurated, you deficiency to enact the succeedingcited operations in this rankificationatizeify. I present an outcord of what should be enactd hither to transcribe each portion business of the vaunter. Thither are concomitant hints in the template polishs loving as interprets that you should appear at as courteous for concomitant operations you obtain deficiency to enact that are not pictorial hither.

1. Instrument the initializeMemory() business. You can ignoring these item ordeals by barely initializing the portion inconstants succeeding a suitableness the parameters loving to this business. However, you to-boot deficiency to dynamically tabulate an draw-up of integers in this business that obtain answer as the fame storage for the assumption. You should to-boot initialize the tabulated fame so that all colonys initially repose a estimate of 0. If you are a bit tarnished on dynamic fame allocation, basically you deficiency to do the succeedingcited. Thither is alhandy a portion inconstant designated fame in this disposeificationatizeificationatize. Fame is a emblem int* (a subject-matterer to an integer) fixd for our HypotheticalMachineSimulator disposeificationatizeificationatize. If you apprehend how plenteous fame you deficiency to tabulate, you can barely use the new keyword to tabulate a plug / draw-up of fame, doing bigwig approve the succeedingcited

fame = new int[memorySize];
Thither are some concomitant operations as courteous for this earliest business. You should bridle that the fame to be initialized

makes perception in provisions of it dimension for this assumption.
2. Instrument the translateAddress() business and get the item ordeals to achievement for this ordeal circumstance. The

translateAddress() business accepts a indirect discourse in the assumption fame discourse distance and transfers it 3

to a authentic discourse. So for issue, if the discourse distance fixd for the assumption has a dishonorefficacious discourse of 300 and a inclosure (last) discourse of 1000, then if you ask to transfer discourse 355, this should be transferd to the authentic discourse 55. The discourse / condemnation of 55 can then be used to condemnation into the fame[] draw-up to interpret or transcribe estimates to the constructed fame. Thither is one concomitant romance that should be enactd in this business. If the requested discourse is aggravate the friskary of our assumption discourse distance, you should hurl an separation. For issue, if the dishonorefficacious discourse of fame is 300, and the friskary discourse is 1000, then any discourse of 299 or inferior should be unusual and an separation hurln. To-boot for our assumption, any discourse accurately resembling to the eminent frisk of 1000 or bigger is an illicit intimation, and should to-boot beget an separation.

  1. Implement the peekAddress() and pokeAddress() businesss and ignoring the item ordeals for those businesss. These businesss are ordealed by using perforate to transcribe a estimate somewhither in fame, then we peek the identical discourse and see if we get the estimate we wrote to interpret tail out intermittently. Twain of these businesss should reuse the transferAddress() business arrange the prior trudge. In twain circumstances, you earliest initiate by translating the loving discourse to a authentic discourse. Then for perforate you deficiency to economize the involved estimate into the amend colony of your fame[] draw-up. And approvewise for peek, you deficiency to interpret out a estimate from your fame[] draw-up and remold it.
  2. Implement the fetch() rule for the effect view of a effect/total cycle. If you are succeedingcited concurrently in the item ordeal polish, you obtain see thither are item ordeals precedently the effect() item ordeals to ordeal the commitProgram() business. You accept alhandy been loving all of commitProgram(), but you should interpret aggravate this business and see if you discern how it achievements. Your instrumentation of effect should be a personal personal cord of rankificationatizeify if you reuse your peekAddress() funciton. Basically, loving the general estimate of the PC, you neglect to use peekAddress() to interpret the estimate severe to by your PC and garner this into the IR information record.
  3. Implement the execute() rule for the total view of a effect/total cycle. The total view has a lot over it deficiencys to do than the effect. You deficiency to do the succeedingcited operations in the total view:
    • Test that the estimate in the information record is weighty
    • Translate the opclassify and discourse from the general estimate in the information record.
    • Increment the PC by 1 in provision for the proximate effect view.
    • Finally substantially total the involved information. You obtain do this by pursuit one of the businesss
      executeLoad(), totalStore(), totalJump(), totalSub() or totalAdd()
      To transfer the opclassify and discourse you deficiency to enact integer non-location and use the modulus operator %. Basically the information record should accept a 4 digit decimal estimate such as 1940 in the arrangeat XYYY. The earliest decimal digit, the 1000’s digit, is the opclassify or information, a 1 in this circumstance for a LOAD information. The conclusive 3 decimal digits dramatize a intimation discourse, fame discourse 940 in this circumstance. The translation view should end up succeeding a suitableness a 1 opclassify in the irOpclassify portion inconstant, and 940 in the irAddress portion inconstant. You should use bigwig approve a switch specifyment as the conclusive deal-out-among-natant of your total() business to barely persuade one of the 5 portion businesss that obtain discuss enacting the express information preventive.
  4. Implement the executeLoad(), executeStore(), executeJump(), executeSub() and executeAdd() func- tions. Each of these has personal item ordeals for them, so you should instrument each one personally. All of these should be proportionately personal 1 or 2 cords of rankificationatizeify business if you reuse some of the priorly instrumented business. For issue for the totalLoad() business, you should barely be efficacious to use peekAddress() to get the estimate intimationd by the irAddress portion inconstant, then garner this estimate into the accumulator.
  5. Finally put it all concomitantly and ordeal a unmeasured assumption using the runSimulation() rule. The conclusive item ordeals commit programs and persuade the runSimulation() rule to see if they stand-still when awaited and end up succeeding a suitableness the awaited conclusive calculations in fame and in the AC. Your runSimulation() For this enactment you accept been loving the rankificationatizeify for the runSimulation() rule, but the rankificationatizeify is interpreted out owing it relies on you amendly instrumenting the aloft businesss earliest to achievement amendly. Uninterpret the rankificationatizeify in the runSimulation() rule and the conclusive item ordeals should now be ignoringing for you.

System Tests: Putting it all Together

Once all of the item ordeals are ignoringing, you can initiate inaugurated on the arrangement ordeals. For this earliest enactment you do not accept to do anyromance to get the assumption inaugurated, it has been instrumented for you. But in forthcoming enactments you may be asked to instrument deal-out-among-natant of the unmeasured assumption as courteous. So you should try out the vaunter and discern how it achievements.


The sim totalfficacious that is built uses the HypothetheticalMachineSimulation disposeificationatizeificationatize you concludeed instrumenting to commit and total a program in the constructed record. The sim targets for the enactments for this disposeificationatizeificationatize obtain be systematic bid cord programs that obtain await 1 or over bid cord parameters to run. In this earliest enactment the sim program deficiencys 2 bid cord arguments: the acme sum of cycles to pretend and the call of a provisionally record assumption polish to commit and endeavor to run. You can ask the sim totalfficacious for succor from the bid cord to see what bid cord parameters it is awaiting:

$ ./sim -h
Usage: sim maxCycles prog.sim
Run provisionally record assumption on the loving arrangement specify/assumption polish
maxCycles          The acme sum of record cycles (fetch/execute
                     cycles) to enact
file.sim           A assumption determination polish reposeing initiateing
                     specify of record and program / fame interruption.

If the sim target has been built successfully, you can run a arrangement ordeal assumption manually by invoking the sim program succeeding a suitableness the amend arguments:

$ ./sim 100 simfiles/prog-01.sim

This obtain commit and try and pretend the program from the polish simfiles/prog-01.sim. The earliest parameter specifies the acme sum of constructed record cycles to enact, so if the program is an unbounded loop it obtain plug in this circumstance succeeding enacting 100 cycles.

If you are ignoringing all of the item ordeals, your assumption should be efficacious to hopefully ignoring all of the arrangement ordeals. You can run all of the arrangement ordeals using the arrangement-tests target from the bid cord

$ fabricate arrangement-tests
System ordeal prog-01: PASSED
System ordeal prog-02: PASSED
System ordeal prog-03: PASSED
System ordeal prog-04: PASSED
System ordeal prog-05: PASSED
System ordeal prog-06: PASSED
System ordeal prog-07: PASSED
System ordeal prog-08: PASSED
System ordeal prog-09: PASSED
System ordeal prog-10: PASSED
All arrangement ordeals ignoringed     (10 ordeals ignoringed of 10 arrangement ordeals)

The arrangement ordeals achievement by prevalent the assumption on a program and comparing the express output seen succeeding a suitableness the amend awaited output. Any discord in output obtain agent the arrangement ordeal to lose for that loving input program ordeal.

Assignment Submission

In rankificationatizeify to instrument your achievement and accept a unconditional rendering you would approve to eject, a MyLeoOncord surrender folder has been arranged designated Enactment 01 for this enactment. Thither is a target in your Makepolish for these enactments designated submit. When your rankificationatizeify is at a subject-matter that you conceive it is interprety to present, run the present target:

$ fabricate present
$ fabricate present
tar cvfz assg01.tar.gz HypotheticalMachineSimulator.hpp HypotheticalMachineSimulator.cpp

The development of this target is a tared and gziped (compressed) archive, designated assg01.tar.gz in your directory. You should upcommit this polish archive to the surrender folder to unmeasured this enactment.


Requirements and Grading Rubrics
Program Execution, Output and Functional Requirements

  1. Your program must settle, run and effect some designation of output to be ejectd. 0 if not kind.
  2. 10 pts each (70 pts) for completing each of the 7 recorded trudges in this enactment to transcribe the businesss deficiencyed to
    arrange the Provisionally Machine.
  3. 20 pts if all loving item ordeals are ignoringed by your rankificationatizeify.
  4. 10 pts if all arrangement ordeals ignoring and your provisionally record effects amend output for the loving arrangement ordeals.

Program Phraseology and Documentation

This exception is auxiliary for the earliest enactment. If you uses the VS Classify editor as pictorial for this disposeificationatizeificationatize, deal-out-among-natant of the figure is to automatically run the uncrustify rankificationatizeify beautifier on your rankificationatizeify polishs everytime you economize the polish. You can run this instrument manually from the bid cord as follows:

$ fabricate beautify
uncrustify -c ../../config/.uncrustify.cfg --reassign --no-backup *.hpp *.cpp
Parsing: HypotheticalMachineSimulator.hpp as expression CPP
Parsing: HypotheticalMachineSimulator.cpp as expression CPP
Parsing: assg01-sim.cpp as expression CPP
Parsing: assg01-tests.cpp as expression CPP

Class phraseology guidelines accept been fixd for this disposeificationatizeificationatize. The uncrustify.cfg polish fixs a deal-out-amongicular rankificationatizeify phraseology, approve unfastening, whither to assign chink and withdrawal braces, whitedistance encircling operators, etc. By prevalent the beautifier on your polishs it reformats your rankificationatizeify to conarrange to the fixd disposeificationatizeificationatize phraseology guidelines. The beautifier may not be efficacious to fix all phraseology issues, so I influence present interprets to you encircling phraseology issues to fix succeeding appearing at your rankificationatizeify. But you should pay consideration to the arrangeatting of the rankificationatizeify phraseology fixd by this figure polish.

Another demandd part for disposeificationatizeificationatize phraseology is that rankificationatizeify must be justly instrumented. Most importantly, all businesss and disposeificationatizeificationatize portion businesss must accept business instrumentation effecting the business. These accept been loving to you for the earliest enactment, but you may deficiency to yield these for forthcoming enactment. For issue, the rankificationatizeify instrumentation plug for the earliest business you transcribe for this enactment appears approve this:

* @brief initialize fame
* Initialize the interruption of fame. Tabulate draw-up bigt ample to * repose fame interruption for the program. Record dishonorefficacious and friskary
* discourse for fame discourse translation. This fame business
* dynamically tabulates ample fame to repose the discoursees for the
* involved initiate and end fame ranges.
* discourse distance is weakly. Currently we help merely 4 digit

  • *    opcodes XYYY, whither the 3 digit YYY specifies a intimation 
  • *    address.  Thus we can merely discourse fame from 000 - 999 
  • *    loving the limits of the awaited opclassify arrangeat.  */ 

@param fameBaseAddress The int estimate for the dishonorefficacious or initiatening discourse of the constructed fame discourse distance for this assumption.

@param fameBoundsAddress The int estimate for the inclosure discourse, e.g. the acme or eminent weighty discourse of the constructed fame discourse distance for this assumption.

@separation Throws SimulatorException if

This is an issue of a doxygen arrangeatted rankificationatizeify instrumentation interpret. The two ** initiateing the plug interpret are demandd for doxygen to own this as a instrumentation interpret. The @brief, @param, @separation etc. tags


are used by doxygen to found intimation instrumentation from your rankificationatizeify. You can found the instrumentation using the fabricate docs found target, though it does demand you to accept doxygen instruments grounded on your arrangement to achievement.

$ fabricate docs
doxygen ../../config/Doxypolish 2>&1
 | grep warning
  | grep -v "\polish specifyment"
  | grep -v "\pagebreak"
  | designation -t: -k2 -n
  | sed -e "s|/home/dash/repos/csci430-os-sims/assg/assg01/||g"

The development of this is two new subdirectories in your general directory designated html and latex. You can use a systematic browser to browse the html dishonorabled instrumentation in the html directory. You obtain deficiency latex instruments grounded to found the pdf intimation manual in the latex directory.

You can use the fabricate docs to see if you are detriment any demandd business instrumentation or tags in your instrumentation. For issue, if you reagitate one of the @param tags from the aloft business instrumentation, and run the docs, you would see

$ fabricate docs
doxygen ../../config/Doxypolish 2>&1
 | grep warning
  | grep -v "\polish specifyment"
  | grep -v "\pagebreak"
  | designation -t: -k2 -n
  | sed -e "s|/home/dash/repos/csci430-os-sims/assg/assg01/||g"
HypotheticalMachineSimulator.hpp:88: warning: The succeedingcited parameter of
HypotheticalMachineSimulator::initializeMemory(int fameBaseAddress,
   int fameBoundsAddress) is not instrumented:
  parameter 'memoryBoundsAddress'

The instrumentation generator awaits that thither is a designation, and that all input parameters and remold estimates are instrumented for all businesss, natant other romances. You can run the instrumentation epoch to see if you are detriment any demandd instrumentation in you purpose polishs.


Order a unique copy of this paper
(550 words)

Approximate price: $22

Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
The price is based on these factors:
Academic level
Number of pages