CMPS111 Homework 4 solution




5/5 - (6 votes)

(6 Marks) Question 1. For the following Unix directory listing, express the file permissions shown as
(a) a protection matrix, (b) access control lists, and (c) capability lists. In this case, the user alice
is in two groups, users and devs.
-rw-r–r– 2 bob users 4096 Apr 11 08:08 notes.txt
-rwxr-xr-x 1 alice devs 3264 Apr 11 08:08 prog
-rw-rw—- 1 alice users 128 Apr 11 08:08 prog.c
-rw-r—– 1 alice devs 8122 Apr 11 08:08 image.gif
(4 Marks) Question 2. Processor A has separate memory caches for data and executable code;
processor B has a single cache where it stores both data and executable code. (a) Which processor
will leave an operating system running on it more susceptible to a buffer overflow attack? Explain
your answer. (b) List and describe two ways an operating system might try to protect itself from
buffer overflow attacks regardless of the processor on which it runs.
(4 Marks) Question 3. Consider a simple, non-paged memory management system in which
memory consists of the following hole sizes in memory order: 10 MB, 4 MB, 20 MB, 18 MB, 7 MB, 9
MB, 12 MB, and 15 MB. Which hole is taken for successive segment requests of 12 MB, 10 MB,
and 9 MB for (a) first fit (b) best fit (c) worst fit (d) next fit? Show all your work.
(3 Marks) Question 4. A computer with a 32-bit processor uses a two-level page lookup mechanism
consisting of page tables and a page table directory. Virtual Addresses consist of a 9-bit page table
directory field, an 11-bit page table field, and an offset. How large are the pages and how many are
there in the address space? Show your work.
(8 Marks) Question 5. (a) Explain the difference between the terms internal fragmentation and
external fragmentation as they relate to memory allocation. (b) Briefly outline the concept of paging.
(c) Explain why paging is considered a better memory management technique than compaction. In
all cases, draw diagrams if you feel this will make your answers clearer.