OS作业代写:COMP 3361: Operating Systems I


In this assignment, you will implement a logical memory initializer for SOS. The logical memory initializer will initialize the logical address space of a process, and set up the page directory/tables for the process.


The background material for this assignment is in Chapter 5 of “Understanding a Simple Operating System.” You must read it (and the previous chapters) before attempting this assignment.

Assignment Objective

The file _lmemman.c _has one incomplete function with TODO blocks. Finish these blocks to complete the assignment.

bool init_logical_memory(PCB *p, uint32_t code_size);

This function initializes a process’ logical address space. This involves allocating frames for the process code, stacks, page directory and page tables, and then setting them up. The PCB is passed in the argument p, and the number of bytes in the process’ code and data is in the argument code_size. The function should return TRUE if all goes well; otherwise FALSE. Any frames allocated in the function must be freed if FALSE is returned.

User programs

The same user programs as in SOS2 are available in this assignment.


Download the _ASG4.zip _file from the assignment page. Extract the folder. In SOS3, use ./create to create the SOS.dsk file (just like you did for SOS0, SOS1 and SOS2). Create a new machine called SOS3 in VirtualBox, and use the _SOS.vmdk _file for the hard drive. Once SOS boots, you can run one of the three available programs. For example, to run p2.c, type

%run 1300 2

However, for now you will see the message run: Not enough memory. This is because init_logical_memory simply returns FALSE. But once you finish the assignment, you should see the program executing (you will see a series of Bs being printed).


Submit in Canvas the modified _lmemman.c _file, and a README file containing any information you feel the GTA should know before grading your program. Comment your program well (include your name).

kamisama wechat