Presentation is loading. Please wait.

Presentation is loading. Please wait.

User-level Memory Management Supervisor: Joe Cordina Co-Supervisor: Kurt Debattista Observer: Kevin Vella.

Similar presentations


Presentation on theme: "User-level Memory Management Supervisor: Joe Cordina Co-Supervisor: Kurt Debattista Observer: Kevin Vella."— Presentation transcript:

1 User-level Memory Management Supervisor: Joe Cordina Co-Supervisor: Kurt Debattista Observer: Kevin Vella

2 Joe CordinaUser-level Memory Management2 APT Advanced practical task serve the purpose of allowing students to design, implement and document a medium to large project Student initiative Understand task + design Research into possible solutions Work alone under supervisor’s guidance

3 Joe CordinaUser-level Memory Management3 Overview Improving memory access and allocation/de-allocation through the design and implementation of a user- level memory management library.

4 Joe CordinaUser-level Memory Management4 Literature Operating Systems Book (Dinosaur) Operating Systems Slides C Programming Book Internet Resources

5 Joe CordinaUser-level Memory Management5 Assessment 50% Design/Implementation 30% Documentation/Inception Report 20% Presentation/Interview

6 Joe CordinaUser-level Memory Management6 Main issues of APT Implementation Library providing user level memory access Provides an efficient internal memory management Reduce System calls Eliminate Page Faults Basic SMP support Example programs with benchmark results

7 Joe CordinaUser-level Memory Management7 User Level Management Library Has to provide the following system calls: void *umalloc(int bytes); int ufree(void *ptr); Provisions have to be made for reporting error messages Has to cater for page faults

8 Joe CordinaUser-level Memory Management8 System Calls All system calls into the kernel are expensive. Thus we try to use all memory allocation and de-allocation at the user level.

9 Joe CordinaUser-level Memory Management9 Page Faults When user calls malloc(), an area of memory if assigned to the process but this assignment is logical until the first byte is written. When the first byte is written, a page fault occurs which assigns the page into physical memory. This page fault has overheads which should be eliminated A page fault also occurs when a process tries to access a page which has been swapped out of memory

10 Joe CordinaUser-level Memory Management10 Page Faults (cont.) To eliminate page faults one can use one of the following: Write to the memory page on initializing of the memory management library Use mlock() which does not guarantee consecutive memory allocation and needs root access. int mlock(const void *addr, size_t len); Use the bigphysarea patch or something similar

11 Joe CordinaUser-level Memory Management11 SMP Support When using clone(), a new process is created which resides and shares the same user space as the parent. int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg); Each new process can be allocated to a free processor. You should guarantee that your user level management library can cater for simultaneous allocation. To avoid system calls we cannot use semaphores and thus we make use of a spin lock. A spin lock busy waits on a shared variable until a resource is marked as free.

12 Joe CordinaUser-level Memory Management12 SMP Support (cont.) Shared variables: int allow; initially allow = 1 allow = 1  P can enter its critical section Process P do { loop while (allow != 1) repeat while; allow=0; critical section; allow = 1; reminder section; }

13 Joe CordinaUser-level Memory Management13 SMP Support (cont.) You will realize that a busy wait loop could not set variables atomically and thus we need to make use of a Test-And-Set instruction (btsl). Test and modify the content of a word atomically boolean TestAndSet(boolean &target) { boolean rv = target; target = true; return rv; }

14 Joe CordinaUser-level Memory Management14 Bonus Material Provide the following user level call in your library void *getSM(int index) that allocates a shared memory area of fixed size. Any call to this function with the same index will return a pointer to the same memory area.

15 Joe CordinaUser-level Memory Management15 Bonus Material Provide calls to allow Concurrent Read and Exclusive Write access to the shared memory area. Thus access to the area goes through the library calls (e.g. uswrite and usread) but allows many processes to read from the memory area but this access is denied once a process tries to write to this area. This guarantees shared memory integrity.

16 Joe CordinaUser-level Memory Management16 Documentation Inception report (Thursday 28 th February) Analysis/Design Work plan Report Detailed analysis of problem Discussion of solution (+ others considered) Detailed description of data structures and algorithms used

17 Joe CordinaUser-level Memory Management17 Presentation 15 minute presentation Choice of material Knowledge of subject Clarity Interview Answer questions related to APT

18 Joe CordinaUser-level Memory Management18 Interaction Expect to report to supervisor every other week: Thursday Who cannot attend must mail in progress report + work in progress demo First meeting Thursday 28 th February

19 Joe CordinaUser-level Memory Management19 The end All the best! Good luck! Work hard!


Download ppt "User-level Memory Management Supervisor: Joe Cordina Co-Supervisor: Kurt Debattista Observer: Kevin Vella."

Similar presentations


Ads by Google