CPSC 457 L03 & L04 / ENEL 597 L01

Assignment 4 (Winter 2001) -- Virtual Memory

Due: April 12th, 2001

Physical memory of a computer is divided into 12 page frames. The paging disk can hold four jobs. Physical memory can hold at most 4 jobs; each job always has 3 pages in memory (except just after initial loading when it has 2). The operating system is batch, with jobs queued on a job disk. A job has a maximum of 12 pages and a minimum of 4 pages for an average of 8. The pages of a job in the job queue have the following properties:
 
 
Job#
Page#
Execution Time
Next Page
Total Pages Executed
1 1 4 5 16 (random)
1 2 12 3  
1 3 7 1  
1 4 10 2  
1 5 6 4  
2 1 7 4 19 (random)
2 2 8 1  
2 3 10 2  
2 4 6 3  
....        

Average execution time for the pages in a job is close to 8 time units. Starting with page one, pages in a job are executed in the order given in the "next page" continuous linked list (possibly generated randomly) until a number of pages, generated randomly, or otherwise decided by your TA, but greater than the number of pages in the job and less than 20 pages, have been executed.

If the next page for a job is not in memory (page fault), a page in memory for that job is replaced by the next page to be executed (LRU page replacement), paged in from the paging disk. The job scheduling algorithm is FCFS. When a new job is loaded into memory the first 2 pages are loaded. Cpu scheduling is also FCFS, and execution time for a page can be taken as a cpu burst. I/O bursts are neglected. A page fault will cause suspension of execution of a job, and execution of the next job in the ready queue. The suspended job will be given last place in the cpu ready queue, once the page fault has been serviced. The cpu time to service a page fault is 0.2 time units, and the I/O time involved is assumed to be 6 time units. The cpu time to load a job into memory and onto the paging disk is assumed to be zero, but the I/O time is assumed to be 10 time units.

Write a simulation program, that prints for each job completed:
PART a
(1) The page numbers in execution sequence of the actual pages executed, and
(2) the pages of the job in memory as each page is executed.
(3) the number of page faults generated by the job.

PART b
(1) The actual cpu time, including page fault service time, to execute each job, as compared to
(2) the theoretical time (sum of page execution times) to execute a job, and
(3) The total elapsed time to execute a job.

PART c
Confirm the results manually for the first two jobs Use about 18 jobs in job queue.

[MARKS:Basic program: 35 points; (a): 15 pts; (b): 15 pts; (c): 10 pts. TOTAL: 75 pts or 7.5%]