Hao Cheng - PowerPoint PPT Presentation

1 / 18
About This Presentation
Title:

Hao Cheng

Description:

Look up the freeMEM for the first fit available block in MEM and then update ... finally scan the freeMEM and if there are adjacent blocks, merge into a big one. ... – PowerPoint PPT presentation

Number of Views:27
Avg rating:3.0/5.0
Slides: 19
Provided by: csU73
Learn more at: http://www.cs.ucf.edu
Category:
Tags: cheng | hao | scan

less

Transcript and Presenter's Notes

Title: Hao Cheng


1
Simulator Project
Objective 3
Get_Srcipt Logon_Service Next_pgm
Get_memory Alloc_seg Loader
11 functions Dealloc_pgm
Dealloc_seg Merge_seg End_ServiceAbend_Serv
ice
  • Hao Cheng
  • haocheng_at_cs.ucf.edu
  • 11-01-15

2
Objective 3
  • multi-users/terminals
  • process control block
  • program loader
  • memory allocation
  • data structure
  • program flow
  • function descriptions

3
process model
  • 5 users logon
  • user programs
  • logon.dat script.dat

4
termtable pcb_type
5
program files
  • editor.dat, user.dat per type
  • 5 users - 19 programs (obj3)
  • multi-programs per file
  • read in the execution order

6
freemem
Memory allocation strategy First Fit
Getmemory, Alloc_seg, Dealloc_pgm, Deallog_seg
7
Cpu()
  • Cpu() is only called by itself or XPGM()
  • XPGM is called by Dispatcher() or

So in Obj3, the Cpu() will never be called.
8
END - PGEND
  • PGEND
  • read from logon.dat
  • Get_instr Cpu()

9
program flow (obj3)
10
Logon(U001) Logon(U002) Logon(U004)
Logon(U005) Logon(U003) END(U001)...
11
Logon_Service
  • Allocates and Initializes the PCB
  • PCB stored in termtable
  • Get_Script - Initialize the process script and
    pgmid.
  • Next_pgm(PCB) - Allocate and Load the next
    program.

12
Get_Script
  • from script.dat
  • file pointer scriptfp
  • allocate entries for pcb-gtscript
  • load script into pcb-gtscript
  • read till LOGOFF

13
Next_pgm
  • for this pcb, if some programs are already
    executed, release those resources.
  • if (pcb-gtfirstrb ! NULL) return. (for I/O)
  • if next script logoff, output return.
  • Else
  • Get_memory request memory resource
  • Load program into allocated memory
  • pcb-gtstatus R

14
Get_Memory Alloc_seg
  • allocate segment table (program files)
  • initialize every new allocated entries
  • For each segment
  • call alloc_seg() to reserve space in MEM
  • Look up the freeMEM for the first fit available
    block in MEM and then update freeMEM
    appropriately alloc_seg().
  • Get the returned base address membase
  • Compact_men (obj6)

15
Loader
  • for each segment
  • get instructions from program files (get_instr)
  • load instr_type into MEM according to segment
    table.
  • Display_pgm

16
Memory
  • dealloc_pgm, dealloc_seg, merge_seg
  • free every allocated segment table and return the
    occupied MEM into freeMEM
  • finally scan the freeMEM and if there are
    adjacent blocks, merge into a big one.

17
End_Service
  • End_Service
  • output END OF PROGRAM
  • If (pcb-gtfirstrb NULL) Next_pgm(pcb)
  • first IORB, always NULL in obj3.

18
Questions?
Write a Comment
User Comments (0)
About PowerShow.com