1 / 14

COP 4600 Project 2

COP 4600 Project 2. Task. Simulate booting the OS by loading the boot program into Kernel memory (which should be simulated as well) Read instruction file boot.dat, save in memory Interpret and run boot.dat. Boot.dat. Three parts Program attribute Segment attribute Instructions.

ishi
Download Presentation

COP 4600 Project 2

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. COP 4600 Project 2

  2. Task • Simulate booting the OS by loading the boot program into Kernel memory (which should be simulated as well) • Read instruction file boot.dat, save in memory • Interpret and run boot.dat University of Central Florida

  3. Boot.dat • Three parts • Program attribute • Segment attribute • Instructions Program 1 Segment 1 Segment 2 Program 2 Segment 1 Segment 2 Segment 3 Segment 4 Memory Layout University of Central Florida

  4. Boot.dat Program has 4 segments segment table. Load into MEMMAP Segment length Segment access bit one segment Input file boot.dat University of Central Florida

  5. Program Skeleton In simulator.c Main() { …… Boot(); // Load boot.dat into memory, print out memory layout …… while( new_events != NULL ) { …… Interrupt(); // take out one event, print it out (consume one event) …… XPGM( ….); // Simulate a cpu cycle (generate one event) …… } } University of Central Florida

  6. Memory Structure • Array “Mem” is your memory From simulator.c struct instr_type* Mem Mem = calloc(Mem_Size, sizeof(struct instr_type)); • Array “Mem_Map” is your segment table From simulator.c struct segment_type* Mem_Map Mem_Map = calloc(2*Max_Segments, sizeof(struct segment_type)); University of Central Florida

  7. Memory Structure 0 SIO 75 1 DISK 2000 SKIP 0 2 3 JUMP [2,0] 4 SKIP 1 0 Boot.Seg1 JUMP [3,0] 5 6 SKIP 0 1 Boot.Seg2 JUMP [2,6] 7 2 Boot.Seg3 8 SIO 400 3 Boot.Seg4 PRNT 150 9 10 WIO 500 MEMMAP REQ [0,1] 11 12 WIO 0 REQ [2,1] 13 14 SKIP 0 JUMP [1,0] 15 END 20 16 MEM University of Central Florida

  8. Instruction Set • SIO n • CPU burst for n cycles • Start IO • WIO n • CPU burst for n cycles • Wait IO (block) • END n • CPU burst for n cycles • End program University of Central Florida

  9. Instruction Set • Device n • Always follows SIO • n is the bytes transferred (used to calculate time needed) • Device can be DISK, PRNT…… • Sample: SIO 75 DISK 2000 • REQ [seg, off] • Always follows WIO • [seg, off] refers to the device instruction waiting for • Sample: [2, 1] PRNT 150 …… WIO 0 REQ [2,1] University of Central Florida

  10. Instruction Set • JUMP [seg, off] • Jump to [seg, off] • SKIP n • Skip the next instruction for n times • Sample SKIP 1 JUMP [3,0] SIO 400 University of Central Florida

  11. Functions • Boot • Get_Instr // Read one instruction from boot.dat • Display_pgm // display memory layout • XPGM • CPU // One CPU cycle • Fetch // Read one instruction from memory • Util • Read • Write // Write one instruction to memory • Mu // convert [seg, off] to physical memory University of Central Florida

  12. CPU • Every invocation of CPU() will execute one CPU burst instruction • SIO/WIO/END • SKIP • Skip or continue to next instruction • Jump • Jump to destination and continue • SIO • Skip the next instruction (device) • WIO • Skip the next instruction (req) University of Central Florida

  13. Events • For every CPU invocation • Run one CPU burst, SIO/WIO/END • Generate one event of type “SIO/WIO/END” • Timestamp: the finish time of CPU burst [0,0] SIO 75 DISK 2000 SIO, 150ms [0,2] SKIP 0 JUMP [2,0] SIO 400 PRNT 150 SIO, 950ms 950ms = 150ms + 400(cpu burst)*2000ns = 950ms [2,0] Events CPU() invocations University of Central Florida

  14. Develop process • Make copyfiles • Make data2files • Modify obj2.c • Reuse obj1.c, you may need to modify obj1.c • Make sim, then run “sim” • Make compare OBJ=2 • If error happens, manually check data2.out and ossim.out, see what is wrong • You should expect “Done. Looks OK to me...” • Make submit • You should see “If you dont get any error message,submit is successful.” University of Central Florida

More Related