cop 4600 l.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
COP 4600 PowerPoint Presentation
Download Presentation
COP 4600

Loading in 2 Seconds...

play fullscreen
1 / 14

COP 4600 - PowerPoint PPT Presentation


  • 127 Views
  • Uploaded on

COP 4600. Objective # 3. So far………. Obj#1 : read “logon.dat” and created our event list. Obj#2 : function Boot() called. “boot.dat” was read. Kernel loaded and MEMMAP initialized. main(). Scan Event List. Interrupt_Handler() Saves state of interrupted program

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'COP 4600' - sal


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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
cop 4600

COP 4600

Objective # 3

so far
So far………..
  • Obj#1 : read “logon.dat” and created our event list.
  • Obj#2: function Boot() called. “boot.dat” was read. Kernel loaded and MEMMAP initialized.
slide3
main()

Scan Event List

  • Interrupt_Handler()
  • Saves state of interrupted program
  • Gives control to Service Routine
  • ( Simulator.c )
  • Interrupt() –
  • get next event
  • Update Simulation clock – ‘CLOCK’
  • ( OBJ # 1 )
objective 3
Objective # 3
  • Interrupt_Handler()  Logon_Service() 
  • Creates a PCB  Read “Script.dat” 
  • Allocate memory And Load Program from

user’s script ……………………

slide5

Logon_Service()

I

Get_Script()

Next_pgm()

II

Dealloc_pgm

Get_Memory

Loader

III

Dealloc_seg

Allocate_seg

Compact_mem

Get_Instr

IV

V

Merge_seg

level i
LEVEL - I
  • Logon_Service() :
  • [ Allocates and Initializes the PCB for LOGON events ]
  • PCB stored in “termtable”(array of pointers to PCB’s)
  • Initialize PCB .
  • Call Get_Script (PCB) // LEVEL II
  • { Initialize the process script and pgmid }
  • Call Next_pgm (PCB) // LEVEL II
  • { Allocate and Load the next program from script }
level ii
LEVEL - II

Get_Script() :

[ Reads a script from “script.dat” ]

  • Open “script.dat” file
  • Read script till LOGOFF encountered
  • Load script to PCB -> script[……]

This gives us the list of programs a user will execute

level ii8
LEVEL - II

Next_pgm() :

[ Makes a transition to the next program in the script if possible]

  • if (pcb->pgmid >= 0 && pcb->firstrb == NULL)

Dealloc_pgm() // LEVEL III

  • if (pcb->pgmid != NULL)

return

  • if (pcb->[++pcb->pgmid] == LOGOFF

print to *.out

return

  • Get_memory() // LEVEL III { New Segment Table built }
  • Loader() // LEVEL III { Load program into MEM }
  • Assign Current PCB “R” Ready Status
level iii
LEVEL - III

Get_Memory() :

[ Allocates Segment Table and sets up information for each segment ]

Eg: editor.dat

  • Open “editor.dat” and read the number of Segments
  • Allocate a Segment Table
  • Initialize each segment { acc bits , length etc as we did in Boot() }
  • Allocate memory in MEM for each segments code.

{ This is done by calling

Base = Alloc_seg(); // LEVEL IV

if(base < 0)

compact_mem(); // LEVEL IV – OBJ#6 }

level iii10
LEVEL - III

Loader() :

[ Reads editor.dat for instruction and loads each instruction into MEM]

  • Call Get_Instr() {OBJ #2} to get opcodes and operand.
  • Call Display_pgm() to echo to *.out
level iii11
LEVEL - III

Dealloc_pgm() :

[ Frees all allocated segments for the current program and then frees the segment table]

  • Call Dealloc_seg() for each segment in the pcb->segtable;
  • free(pcb->segtable)
level iv
LEVEL - IV

Dealloc_seg() :

[ Return a segment to the free list]

Incase there are two adjacent segments in the free list ……call Merge_Seg()

level iv13
LEVEL - IV

Alloc_seg() :

[ Searches the Free memory listfor free memory segments in MEM for a segment with a length equal to that requested ]

  • Return index in MEM incase enough memory found.
  • Update Other Memory Parameters (eg: TotalFree )
level v
LEVEL - V

Merge_seg() :

[ Scans Memory list and if it finds two adjacent memory blocks it merges them into one ]